diff options
author | Thibaut Mattern <tmattern@users.sourceforge.net> | 2004-12-01 22:55:31 +0000 |
---|---|---|
committer | Thibaut Mattern <tmattern@users.sourceforge.net> | 2004-12-01 22:55:31 +0000 |
commit | 589b10571d063b0ae4b0dcc12d4c3a30a3f5fc00 (patch) | |
tree | 65d02e7786d1e0bf7774ff7d9df0e1072bde7114 | |
parent | f1ed7f17cf382ae1ce43d865196b369486cb1756 (diff) | |
download | xine-lib-589b10571d063b0ae4b0dcc12d4c3a30a3f5fc00.tar.gz xine-lib-589b10571d063b0ae4b0dcc12d4c3a30a3f5fc00.tar.bz2 |
- handle "uvox://" URLs
- handle stupid Nullsoft URL scheme like :
http://208.53.131.46:9502;stream.nsv
CVS patchset: 7183
CVS date: 2004/12/01 22:55:31
-rw-r--r-- | src/input/http_helper.c | 23 | ||||
-rw-r--r-- | src/input/input_http.c | 16 |
2 files changed, 29 insertions, 10 deletions
diff --git a/src/input/http_helper.c b/src/input/http_helper.c index f962766e4..3418a1d50 100644 --- a/src/input/http_helper.c +++ b/src/input/http_helper.c @@ -19,7 +19,7 @@ * * URL helper functions * - * $Id: http_helper.c,v 1.3 2004/09/20 19:30:04 valtri Exp $ + * $Id: http_helper.c,v 1.4 2004/12/01 22:55:31 tmattern Exp $ */ #ifdef HAVE_CONFIG_H @@ -38,6 +38,7 @@ int _x_parse_url (char *url, char **proto, char** host, int *port, char *at = NULL; char *portcolon = NULL; char *slash = NULL; + char *semicolon = NULL; char *end = NULL; char *strtol_err = NULL; @@ -68,6 +69,11 @@ int _x_parse_url (char *url, char **proto, char** host, int *port, start += 3; at = strchr(start, '@'); slash = strchr(start, '/'); + + /* stupid Nullsoft URL scheme */ + semicolon = strchr(start, ';'); + if (semicolon && (!slash || (semicolon < slash))) + slash = semicolon; if (at && slash && (at > slash)) at = NULL; @@ -145,10 +151,19 @@ int _x_parse_url (char *url, char **proto, char** host, int *port, /* uri */ start = slash; - if (start) - *uri = strdup(start); - else + if (start) { + /* handle crazy Nullsoft URL scheme */ + if (*start == ';') { + /* ";stream.nsv" => "/;stream.nsv" */ + *uri = malloc(strlen(start) + 2); + *uri[0] = '/'; + strcpy(*uri + 1, start); + } else { + *uri = strdup(start); + } + } else { *uri = strdup("/"); + } return 1; diff --git a/src/input/input_http.c b/src/input/input_http.c index ddbe6a2cf..a44c662f2 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.99 2004/09/28 15:38:11 athp Exp $ + * $Id: input_http.c,v 1.100 2004/12/01 22:55:31 tmattern Exp $ */ #ifdef HAVE_CONFIG_H @@ -461,7 +461,7 @@ static int read_shoutcast_header(http_input_plugin_t *this) { lprintf("shoutcast mp3 detected\n"); } } - + if (len == -1) done = 1; else @@ -473,7 +473,6 @@ static int read_shoutcast_header(http_input_plugin_t *this) { this->shoutcast_pos = 0; /* NSV resync */ - /* FIXME: move that to the demuxer */ if (this->shoutcast_mode == 2) { uint8_t c; int pos = 0; @@ -721,7 +720,12 @@ static int http_plugin_open (input_plugin_t *this_gen ) { #ifdef LOG { - printf ("input_http: opening >%s< (on host >%s<)", this->mrl, this->host); + printf ("input_http: host : >%s<\n", this->host); + printf ("input_http: port : >%d<\n", this->port); + printf ("input_http: user : >%s<\n", this->user); + printf ("input_http: password : >%s<\n", this->password); + printf ("input_http: path : >%s<\n", this->uri); + if (use_proxy) printf (" via proxy >%s:%d<", this_class->proxyhost, proxyport); @@ -836,7 +840,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { &httpcode, httpstatus) != 4) { /* icecast ? */ - if (sscanf(this->buf, "ICY %d OK", &httpcode) != 1) { + if (sscanf(this->buf, "ICY %d %50[^\015\012]", &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")); @@ -949,7 +953,7 @@ static input_plugin_t *http_class_get_instance (input_class_t *cls_gen, xine_str /* http_input_class_t *cls = (http_input_class_t *) cls_gen;*/ http_input_plugin_t *this; - if (strncasecmp (mrl, "http://", 7)) { + if (strncasecmp (mrl, "http://", 7) && (strncasecmp (mrl, "unsv://", 7))) { return NULL; } this = (http_input_plugin_t *) xine_xmalloc(sizeof(http_input_plugin_t)); |