[vlc-commits] http: fix parsing of HTTP CONNECT response

Rémi Denis-Courmont git at videolan.org
Sun Dec 13 18:08:30 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Dec 13 19:03:19 2015 +0200| [e8955e0d893499afc6987680f8c91de69a7a756a] | committer: Rémi Denis-Courmont

http: fix parsing of HTTP CONNECT response

The major version must be one, and the error code must be successfully
extracted.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e8955e0d893499afc6987680f8c91de69a7a756a
---

 modules/access/http.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/access/http.c b/modules/access/http.c
index 2212955..3cbe7f2 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -996,7 +996,7 @@ static int Connect( access_t *p_access, uint64_t i_tell )
         if( p_sys->b_proxy )
         {
             char *psz;
-            unsigned i_status = 0;
+            unsigned i_status;
 
             if( p_sys->i_version == 0 )
             {
@@ -1018,7 +1018,8 @@ static int Connect( access_t *p_access, uint64_t i_tell )
                 return -1;
             }
 
-            sscanf( psz, "HTTP/%*u.%*u %3u", &i_status );
+            if( sscanf( psz, "HTTP/1.%*u %3u", &i_status ) != 1 )
+                i_status = 0;
             free( psz );
 
             if( ( i_status / 100 ) != 2 )



More information about the vlc-commits mailing list