50 points · by networked · 2y ago · 44 comments
I encourage everybody to read TBL's book Weaving The Web and his other expository writing about the birth of the Web, the thinking that went into URIs/UDIs, and the absence of a universal information space—the hole that existed before he invented the Web to fill it.
* whether mainstream browsers by the big tech companies support or not is a separate matter
That's an understatement, which is sort of the whole point of what I wrote:
> I encourage everybody to read TBL's book Weaving The Web and his other expository writing
People who think they know what the Web is but thinks it doesn't include Gopherspace are simply wrong; they are ignorant—in the literal, denotative sense of the word.
> Usually you would say HTML and HTTP(S) is "The Web"
No. The Web is the Web, for all the reasons I already gave. "The Web doesn't mean "browser technologies".
If they did, I would be concerned Google was going to EEE (Embrace, Extend, Extinguish) them. So I hope they don't.
e.g. Using spartan protocol as inspiration [1], a client upload request could potentially be:
example.com /upload/africa.mp3 3145728 1 <CRLF>
Content-Type: audio/mp3 <CRLF>
<binary stream>
Where the "1" in the request line stands for one header to follow. Or maybe it's just not needed at all, assuming you like HTTP's line break between headers and message body.This borrows from HTTP a bit, but other approaches could be viable of course. But this would give the protocol much more extensibility and allow more freedom for inspired implementations.
[1] http://portal.mozz.us/gemini/spartan.mozz.us/examples.gmi
So what? If Spartan doesn't do anything with them, it can save them to the disk: It doesn't need to know the difference between a zipfile and an xlsx sheet in order to do so.
> An out-of-band content-type is the only workable solution
Solution to what? I don't think "more metadata" solves anything, let alone security problems.
An "out-of-band content type" declaration is just that: an unsubstantiated claim as to a valid interpretation of the bytes-in-question.
Using a buggy png parser just because some other layer said it was "image/png" is where the security problems are.
> auto-detection of file formats (a.k.a. ”sniffing”) has has a terrible security record.
The single biggest source of security problems is code you don't need: Fix whatever program you've got that can't tolerate random bytes from the Internet, or don't give those programs random bytes you get from the Internet.
I think there are some problems with it.
Why does it allow a username/password in the URL even though there is no way for the protocol to use it (and it cannot send this to the server)?
It also says "The fragment component is allowed but has no special meaning"; however, the fragment component is meaningful but that depends on the file format and not on the protocol, and it is meaningful to the client and not to the server.
It also does not distinguish GET requests by PUT (or POST) requests.
There is no range requests and no response header indicating the file size (Gemini also lacks this, but it does use TLS close-notify to tell that it is finished).
I dislike that Gemini requires TLS, but Spartan does not allow TLS at all. (I think it makes more sense for TLS vs non-TLS to be distinguished by the first byte that the client sends to the server (and the client distinguishes them by the URI scheme); using separate port numbers is not required.)
Spartan also has some good ideas, such as the =: link type.
I wrote a document about "small web" protocols: scorpion://zzo38computer.org/smallweb.txt
The beginning of a TLS session begins with a "client hello" message[1] which is pretty easy to collect, parse (even without OpenSSL). A few pieces of software I've run into do this check before deciding which protocol to use and I find it nice to have a single port open I can speak TLS and non-TLS to.
I would think that calling recv with MSG_PEEK could be used to read the first byte; if it is 0x16 then it can continue with TLS (using OpenSSL or other libraries to wrap the connection), and if it is anything else then it will continue without TLS. (This should work with any protocol that expects the client to send data first before the server does, and that 0x16 is not a valid first byte of the request.)
However, I have not actually tried this (since I have not set up any servers with TLS yet).
What I like about Spartan is that it requires no URL parsing on the server, has a small but sufficient set of status codes, and adds `=:` to gemtext. Making requests ASCII seems like a good idea, too. It means old computers can support the full protocol without implementing Unicode.
Maybe headers are what this kind of protocol needs. One problem with HTTP/1.1 headers is that they are deceptively simple. Processing them correctly requires handling letter case, leading and trailing whitespace, duplicate field names, and fields that span multiple lines. (A line the starts with a space or tab continues the previous.) A new protocol could, for example, limit the field names to a small single-case set of characters, like [a-z0-9-] or [A-Z0-9_]. It could also build on an existing unambiguous way to encode headers/arrays like SCGI (https://python.ca/scgi/protocol.txt) or RESP (the Redis protocol, https://web.archive.org/web/20211127173832/https://redis.io/...).
> scorpion://zzo38computer.org/smallweb.txt
This is an interesting document! I haven't seen a large comparison like this, and some of the protocols are new to me. It should really be available over other protocols. I couldn't find it on your Gopher site and downloaded it the way https://news.ycombinator.com/item?id=41159495 suggested. Since you support it anyway, I have mirrored the file at https://dbohdan.com/mirror/scorpion/zzo38computer.org/smallw....
Perhaps I was unclear, because it is not quite what I meant. What I meant is GET requests with query strings vs POST requests. That is what Spartan does not. distinguish. It does distinguish POST requests from requests with no data, but it is not what I meant.
> Making requests ASCII seems like a good idea, too. It means old computers can support the full protocol without implementing Unicode.
Yes, I also think that it is a good idea. (However, implementing Unicode is not really necessary for a client to send requests anyways (which is the case even if the request is UTF-8, although specifying that requests are ASCII seems cleaner and better to me). The more important part is that the request does not use Unicode domain names and sends them in ASCII format instead, and that the server accepts this and does not expect Unicode requests.)
> One problem with HTTP/1.1 headers is that they are deceptively simple. Processing them correctly requires handling letter case, leading and trailing whitespace, duplicate field names, and fields that span multiple lines. (A line the starts with a space or tab continues the previous.)
I agree with this, they are the problems with the HTTP header format, and it is what I had thought too. However, there is also the consideration of, should you really need so many headers anyways?
> Since you support it anyway, I have mirrored the file at https://dbohdan.com/mirror/scorpion/zzo38computer.org/smallw...
I have added it to the list of mirrors at the bottom of the file.
Oh, I see. Yes, I would say that, conceptually, Spartan doesn't have GET requests with a query; it only has GET without a query and POST. `=:` is like HTML `<form action="post">`. If you wanted to add queries to Spartan, you would probably do it without breaking compatibility by parsing the query out of `path-absolute`. For example:
example.com /weather?city=lisbon&time=tomorrow 0
The downside is that it would drag in part of URL parsing on the server, which the protocol currently avoids.> However, there is also the consideration of, should you really need so many headers anyways?
I see it not as a matter of number but change over time. Headers leave room for protocol evolution and extension. You could also have evolution with protocol versions. A caveat is that if you ever go from sequential versions like 1.2 to versions that enumerate features like 1.2+foo+bar, you end up in a similar place to headers. Compared to headers, you get more flexibility in protocol parsing and a more ad hoc design. Most of your features probably don't need the flexibility, so you just pay the cost of an ad hoc design. (For example, `+foo` and `+bar` may each add a field to the request line. You'd have to make sure they didn't conflict.)
> I have added it to the list of mirrors at the bottom of the file.
Yay.
Is this available on other protocol? (Ideally HTTP, Gopher or Gemini would be good too). It seems you already have gopher site but I was not able to locate it there.
nc zzo38computer.org 1517 <<<'R scorpion://zzo38computer.org/smallweb.txt'After writing a second system, it seems that developers want to write a third system that eschews the complexity of the second system, only to learn why it was there. Just look at Wayland for an example.
Spartan and Gemini are so similar they shouldn't need to be different protocols. This route leads to 10000 protocol variations and your URL will need to indicate that the page is on a type 4854 server. (4=QUIC, 8=ASCII headers separated by LF with user agent forbidden, etc)
For a "small web HTTP", see also: https://news.ycombinator.com/item?id=40980870
I think it is not necessary for servers to reject clients that send a User-Agent header.
I also think that HTTP and (X)HTML is not good for everything. Although they are excessively complicated, and a defined subset would help, still there are some complexities and other problems, I think.
> Spartan and Gemini are so similar they shouldn't need to be different protocols.
I also agree, although each has different problems (some are shared with both). (I think it is helpful to allow both TLS and non-TLS, although Gemini is only TLS and Spartan is only non-TLS.)
That’s a great idea.
My idea was to go other way a bit re javascript. That is, allowed it to run but it’s under the control of the user, not the website. A bit like installing a native app. For anything functional, why not have companies just send JSON or have an API and the user can display as they see fit. sending sqlite files around would be another option.
I can’t help but thing that in the future people will laugh at how ridiculous we are with stuff like the l fact that the service provider can make me chase my tail around intentionally obfuscated UI in order to cancel.
It is not the only way, although it is one possibility.
> My idea was to go other way a bit re javascript. That is, allowed it to run but it’s under the control of the user, not the website.
Simpler designs can be made than JavaScript with HTML DOM. But, when it can be allowed, yes it should be under the control of the user and not the website.
> For anything functional, why not have companies just send JSON or have an API and the user can display as they see fit. sending sqlite files around would be another option.
I had a similar idea (although I think there are some problems with some file formats such as JSON, too).
However, it does help to be able to specify which files can be used to display unknown files. My Scorpion protocol/file-format specification includes such a feature called a "conversion file"; both server-side and client-side conversion are possible. It is optional to implement, but if it is implemented, the specification requires that the user is allowed to override it with their own specifications if desired.
I'd agree here for sure. I suppose I was thinking that if JSON (or any other basic format) was specified in and out from companies, etc; a client-side browser replacement could be about anything. I think the fact that current browsers are 100s of millions of lines of code (or whatever) get in the way of the fact that, at its core, a browser doesn't have to insanely complex.
You need a way to put info on a screen and a way to talk over the network. That's pretty much the core. Not hard to add some flavor of storage and/or scripting client-side.
I've only toyed with a bit, but I think something like the Lua Love2D tool pretty much gets you there. Or any number of approaches.
> although I think there are some problems with some file formats such as JSON, too
Curious what you think those problems are. I'm not defending it particularly and have heard a few valid critiques tossed around online but am always open for hearing how folks think about it. Personally, I'm largely surprised that anything has managed to coalesce into a general format for data.
> My Scorpion protocol/file-format specification includes such a feature called a "conversion file"; both server-side and client-side conversion are possible.
Cool, I'll go take a look for it.
Feel free to ping me at the email in my profile if you're up for kicking any ideas around.
The topic has been sitting on my mind for a long time and I'm glad to get behind anyone's even half plausible technological approach. I think our 60 years of Moore's Law makes any one of a number of approaches possible. But prob not just me plugging away here solo in my living room.
https://communitywiki.org/wiki/Titan
Altough for a global file upload/downloading a la FTP, NFS, and so on replacing them all, 9p it's the easiest choice. Encryption? Use an encryption layer below. Wireguard, Tor... any proto you like. Permissions? Your OS should handle them fine.
* client connects to ftp-server:22
> STOR ~/newfile.txt <CR><LF>
< 227 server-generated-magical-cookie-nonce <CR><LF>
* client again connects to ftp-server:22
> DATA server-generated-magical-cookie-nonce <CR><LF>
< 225 <CR><LF>
> ...binary data follows
And never mind all the cruft needed to support OSes that pre-date UNIX or, in fact, TCP's wide adoption. Seriously, 99% of the time all the upload functionality you want is equivalent to <newfile.txt ssh ftp-server 'cat >newfile.txt'
The 1 remaining percent is upload resumption.Given enough time, every protocol will have workarounds for $SOMETHING_WRITTEN_IN_LAST_DECADE (or before).
This is the bane of backwards compatibility. There'll be always one off patches for something. Always.
Titan is a suitable companion to Gemini for uploads (although I dislike the way that the file size parameters are added to the URL, and a few other details), but that is if you want to use Gemini, including the required TLS.
I think FTP is no good.
I also think that different protocol can have different advantages/disadvantages and can be good for different purposes.
Sorry but pass.
This applies to the protocol, not to the file being transfered by the protocol. The file format is UTF-8, but the protocol is ASCII.