diff options
Diffstat (limited to 'stream/http.c')
-rw-r--r-- | stream/http.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/stream/http.c b/stream/http.c index 8d930c6460..e88b0bd468 100644 --- a/stream/http.c +++ b/stream/http.c @@ -195,7 +195,10 @@ static int scast_streaming_start(stream_t *stream) { if (is_ultravox) metaint = 0; else { - metaint = atoi(http_get_field(http_hdr, "Icy-MetaInt")); + metaint = -1; + char *h = http_get_field(http_hdr, "Icy-MetaInt"); + if (h) + metaint = atoi(h); if (metaint <= 0) return -1; } @@ -460,21 +463,20 @@ http_response_parse( HTTP_header_t *http_hdr ) { char * http_build_request( HTTP_header_t *http_hdr ) { - char *ptr, *uri=NULL; + char *ptr, *uri; int len; HTTP_field_t *field; if( http_hdr==NULL ) return NULL; + if( http_hdr->uri==NULL ) return NULL; if( http_hdr->method==NULL ) http_set_method( http_hdr, "GET"); - if( http_hdr->uri==NULL ) http_set_uri( http_hdr, "/"); - else { - uri = malloc(strlen(http_hdr->uri) + 1); - if( uri==NULL ) { - mp_msg(MSGT_NETWORK,MSGL_ERR,"Memory allocation failed\n"); - return NULL; - } - strcpy(uri,http_hdr->uri); - } + + uri = malloc(strlen(http_hdr->uri) + 1); + if( uri==NULL ) { + mp_msg(MSGT_NETWORK,MSGL_ERR,"Memory allocation failed\n"); + return NULL; + } + strcpy(uri,http_hdr->uri); //**** Compute the request length // Add the Method line @@ -829,18 +831,16 @@ static int http_streaming_start(stream_t *stream, int* file_format) { if( next_url!=NULL ) { int is_ultravox = strcasecmp(stream->streaming_ctrl->url->protocol, "unsv") == 0; stream->streaming_ctrl->url = url_redirect( &url, next_url ); - if (!strcasecmp(url->protocol, "mms")) { + if (url_is_protocol(url, "mms")) { res = STREAM_REDIRECTED; goto err_out; } - if (strcasecmp(url->protocol, "http")) { + if (!url_is_protocol(url, "http")) { mp_msg(MSGT_NETWORK,MSGL_ERR,"Unsupported http %d redirect to %s protocol\n", http_hdr->status_code, url->protocol); goto err_out; } - if (is_ultravox) { - free(url->protocol); - url->protocol = strdup("unsv"); - } + if (is_ultravox) + url_set_protocol(url, "unsv"); redirect = 1; } break; |