vlc | branch: master | Rui Zhang <[email protected]> | Sun Oct 14 02:02:11 
2012 +0800| [a05aca783e3b2a03f839d2141ee64ee835ebf1cc] | committer: Rémi 
Denis-Courmont

http: trim trailing space in field content

Fix incorrect redirection given in "Location: http://host/path "

Signed-off-by: Rémi Denis-Courmont <[email protected]>

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

 modules/access/http.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/modules/access/http.c b/modules/access/http.c
index cd388cc..fb5319f 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -1381,6 +1381,7 @@ static int Request( access_t *p_access, uint64_t i_tell )
     {
         char *psz = net_Gets( p_access, p_sys->fd, pvs );
         char *p;
+        char *p_trailing;
 
         if( psz == NULL )
         {
@@ -1408,7 +1409,19 @@ static int Request( access_t *p_access, uint64_t i_tell )
             goto error;
         }
         *p++ = '\0';
-        while( *p == ' ' ) p++;
+        p += strspn( p, " \t" );
+
+        /* trim trailing white space */
+        p_trailing = p + strlen( p );
+        if( p_trailing > p )
+        {
+            p_trailing--;
+            while( ( *p_trailing == ' ' || *p_trailing == '\t' ) && p_trailing 
> p )
+            {
+                *p_trailing = '\0';
+                p_trailing--;
+            }
+        }
 
         if( !strcasecmp( psz, "Content-Length" ) )
         {

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to