GNOME Bugzilla – Bug 588658
Support header-only response without CRLF CRLF
Last modified: 2018-09-21 16:02:39 UTC
I have a stupid IP camera from Arecont that gives the following reply on an unauthenticated request: HTTP/1.0 401 Unauthorized\r\n WWW-Authenticate: Basic\r\n <EOF> Since it doesn't end with \r\n\r\n, soup errors out with an IO error. Patch follows.
Created attachment 138444 [details] [review] Accept a response that ends with a single CRLF (or LF) as valid
In general, such a response would indicate that the connection had been interrupted before the server finished sending the response, so we shouldn't just accept it blindly. In particular, if the response had been: HTTP/1.0 200 OK\r\n Content-Length: 1000\r\n <EOF> it would obviously be wrong to consider the message as legitimately ended at that point. So at a minimum, we can only accept "\r\n<EOF>" as a terminator if the message would have been EOF-terminated anyway. (This requires parsing the headers before deciding whether or not to error out though...) bug 577386 is somewhat related. I've got a bunch of soup-message-io changes pending in my head right now that I just need to figure out how to fit together.
(In reply to comment #2) > In general, such a response would indicate that the connection had been > interrupted before the server finished sending the response, so we shouldn't > just accept it blindly. In particular, if the response had been: > > HTTP/1.0 200 OK\r\n > Content-Length: 1000\r\n > <EOF> In this particular case, I think you'd still get an IO error in the body_chunk, no? The behaviour with the patch is AFAICS equivalent to when the server would have sent HTTP/1.0 200 OK\r\n Content-Length: 1000\r\n \r\n <EOF> But probably the following is indeed wrong: HTTP/1.0 200 OK\r\n <EOF> This would result in a valid (empty) body chunk, I think. I don't think there is any way to solve this correctly. After all, it _is_ a broken-off response that we get here... FYI, in wget they treat EOF as end of headers.
[mass-moving all "UNCONFIRMED" libsoup bugs to "NEW" after disabling the "UNCONFIRMED" status for this product now that bugzilla.gnome.org allows that. bugspam-libsoup-20150210]
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/libsoup/issues/23.