diff options
author | Martin Storsjö | 2010-07-16 14:15:37 +0000 |
---|---|---|
committer | Martin Storsjö | 2010-07-16 14:15:37 +0000 |
commit | db979afed26fa8526b027a1137b247ae0bda2423 (patch) | |
tree | 91039f3984dd12f757fd68ca8ba765a1d820c690 /libavformat/http.c | |
parent | 1537817e3863d372f869be30994b943793efeeb1 (diff) |
http: Log a warning when receiving an error code
Originally committed as revision 24266 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/http.c')
-rw-r--r-- | libavformat/http.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libavformat/http.c b/libavformat/http.c index 2b503a1a08..eae780c2f8 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -210,7 +210,7 @@ static int process_line(URLContext *h, char *line, int line_count, 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 @@ static int process_line(URLContext *h, char *line, int line_count, 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++; |