From: <dg...@us...> - 2006-09-13 23:28:24
|
Update of /cvsroot/xine/xine-lib/src/input In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27889 Modified Files: input_http.c Log Message: Return -1 when a connection error happens, so that other input plugins are not tried and the proper error message is returned. Index: input_http.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/input/input_http.c,v retrieving revision 1.122 retrieving revision 1.123 diff -u -r1.122 -r1.123 --- input_http.c 13 Sep 2006 22:50:43 -0000 1.122 +++ input_http.c 13 Sep 2006 23:28:22 -0000 1.123 @@ -675,7 +675,7 @@ if (this->user && strlen(this->user)) { if (http_plugin_basicauth (this->user, this->password, this->auth, BUFSIZE)) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "basic auth error", NULL); - return 0; + return -1; } } @@ -709,7 +709,7 @@ this->curpos = 0; if (this->fh == -1) - return 0; + return -1; { uint32_t timeout, progress; @@ -727,8 +727,10 @@ progress += (500*100000)/timeout; } while ((res == XIO_TIMEOUT) && (progress <= 100000)); - if (res != XIO_READY) - return 0; + if (res != XIO_READY) { + _x_message(this->stream, XINE_MSG_NETWORK_UNREACHABLE, this->mrl, NULL); + return -1; + } } if (use_proxy) { @@ -775,7 +777,7 @@ if (_x_io_tcp_write (this->stream, this->fh, this->buf, buflen) != buflen) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "couldn't send request", NULL); xprintf(this_class->xine, XINE_VERBOSITY_DEBUG, "input_http: couldn't send request\n"); - return 0; + return -1; } lprintf ("request sent: >%s<\n", this->buf); @@ -791,7 +793,7 @@ */ if (_x_io_tcp_read (this->stream, this->fh, &this->buf[len], 1) <= 0) { - return 0; + return -1; } if (this->buf[len] == '\012') { @@ -820,7 +822,7 @@ _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 0; + return -1; } } @@ -833,20 +835,20 @@ xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: http status not 2xx: >%d %s<\n"), httpcode, httpstatus); - return 0; + return -1; } else if (httpcode == 403) { _x_message(this->stream, XINE_MSG_PERMISSION_ERROR, this->mrl, NULL); xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: http status not 2xx: >%d %s<\n"), httpcode, httpstatus); - return 0; + return -1; } else if (httpcode < 200 || httpcode >= 300) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "http status not 2xx: ", httpstatus, NULL); xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: http status not 2xx: >%d %s<\n"), httpcode, httpstatus); - return 0; + return -1; } } else { if (this->contentlength == 0) { @@ -924,7 +926,7 @@ _x_message(this->stream, XINE_MSG_PERMISSION_ERROR, this->mrl, NULL); xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: buffer exhausted after %d bytes."), BUFSIZE); - return 0; + return -1; } } @@ -936,7 +938,7 @@ this->preview_size = MAX_PREVIEW_SIZE; if (this->is_nsv) { if (!resync_nsv(this)) - return 0; + return -1; /* the first 3 chars are "NSV" */ this->preview_size = http_plugin_read_int (this, this->preview + 3, MAX_PREVIEW_SIZE - 3); @@ -945,7 +947,7 @@ } if (this->preview_size < 0) { xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: read error %d\n"), errno); - return 0; + return -1; } lprintf("preview_size=%lld\n", this->preview_size); |