c-cube / tiny_httpd

Minimal HTTP server using good old threads + blocking IO, with a small request router.
https://c-cube.github.io/tiny_httpd
75 stars 11 forks source link

missing code for trailer in chunked message #56

Closed craff closed 1 year ago

craff commented 1 year ago

chunked message always include a trailer. in output an empty trailer is missing, in read_chunked, may be a call back reading the trailer could be provided. This is fixed in simple_httpd with such a call back. look at the RFC

c-cube commented 1 year ago

Good catch. I've missed the last CRLF indeed (so many of them!).

I'm not necessarily interested in trailers, are they actually used for anything? Does the server provide them in any useful case?

craff commented 1 year ago

You have to parse them, even if you ignore them, especially with keep alive, just to respect the rfc . I added a ref to some headers in Request.t, that is updated by a function parameter of read_chunked. And added a function Request.trailer to read this ref after the body is parsed. That's not too invasive.

Le 4 février 2023 18:50:06 GMT-10:00, Simon Cruanes @.***> a écrit :

Good catch. I've missed the last CRLF indeed (so many of them!).

I'm not necessarily interested in trailers, are they actually used for anything? Does the server provide them in any useful case?

-- Reply to this email directly or view it on GitHub: https://github.com/c-cube/tiny_httpd/issues/56#issuecomment-1416922161 You are receiving this because you authored the thread.

Message ID: @.***>

craff commented 1 year ago

And I did not understand if it is mandatory to annonce the trailers in the headers with the "Trailer" headers before the body or if you just may announce them to warn the other end.

Le 4 février 2023 18:50:06 GMT-10:00, Simon Cruanes @.***> a écrit :

Good catch. I've missed the last CRLF indeed (so many of them!).

I'm not necessarily interested in trailers, are they actually used for anything? Does the server provide them in any useful case?

-- Reply to this email directly or view it on GitHub: https://github.com/c-cube/tiny_httpd/issues/56#issuecomment-1416922161 You are receiving this because you authored the thread.

Message ID: @.***>