Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-09-09
17:11 • Ticket [1589887fff] Read headerless response (HTTP/0.9, 1.0 Simple-Response)... artifact: 3fe3b78d01 user: kjnash
2022-05-31
00:16 • Ticket [1589887fff]: 3 changes artifact: deb76627dd user: kjnash
2022-05-30
22:18 • Ticket [1589887fff]: 7 changes artifact: 101f7c6f5e user: kjnash
2006-11-03
19:42 • Ticket [1589887fff]: 1 change artifact: 789e4eded7 user: kaitzschu
19:38 • Ticket [1589887fff]: 4 changes artifact: f2d3e590be user: kaitzschu
19:38 • Add attachment noheaders.patch to ticket [1589887fff] artifact: 3cd82e8b5d user: kaitzschu
12:38 • New ticket [1589887fff] Read headerless (very specific/broken) servers data. artifact: 050ccc8d7b user: kaitzschu

Read headerless response (HTTP/0.9, 1.0 Simple-Response)

Open1589887fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 4 years ago
Descriptionplain2006-11-03 12:38:28
Currently when using http::geturl with a server that 
does not send required headers (but starts sending 
data right away) http::Event stays in state=header and 
after command returns there is effectively nothing 
received (unless by accident some line happens to look 
like HTTP-header).

This behaviour rises from missing else clause in 
http::Event (last statement is elseif).

Suggested behaviour is that if in state=header there 
is a nonempty line that does not match any of 
expressions so far that line is considered to be first 
line of data and treated as such.

This implementation can't handle requests that use -
handler option, as socket buffer can't be unread (at 
least not at script level). Also encodings have slight 
chance of misbehaviour, as line is read before socket 
has been fconfigured. That should be possible to fix 
(except -binary configuration, where carriage return 
can be lost due translation=auto). Progress callbacks 
are likely to be problematic, too, especially with 
callbacks relying on fixed chunk sizes.

But most of these problems (excluding -handler) are to 
be expected as currently you wouldn't get anything at 
all to process.
kaitzschuplain2006-11-03 19:38:29
File Added - 201267: noheaders.patch
kaitzschu Ticket [1589887fff]: 1 change [History diff]2006-11-03 19:42:05
kjnashplain2022-05-30 22:18:03
A server response with no status line or headers, but only a response body, is the "Simple-Response" of HTTP/0.9 and 1.0.  The relevant text of RFC 1945 Section 6 is:

   If a client sends an HTTP/1.0 Full-Request and
   receives a response that does not begin with a Status-Line, it should
   assume that the response is a Simple-Response and parse it
   accordingly. Note that the Simple-Response consists only of the
   entity body and is terminated by the server closing the connection.

Appendix A of RFC 7230 states:

   HTTP/1.1 has been designed to make supporting previous versions easy.
   A general-purpose HTTP/1.1 server ought to be able to understand any
   valid request in the format of HTTP/1.0, responding appropriately
   with an HTTP/1.1 message that only uses features understood (or
   safely ignored) by HTTP/1.0 clients.  Likewise, an HTTP/1.1 client
   can be expected to understand any valid HTTP/1.0 response.

This suggests that our HTTP/1.1 client should be able to understand a valid HTTP/1.0 "Simple-Response", even though the "Simple-Response" is not valid as a HTTP/1.1 response.  The typical origin of a "Simple-Response" is an ancient HTTP/1.0 server.
kjnash Ticket [1589887fff]: 3 changes [History diff]2022-05-31 00:16:52
kjnashplain2022-09-09 17:11:37
Ideally a fix would have to be compatible with -handler and also with -channel.
Log in (anonymous is fine) to add a comment.

Attachments: