mirror of https://github.com/mpv-player/mpv
http: handle broken QuickTime Streaming Server headers
Handle the severely broken headers QuickTime Streaming Server sends. Instead of ending the header with \r\n\r\n it ends with \r\n<4 byte MP3 header>\r\n. And programs like wget just silently accept this without even printing a warning!! git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35988 b3059339-0415-0410-9bf9-f77b7e298cf2 Note: see previous commit.
This commit is contained in:
parent
dac7744888
commit
a98f658d53
|
@ -350,6 +350,7 @@ http_is_header_entire( HTTP_header_t *http_hdr ) {
|
|||
if( http_hdr==NULL ) return -1;
|
||||
if( http_hdr->buffer==NULL ) return 0; // empty
|
||||
|
||||
if(http_hdr->buffer_size > 128*1024) return 1;
|
||||
if( strstr(http_hdr->buffer, "\r\n\r\n")==NULL &&
|
||||
strstr(http_hdr->buffer, "\n\n")==NULL ) return 0;
|
||||
return 1;
|
||||
|
@ -414,12 +415,12 @@ http_response_parse( HTTP_header_t *http_hdr ) {
|
|||
hdr_sep_len = 4;
|
||||
ptr = strstr( http_hdr->buffer, "\r\n\r\n" );
|
||||
if( ptr==NULL ) {
|
||||
hdr_sep_len = 2;
|
||||
ptr = strstr( http_hdr->buffer, "\n\n" );
|
||||
if( ptr==NULL ) {
|
||||
mp_msg(MSGT_NETWORK,MSGL_ERR,"Header may be incomplete. No CRLF CRLF found.\n");
|
||||
return -1;
|
||||
hdr_sep_len = 0;
|
||||
}
|
||||
hdr_sep_len = 2;
|
||||
}
|
||||
pos_hdr_sep = ptr-http_hdr->buffer;
|
||||
|
||||
|
@ -429,7 +430,12 @@ http_response_parse( HTTP_header_t *http_hdr ) {
|
|||
ptr = hdr_ptr;
|
||||
while( *ptr!='\r' && *ptr!='\n' ) ptr++;
|
||||
len = ptr-hdr_ptr;
|
||||
if( len==0 ) break;
|
||||
if (len == 0 || !memchr(hdr_ptr, ':', len)) {
|
||||
mp_msg(MSGT_NETWORK, MSGL_ERR, "Broken response header, missing ':'\n");
|
||||
pos_hdr_sep = ptr - http_hdr->buffer;
|
||||
hdr_sep_len = 0;
|
||||
break;
|
||||
}
|
||||
if (len > 16 && !strncasecmp(hdr_ptr + 4, "icy-metaint:", 12))
|
||||
{
|
||||
mp_msg(MSGT_NETWORK, MSGL_WARN, "Server sent a severely broken icy-metaint HTTP header!\n");
|
||||
|
|
Loading…
Reference in New Issue