Commit 83d95532 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Allow URL parameter of arbitrary size (closes #1125)

parent 331e3216
......@@ -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 );
......
......@@ -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" ) )
......
......@@ -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. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment