[libsoup] Fix the header/body boundary detection logic
- From: Dan Winship <danw src gnome org>
- To: svn-commits-list gnome org
- Subject: [libsoup] Fix the header/body boundary detection logic
- Date: Sat, 9 May 2009 14:36:40 -0400 (EDT)
commit 230c0f38e2bcd4a6109e8e5c93da8d236d290647
Author: Dan Winship <danw gnome org>
Date: Sat May 9 14:34:31 2009 -0400
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
---
libsoup/soup-message-io.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/libsoup/soup-message-io.c b/libsoup/soup-message-io.c
index 5364868..f4ecfb5 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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]