GNOME Bugzilla – Bug 571283
libsoup does not handle <LF><LF> between http response headers and body.
Last modified: 2009-03-24 23:14:19 UTC
Please describe the problem: When writing an application that will read parameters from security cameras it was discovered that the cameras sends back an invalid response to libsoup. The cameras separates the http response headers from the body with an <LF><LF> sequence instead of the correct <CR><LF><CR><LF> which causes libsoup to report it as a corrupt response. Even though the cameras are sending a corrupt http response we would still like to use libsoup so I have prepared a patch that solves the problem. It might not be the right way to do it but it should give an indication on what is going on. Steps to reproduce: 1. Send a http://get to an Axis security camera Actual results: libsoup will respond with an Error number 8, corrupt response. Expected results: That all should be OK Does this happen every time? Yes Other information:
Created attachment 128451 [details] [review] Patch that solves the problem. The fix was done in a hurry for us to be able to proceed in the project. I detect and correct the problem before the result is sent to the header parser instead of actually correcting the parser (Which seamed like a daunting task :-)
We can't change the API of soup_socket_read_until(), because it's used outside of libsoup (eg, by the gvfs ftp backend). We could add another method that takes multiple boundaries though... (though I don't like rewriting LF to CRLF inside SoupSocket either way...) My long-term strategy for dealing with bad HTTP implementations is to let the app install I/O filters that get a chance to rewrite things before libsoup's parsers ever see them. (So in this case, the filter would rewrite the LF to CRLF before soup_socket_read_until() got a chance to compare it to the boundary string, so we'd still only need one boundary string.) Not sure when that will happen though. I'm thinking about what the best fix here would be...
*** Bug 575530 has been marked as a duplicate of this bug. ***
Created attachment 130911 [details] [review] smaller patch to accept LF LF, doesn't change SoupSocket API Can you try out this patch? Should be able to get this into 2.26.1
(In reply to comment #4) > smaller patch to accept LF LF, doesn't change SoupSocket API It really fixed the problem with pg's (Arc?) webserver :P Thanks :)
committed. This will be in 2.26.1