From: Thibaut M. <tma...@us...> - 2003-01-14 23:39:14
|
Update of /cvsroot/xine/xine-lib/src/input In directory sc8-pr-cvs1:/tmp/cvs-serv32166 Modified Files: mmsh.c Log Message: - Fixes mrl parsing. - Fixes http response parsing - Fixes first http request Index: mmsh.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/input/mmsh.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- mmsh.c 13 Jan 2003 01:23:13 -0000 1.2 +++ mmsh.c 14 Jan 2003 23:39:11 -0000 1.3 @@ -48,9 +48,9 @@ #include "mmsh.h" #include "../demuxers/asfheader.h" -/* + #define LOG -*/ + #define MMSH_PORT 80 #define BUF_SIZE 102400 @@ -75,7 +75,7 @@ "Host: %s\r\n" "Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=0:0,request-context=%u,max-duration=0\r\n" CLIENTGUID - "Connection: Close\r\n\r\n\r\n\r\n\n\n"; + "Connection: Close\r\n\r\n"; static const char* mmsh_SeekableRequest = "GET %s HTTP/1.0\r\n" @@ -430,8 +430,9 @@ int httpver, httpsub, httpcode; char httpstatus[100]; - if (sscanf(this->buf, "HTTP/%d.%d %d %[^\015\012]", &httpver, &httpsub, - &httpcode, httpstatus) != 4) { + if (sscanf(this->buf, "HTTP/%d.%d %d", &httpver, &httpsub, + &httpcode) != 3) { + printf( "libmmsh: bad response format\n"); return 0; } @@ -724,12 +725,19 @@ printf ("libmmsh: extracting host name \n"); #endif hostend = strchr(_host, '/'); + + /* if ((!hostend) || (strlen(hostend) <= 1)) { printf ("libmmsh: invalid url >%s<, failed to find hostend\n", url); return NULL; } - - *hostend++ = '\0'; + */ + if (!hostend) { + printf ("libmmsh: no trailing /\n"); + hostend = _host + strlen(_host); + } else { + *hostend++ = '\0'; + } /* Is port specified ? */ forport = strchr(_host, ':'); @@ -844,6 +852,7 @@ /* first request */ printf("libmmsh: first http request\n"); + sprintf (this->str, mmsh_FirstRequest, path, host, 1); if (!send_command (this, this->str)) |