[1/2] http: Print an error message for Authorization Required, too

Message ID 1321006285-77158-1-git-send-email-martin@martin.st
State Committed
Commit b01f5ba2070e022e6cf6c1fa8410367e90e33b60
Headers show

Commit Message

Martin Storsjö Nov. 11, 2011, 10:11 a.m.
The error was hidden before, to avoid showing an error on the
first request where no auth has been provided, when the server
indicates which authentication method to use.

Now the error is printed if an authentication method
was used, but failed.
---
 libavformat/http.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Luca Barbato Nov. 11, 2011, 11:48 a.m. | #1
On 11/11/11 2:11 AM, Martin Storsjö wrote:
> The error was hidden before, to avoid showing an error on the
> first request where no auth has been provided, when the server
> indicates which authentication method to use.
>

Patch ok

Patch

diff --git a/libavformat/http.c b/libavformat/http.c
index 83ffc0b..093bb82 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -236,7 +236,8 @@  static int process_line(URLContext *h, char *line, int line_count,
 
         /* 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
+            || s->auth_state.auth_type != HTTP_AUTH_NONE)) {
             end += strspn(end, SPACE_CHARS);
             av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n",
                    s->http_code, end);