Do not abort HTTP requests missing a reason string.

Some (arguably broken) HTTP servers do not put the reason message in their
status line, which causes evhttp to consider the response invalid.

http://sourceforge.net/tracker/?func=detail&aid=2875077&group_id=50884&atid=461322
This commit is contained in:
Pierre Phaneuf 2010-04-27 22:25:59 -04:00
parent ae6ece02f6
commit 29d7b32813

5
http.c
View File

@ -1230,14 +1230,13 @@ evhttp_parse_response_line(struct evhttp_request *req, char *line)
{ {
char *protocol; char *protocol;
char *number; char *number;
char *readable; char *readable = "";
protocol = strsep(&line, " "); protocol = strsep(&line, " ");
if (line == NULL) if (line == NULL)
return (-1); return (-1);
number = strsep(&line, " "); number = strsep(&line, " ");
if (line == NULL) if (line != NULL)
return (-1);
readable = line; readable = line;
if (strcmp(protocol, "HTTP/1.0") == 0) { if (strcmp(protocol, "HTTP/1.0") == 0) {