From 17b4d5acdbcfdf069e549ba27b49b8dc89ce2488 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 30 May 2007 15:58:10 +0100 Subject: Include the WWW-Authenticate header content in the "authentication needed" msg. --- src/input/input_http.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/input/input_http.c b/src/input/input_http.c index 12b7f3f35..d1202ae14 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -832,11 +832,10 @@ static int http_plugin_open (input_plugin_t *this_gen ) { httpcode, httpstatus); return -7; } else if (httpcode == 401) { - _x_message(this->stream, XINE_MSG_AUTHENTICATION_NEEDED, this->mrl, NULL); xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: http status not 2xx: >%d %s<\n"), httpcode, httpstatus); - return -8; + /* don't return - there may be a WWW-Authenticate header... */ } else if (httpcode == 403) { _x_message(this->stream, XINE_MSG_PERMISSION_ERROR, this->mrl, NULL); xine_log (this->stream->xine, XINE_LOG_MSG, @@ -874,6 +873,10 @@ static int http_plugin_open (input_plugin_t *this_gen ) { return http_plugin_open(this_gen); } + if (!strncasecmp (this->buf, "WWW-Authenticate: ", 18)) + strcpy (this->preview, this->buf + 18); + + /* Icecast / ShoutCast Stuff */ if (!strncasecmp(this->buf, TAG_ICY_NAME, sizeof(TAG_ICY_NAME) - 1)) { _x_meta_info_set(this->stream, XINE_META_INFO_ALBUM, @@ -933,6 +936,10 @@ static int http_plugin_open (input_plugin_t *this_gen ) { lprintf ("end of headers\n"); + if (httpcode == 401) + _x_message(this->stream, XINE_MSG_AUTHENTICATION_NEEDED, + this->mrl, *this->preview ? this->preview : NULL, NULL); + /* * fill preview buffer */ -- cgit v1.2.3