From 01f379bf544c35cf3c17d3dacfbb2eec2cc6d7d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 17 Mar 2007 16:47:16 +0000 Subject: Some servers does not send a human-readable http status description, for those, check only the status code. This fixes WikipediaWeekly podcasts for instance. CVS patchset: 8706 CVS date: 2007/03/17 16:47:16 --- src/input/input_http.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/input/input_http.c b/src/input/input_http.c index a9bcee0d5..3adbc836b 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -19,7 +19,7 @@ * * input plugin for http network streams * - * $Id: input_http.c,v 1.128 2007/02/20 00:34:56 dgp85 Exp $ + * $Id: input_http.c,v 1.129 2007/03/17 16:47:16 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -804,18 +804,20 @@ static int http_plugin_open (input_plugin_t *this_gen ) { if (linenum == 1) { int httpver, httpsub; - char httpstatus[51]; - - if (sscanf(this->buf, "HTTP/%d.%d %d %50[^\015\012]", &httpver, &httpsub, - &httpcode, httpstatus) != 4) { - - /* icecast 1 ? */ - if (sscanf(this->buf, "ICY %d %50[^\015\012]", &httpcode, httpstatus) != 2) { + char httpstatus[51] = { 0, }; + + if ( + (sscanf(this->buf, "HTTP/%d.%d %d %50[^\015\012]", &httpver, &httpsub, + &httpcode, httpstatus) != 4) && + (sscanf(this->buf, "HTTP/%d.%d %d", &httpver, &httpsub, + &httpcode) != 3) && + (sscanf(this->buf, "ICY %d %50[^\015\012]", /* icecast 1 ? */ + &httpcode, httpstatus) != 2) + ) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "invalid http answer", NULL); xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: invalid http answer\n")); return -6; - } } if (httpcode >= 300 && httpcode < 400) { -- cgit v1.2.3