]> git.sesse.net Git - vlc/commitdiff
Allow URL parameter of arbitrary size (closes #1125)
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 25 Mar 2007 19:35:14 +0000 (19:35 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 25 Mar 2007 19:35:14 +0000 (19:35 +0000)
modules/control/http/http.h
modules/control/http/rpn.c
modules/control/http/util.c

index e935e2c95299dec82f43c0f2e90c4e2ee1a6d8ab..34a91283310d3e461bdb1914f0fb40d8c4c87f38 100644 (file)
@@ -128,6 +128,8 @@ void E_(HandleSeek)( intf_thread_t *p_intf, char *p_value );
 char *E_(ExtractURIValue)( char *restrict psz_uri,
                            const char *restrict psz_name,
                            char *restrict psz_value, size_t i_value_max );
+char *E_(ExtractURIString)( char *restrict psz_uri,
+                            const char *restrict psz_name );
 /** \todo Describe this function */
 int E_(TestURIParam)( char *psz_uri, const char *psz_name );
 
index a9b495454f07b40d3f29b7cf58259e8f1918b688..d8ec6d33c279a7e18ca0fe1e38b241f42a57893a 100644 (file)
@@ -349,14 +349,19 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t  *vars,
         {
             char *url = E_(mvar_GetValue)( vars, "url_value" );
             char *name = E_(SSPop)( st );
-            char value[2048];
-            char *tmp;
+            char *value = E_(ExtractURIString)( url, name );
+            if( value != NULL )
+            {
+                char *tmp;
+                decode_URI( value );
+                tmp = E_(FromUTF8)( p_intf, value );
+                E_(SSPush)( st, tmp );
+                free( tmp );
+                free( value );
+            }
+            else
+                E_(SSPush)( st, "" );
 
-            E_(ExtractURIValue)( url, name, value, 2048 );
-            decode_URI( value );
-            tmp = E_(FromUTF8)( p_intf, value );
-            E_(SSPush)( st, tmp );
-            free( tmp );
             free( name );
         }
         else if( !strcmp( s, "url_encode" ) )
index 69d85549c9ea381c3e2a340cc3ea4e677c00f19c..5bf517e5e7b4682c9a45fd6df193e63cfce8d078 100644 (file)
@@ -793,6 +793,25 @@ char *E_(ExtractURIValue)( char *restrict psz_uri,
     return psz_next;
 }
 
+char *E_(ExtractURIString)( char *restrict psz_uri,
+                            const char *restrict psz_name )
+{
+    size_t len;
+    char *psz_value = FindURIValue( psz_uri, psz_name, &len );
+
+    if( psz_value == NULL )
+        return NULL;
+
+    char *res = malloc( len + 1 );
+    if( res == NULL )
+        return NULL;
+
+    memcpy( res, psz_value, len );
+    res[len] = '\0';
+
+    return res;
+}
+
 /* Since the resulting string is smaller we can work in place, so it is
  * permitted to have psz == new. new points to the first word of the
  * string, the function returns the remaining string. */