[vlc-devel] commit: httpd: full URL is also valid for HTTP (fixes #2320) ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Nov 27 19:38:08 CET 2008


vlc | branch: 0.9-bugfix | Rémi Denis-Courmont <rdenis at simphalempin.com> | Thu Nov 27 20:36:43 2008 +0200| [9d01dfdcfaa7843c9b5a0aeda1583ba52e51bbe8] | committer: Rémi Denis-Courmont 

httpd: full URL is also valid for HTTP (fixes #2320)

Also skip URI authority properly.
(cherry picked from commit a40078c86eac6ad595e26271e9eb636eedccdcd4)

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

 src/network/httpd.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/network/httpd.c b/src/network/httpd.c
index 42226c9..b729ccb 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -1745,12 +1745,16 @@ static void httpd_ClientRecv( httpd_client_t *cl )
                         {
                             *p2++ = '\0';
                         }
-                        if( !strncasecmp( p, "rtsp:", 5 ) )
-                        {
-                            /* for rtsp url, you have rtsp://localhost:port/path */
-                            p += 5;
-                            while( *p == '/' ) p++;
-                            while( *p && *p != '/' ) p++;
+                        if( !strncasecmp( p, ( cl->query.i_proto
+                                   == HTTPD_PROTO_HTTP ) ? "http" : "rtsp", 4 )
+                         && p[4 + !!strchr( "sS", p[4] )] == ':' )
+                        {   /* Skip hier-part of URL (if present) */
+                            p = strchr( p, ':' ) + 1; /* skip URI scheme */
+                            if( !strncmp( p, "//", 2 ) ) /* skip authority */
+                            {   /* see RFC3986 §3.2 */
+                                p += 2;
+                                while( *p && !strchr( "/?#", *p ) ) p++;
+                            }
                         }
                         cl->query.psz_url = strdup( p );
                         if( ( p3 = strchr( cl->query.psz_url, '?' ) )  )




More information about the vlc-devel mailing list