Preferences

He was referring to HTTP 1.0 & 1.1

Parts of 1.1 are pretty complicated if you try and implement them. Parts of it are simple.

The whole section on cache is "reality based," and it's only gotten worse as the years have moved on.

Anyway, back in the day Content-Length was one of the fields you were never supposed to trust. There's really no reason to trust it now, but I suppose you can use it as a hint to see amount of buffer you're supposed to allocate. But of course, the content length may exceed that length, which would mean that if you did it incorrectly you'd copy the incoming request data past the end of the buffer.

So even today, don't trust Content-Length.

You can’t trust lengths in any protocol or format.
Should have say that so (Nowhere does the article say ‘up to HTTP/1.1’ even talking about HTTP/2 and HTTP/3).

HTTP/1.0 is simple. HTTP/1.1 is undoubtedly more complex but manageable.

The statement that HTTP is simple is just not true. Even if Go makes it look easy.

Every example in the article explicitly states HTTP 1.1, only at the end does it have a remark about how HTTP 2 and 3 don't have chunking as they have their own streaming mechanisms. The basic HTTP protocol is simple, but 2/3 are no longer the basic HTTP protocols.
My point is HTTP isn't HTTP/1.1. There is a lot under the wood, even with HTTP/1.1. Actually, the fact that the whole article explains an implementation of an HTTP header is against the fact that it's simple.

So when the article say "All HTTP requests look something like this", that's false, that is not a big deal but it spread that idea that HTTP is easy and it's not.

Which is reasonably simple that you can build a complete 1.0 server in C in an afternoon, and add some 1.1 stuff like keep-alives, content-length, etc. I did that for fun once, on github.com/lionkor/http
That’s the easy part. The hard part is working around non-compliant third parties. HTTP is a real mess.
That's pretty much every protocol and working around non-compliant third parties is not specific protocol problem ;)
The HTTP 1.1 spec isn't 175 pages long just for the fun of it. :)

This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal