summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/input/input_http.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/input/input_http.c b/src/input/input_http.c
index 1ee34302b..709e7858b 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.122 2006/09/13 22:50:43 dgp85 Exp $
+ * $Id: input_http.c,v 1.123 2006/09/13 23:28:22 dgp85 Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -675,7 +675,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
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 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
this->curpos = 0;
if (this->fh == -1)
- return 0;
+ return -1;
{
uint32_t timeout, progress;
@@ -727,8 +727,10 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
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 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
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 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
*/
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 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
_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 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
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 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
_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 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
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 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
}
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);