httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: svn commit: r723627 - in /httpd/httpd/branches/wombat-integration: include/util_script.h server/util_script.c
Date Sat, 06 Dec 2008 08:46:26 GMT


On 12/05/2008 08:15 AM, pquerna@apache.org wrote:
> Author: pquerna
> Date: Thu Dec  4 23:15:22 2008
> New Revision: 723627
> 
> URL: http://svn.apache.org/viewvc?rev=723627&view=rev
> Log:
> Add new api, ap_args_to_table, to parse a request's arguments into a table.
> 
> Modified:
>     httpd/httpd/branches/wombat-integration/include/util_script.h
>     httpd/httpd/branches/wombat-integration/server/util_script.c
> 
> Modified: httpd/httpd/branches/wombat-integration/include/util_script.h
> URL: http://svn.apache.org/viewvc/httpd/httpd/branches/wombat-integration/include/util_script.h?rev=723627&r1=723626&r2=723627&view=diff
> ==============================================================================
> --- httpd/httpd/branches/wombat-integration/include/util_script.h (original)
> +++ httpd/httpd/branches/wombat-integration/include/util_script.h Thu Dec  4 23:15:22
2008
> @@ -140,6 +140,8 @@
>  				       int (*getsfunc) (char *, int, void *),
>  				       void *getsfunc_data);
>  
> +AP_DECLARE(void) ap_args_to_table(request_rec *r, apr_table_t **table);
> +

Hm. This requires a minor bump.

>  #ifdef __cplusplus
>  }
>  #endif
> 
> Modified: httpd/httpd/branches/wombat-integration/server/util_script.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/branches/wombat-integration/server/util_script.c?rev=723627&r1=723626&r2=723627&view=diff
> ==============================================================================
> --- httpd/httpd/branches/wombat-integration/server/util_script.c (original)
> +++ httpd/httpd/branches/wombat-integration/server/util_script.c Thu Dec  4 23:15:22
2008
> @@ -721,3 +721,41 @@
>      va_end(strs.args);
>      return res;
>  }
> +
> +
> +static void
> +argstr_to_table(apr_pool_t *p, char *str, apr_table_t *parms)
> +{
> +    char *key;
> +    char *value;
> +    char *strtok_state;
> +    

Hm, we should make a copy of str before changing it in the while lopp
below.

> +    key = apr_strtok(str, "&", &strtok_state);
> +    while (key) {
> +        value = strchr(key, '=');
> +        if (value) {
> +            *value = '\0';      /* Split the string in two */
> +            value++;            /* Skip passed the = */
> +        }
> +        else {
> +            value = "1";
> +        }
> +        ap_unescape_url(key);
> +        ap_unescape_url(value);
> +        apr_table_set(parms, key, value);
> +        /*
> +         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,

r is no parameter for this function.

> +         "Found query arg: %s = %s", key, value);
> +         */
> +        key = apr_strtok(NULL, "&", &strtok_state);
> +    }
> +}
> +
> +AP_DECLARE(void) ap_args_to_table(request_rec *r, apr_table_t **table)
> +{
> +    apr_table_t *t = apr_table_make(r->pool, 10);
> +    argstr_to_table(r->pool, r->args, t);
> +    *table = t;
> +}
> +
> +
> 
> 
> 

Mime
View raw message