# HG changeset patch # User mstorsjo # Date 1279289737 0 # Node ID 89adb1f9ff5009c79c4ec7e5a72231900ae02da9 # Parent 7b8b71ff9a76e80a4353c5eab18d1d3e8dcff484 http: Log a warning when receiving an error code diff -r 7b8b71ff9a76 -r 89adb1f9ff50 http.c --- a/http.c Fri Jul 16 14:12:52 2010 +0000 +++ b/http.c Fri Jul 16 14:15:37 2010 +0000 @@ -210,7 +210,7 @@ int *new_location) { HTTPContext *s = h->priv_data; - char *tag, *p; + char *tag, *p, *end; /* end of header */ if (line[0] == '\0') @@ -222,14 +222,18 @@ p++; while (isspace(*p)) p++; - s->http_code = strtol(p, NULL, 10); + s->http_code = strtol(p, &end, 10); dprintf(NULL, "http_code=%d\n", s->http_code); /* error codes are 4xx and 5xx, but regard 401 as a success, so we * don't abort until all headers have been parsed. */ - if (s->http_code >= 400 && s->http_code < 600 && s->http_code != 401) + if (s->http_code >= 400 && s->http_code < 600 && s->http_code != 401) { + end += strspn(end, SPACE_CHARS); + av_log(NULL, AV_LOG_WARNING, "HTTP error %d %s\n", + s->http_code, end); return -1; + } } else { while (*p != '\0' && *p != ':') p++;