summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2009-05-09 14:34:31 -0400
committerDan Winship <danw@gnome.org>2009-05-09 14:34:31 -0400
commit230c0f38e2bcd4a6109e8e5c93da8d236d290647 (patch)
treec238c976043a88dca76ab4cd3c9a4225209555bc
parent4d8e5c85894ade47189612fbafd0410792de2dbc (diff)
downloadlibsoup-230c0f38e2bcd4a6109e8e5c93da8d236d290647.tar.gz
Fix the header/body boundary detection logic
The change to support LF LF in addition to CRLF CRLF broke this subtly so that if the first network read returned a packet that ended at a CR, then the following LF would be mistakenly interpreted as ending the headers. http://bugzilla.gnome.org/show_bug.cgi?id=582002
-rw-r--r--libsoup/soup-message-io.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libsoup/soup-message-io.c b/libsoup/soup-message-io.c
index 5364868f..f4ecfb55 100644
--- a/libsoup/soup-message-io.c
+++ b/libsoup/soup-message-io.c
@@ -257,7 +257,15 @@ read_metadata (SoupMessage *msg, gboolean to_blank)
if (got_lf) {
if (!to_blank)
break;
- if (nread == 1 || (nread == 2 && read_buf[0] == '\r'))
+ if (nread == 1 &&
+ !strncmp (io->read_meta_buf->data +
+ io->read_meta_buf->len - 2,
+ "\n\n", 2))
+ break;
+ else if (nread == 2 &&
+ !strncmp (io->read_meta_buf->data +
+ io->read_meta_buf->len - 3,
+ "\n\r\n", 3))
break;
}
}