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 );
{
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" ) )
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. */