aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-04-15 08:18:09 (GMT)
committerJouni Malinen <j@w1.fi>2009-04-20 09:21:42 (GMT)
commitc540c778a89e4cb45b739dcc949c30f8a2776ea4 (patch)
tree576a735fd887f90b2d7457059a6505091c676ba4
parenta93bf535809b4411185ad72ba6e08be67a3ea3b0 (diff)
downloadhostap-06-c540c778a89e4cb45b739dcc949c30f8a2776ea4.zip
hostap-06-c540c778a89e4cb45b739dcc949c30f8a2776ea4.tar.gz
hostap-06-c540c778a89e4cb45b739dcc949c30f8a2776ea4.tar.bz2
Fix small HTTP processing issues
Parse "Transfer-Encoding: chunked" properly. Get more data if read buffer is empty when starting to process the body. (cherry picked from commit 814aaa844a71290aaff497510e4a0d72ab1ca8ba)
-rw-r--r--src/wps/httpread.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wps/httpread.c b/src/wps/httpread.c
index 313b468..0d7165e 100644
--- a/src/wps/httpread.c
+++ b/src/wps/httpread.c
@@ -206,7 +206,8 @@ static int httpread_hdr_option_analyze(
h->got_content_length = 1;
return 0;
}
- if (word_eq(hbp, "TRANSFER_ENCODING:")) {
+ if (word_eq(hbp, "TRANSFER_ENCODING:") ||
+ word_eq(hbp, "TRANSFER-ENCODING:")) {
while (isgraph(*hbp))
hbp++;
while (*hbp == ' ' || *hbp == '\t')
@@ -214,7 +215,7 @@ static int httpread_hdr_option_analyze(
/* There should (?) be no encodings of interest
* other than chunked...
*/
- if (os_strncmp(hbp, "CHUNKED", 7)) {
+ if (word_eq(hbp, "CHUNKED")) {
h->chunked = 1;
h->in_chunk_data = 0;
/* ignore possible ;<parameters> */
@@ -513,6 +514,8 @@ static void httpread_read_handler(int sd, void *eloop_ctx, void *sock_ctx)
* consists of chunks each with a header, ending with
* an ending header.
*/
+ if (nread == 0)
+ goto get_more;
if (!h->got_body) {
/* Here to get (more of) body */
/* ensure we have enough room for worst case for body