Changeset 21107

Show
Ignore:
Timestamp:
10/11/08 09:30:26 (8 weeks ago)
Author:
tokuhirom
Message:

fixed request methods handling

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/llv8call/trunk/ext/shttpd/shttpd.cc

    r20753 r21107  
    7878 
    7979FUNCTION_C(_arg_get_var) 
    80     if (args.Length() != 1 && args.Length() != 2) { 
    81         return ThrowException(String::New("Exception: arg.GetVar(name[, buflen])")); 
    82     } 
     80    ARG_BETWEEN(1, 2); 
    8381    EXTERNAL_ARG(); 
    8482    ARG_str(name, 0); 
     
    8684    char *buf = new char [bufsize]; 
    8785 
    88     shttpd_get_var(*name, arg->in.buf, arg->in.len, buf, bufsize); 
     86    if (!strcmp(shttpd_get_env(arg, "REQUEST_METHOD"), "POST")) { 
     87        shttpd_get_var(*name, arg->in.buf, arg->in.len, buf, bufsize); 
     88    } else { 
     89        const char * query_string = shttpd_get_env(arg, "QUERY_STRING"); 
     90        shttpd_get_var(*name, query_string, strlen(query_string), buf, bufsize); 
     91    } 
    8992    Handle<String> ret = String::New(buf); 
    9093    delete [] buf;