lib/http.c
apr_table_t *mapcache_http_parse_param_string(mapcache_context *r, char *args_str)
{
  apr_table_t *params;
  char *args = apr_pstrdup(r->pool,args_str);
  char *key;
  char *value;
  const char *delim = "&";
  char *last;
  if (args == NULL) {
    return apr_table_make(r->pool,0);
  }
  params = apr_table_make(r->pool,20);
  /* Split the input on '&' */
  for (key = apr_strtok(args, delim, &last); key != NULL;
       key = apr_strtok(NULL, delim, &last)) {
    /* key is a pointer to the key=value string */
    /*loop through key=value string to replace '+' by ' ' */
    for (value = key; *value; ++value) {
      if (*value == '+') {
        *value = ' ';
      }
    }

    /* split into Key / Value and unescape it */
    value = strchr(key, '=');
    if (value) {
      *value++ = '\0'; /* replace '=' by \0, thus terminating the key string */
      _mapcache_unescape_url(key);
      _mapcache_unescape_url(value);
    } else {
      value = "";
      _mapcache_unescape_url(key);
    }
    /* Store key/value pair in our form hash. */
    apr_table_addn(params, key, value);
  }
  return params;
}
/* Parse form data from a string. The input string is preserved. */
Parse form data from a string. The input string is preserved.
Parse form data from a string . The input string is preserved .
apr_table_t *mapcache_http_parse_param_string(mapcache_context *r, char *args_str)
{
  apr_table_t *params;
  char *args = apr_pstrdup(r->pool,args_str);
  char *key;
  char *value;
  const char *delim = "&";
  char *last;
  if (args == NULL) {
    return apr_table_make(r->pool,0);
  }
  params = apr_table_make(r->pool,20);
  for (key = apr_strtok(args, delim, &last); key != NULL;
       key = apr_strtok(NULL, delim, &last)) {
    for (value = key; *value; ++value) {
      if (*value == '+') {
        *value = ' ';
      }
    }
    value = strchr(key, '=');
    if (value) {
      *value++ = '\0'; 
      _mapcache_unescape_url(key);
      _mapcache_unescape_url(value);
    } else {
      value = "";
      _mapcache_unescape_url(key);
    }
    apr_table_addn(params, key, value);
  }
  return params;
}
apr_table_t * mapcache_http_parse_param_string ( mapcache_context * r , char * args_str ) { apr_table_t * params ; char * args = apr_pstrdup ( r -> pool , args_str ) ; char * key ; char * value ; const char * delim = " " ; char * last ; if ( args == NULL ) { return apr_table_make ( r -> pool , 0 ) ; } params = apr_table_make ( r -> pool , 20 ) ; for ( key = apr_strtok ( args , delim , & last ) ; key != NULL ; key = apr_strtok ( NULL , delim , & last ) ) { for ( value = key ; * value ; ++ value ) { if ( * value == ' ' ) { * value = ' ' ; } } value = strchr ( key , ' ' ) ; if ( value ) { * value ++ = ' \0 ' ; _mapcache_unescape_url ( key ) ; _mapcache_unescape_url ( value ) ; } else { value = " " ; _mapcache_unescape_url ( key ) ; } apr_table_addn ( params , key , value ) ; } return params ; }
Parse form data from a string.
Parse form data from a string .
/* Split the input on '&' */ /* key is a pointer to the key=value string */ /*loop through key=value string to replace '+' by ' ' */ /* split into Key / Value and unescape it */ /* replace '=' by \0, thus terminating the key string */ /* Store key/value pair in our form hash. */