Show
Ignore:
Timestamp:
01/08/10 20:04:49 (8 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1262981089 +0000
git-parent:

[57156325b280cf0021706459de269ef44b89d8cc]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1262981089 +0000
Message:

this will break realtime streaming.... need to fix the javascript in the web ui now, refs #229

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_http.c

    r4790fc8 rd9050a4  
    5151static const char _hexchars[16] = 
    5252  {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; 
     53static void inplace_urldecode(char *c) { 
     54  char *o = c; 
     55  while(*c) { 
     56    if(*c == '%') { 
     57      int i, ord = 0; 
     58      for(i = 0; i < 2; i++) { 
     59        if(c[i] >= '0' && c[i] <= '9') ord = (ord << 4) | (c[i] - '0'); 
     60        else if (c[i] >= 'a' && c[i] <= 'f') ord = (ord << 4) | (c[i] - 'a'); 
     61        else if (c[i] >= 'A' && c[i] <= 'F') ord = (ord << 4) | (c[i] - 'A'); 
     62        else break; 
     63      } 
     64      if(i==2) { 
     65        *((unsigned char *)o++) = ord; 
     66        c+=3; 
     67        continue; 
     68      } 
     69    } 
     70    *o++ = *c++; 
     71  } 
     72  *o = '\0'; 
     73} 
    5374 
    5475struct bchain *bchain_alloc(size_t size) { 
     
    390411  return noit_true; 
    391412} 
     413void 
     414noit_http_process_querystring(noit_http_request *req) { 
     415  char *cp, *copy, *interest, *brk; 
     416  cp = strchr(req->uri_str, '?'); 
     417  if(!cp) return; 
     418  *cp++ = '\0'; 
     419  for (interest = strtok_r(cp, "&", &brk); 
     420       interest; 
     421       interest = strtok_r(NULL, "&", &brk)) { 
     422    char *eq; 
     423    eq = strchr(interest, '='); 
     424    if(!eq) { 
     425      inplace_urldecode(interest); 
     426      noit_hash_store(&req->querystring, interest, strlen(interest), NULL); 
     427    } 
     428    else { 
     429      *eq++ = '\0'; 
     430      inplace_urldecode(interest); 
     431      inplace_urldecode(eq); 
     432      noit_hash_store(&req->querystring, interest, strlen(interest), eq); 
     433    } 
     434  } 
     435} 
    392436static noit_boolean 
    393437noit_http_request_finalize_payload(noit_http_request *req, noit_boolean *err) { 
     
    480524void 
    481525noit_http_request_release(noit_http_session_ctx *ctx) { 
     526  noit_hash_destroy(&ctx->req.querystring, NULL, NULL); 
    482527  noit_hash_destroy(&ctx->req.headers, NULL, NULL); 
    483528  /* If we expected a payload, we expect a trailing \r\n */