projects
/
project
/
uclient.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
http: assume data EOF if the connection terminates
[project/uclient.git]
/
uclient-http.c
diff --git
a/uclient-http.c
b/uclient-http.c
index
6fc30da
..
5e5f996
100644
(file)
--- a/
uclient-http.c
+++ b/
uclient-http.c
@@
-192,6
+192,9
@@
static void uclient_notify_eof(struct uclient_http *uh)
return;
}
return;
}
+ if (uh->content_length < 0 && uh->read_chunked >= 0)
+ uh->uc.data_eof = true;
+
uclient_backend_set_eof(&uh->uc);
if (uh->connection_close)
uclient_backend_set_eof(&uh->uc);
if (uh->connection_close)
@@
-663,28
+666,33
@@
static void __uclient_notify_read(struct uclient_http *uh)
return;
if (uh->state < HTTP_STATE_RECV_DATA) {
return;
if (uh->state < HTTP_STATE_RECV_DATA) {
- char *sep;
+ char *sep
, *next
;
int cur_len;
do {
int cur_len;
do {
- sep = str
str(data, "\r\n"
);
+ sep = str
chr(data, '\n'
);
if (!sep)
break;
if (!sep)
break;
+ next = sep + 1;
+ if (sep > data && sep[-1] == '\r')
+ sep--;
+
/* Check for multi-line HTTP headers */
if (sep > data) {
/* Check for multi-line HTTP headers */
if (sep > data) {
- if (!
sep[2]
)
+ if (!
*next
)
return;
return;
- if (isspace(
sep[2]) && sep[2] != '\r
') {
+ if (isspace(
*next) && *next != '\r' && *next != '\n
') {
sep[0] = ' ';
sep[0] = ' ';
- sep[1] = ' ';
+ if (sep + 1 < next)
+ sep[1] = ' ';
continue;
}
}
*sep = 0;
continue;
}
}
*sep = 0;
- cur_len =
sep + 2
- data;
+ cur_len =
next
- data;
uclient_parse_http_line(uh, data);
if (seq != uh->seq)
return;
uclient_parse_http_line(uh, data);
if (seq != uh->seq)
return;