Roxen.git / server / protocols / http.pike

version» Context lines:

Roxen.git/server/protocols/http.pike:1:   // This is a roxen protocol module.   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2009, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.611 2009/06/24 11:38:00 mast Exp $"; + constant cvs_version = "$Id$";   // #define REQUEST_DEBUG   #define MAGIC_ERROR      #define REQUESTID this      #ifdef MAGIC_ERROR   inherit "highlight_pike";   #endif      // HTTP protocol module.
Roxen.git/server/protocols/http.pike:718:    string chunk_extras;    int n = sscanf(buf, "%" + chunk_offset + "*s%x%s\r\n%n",    misc->chunk_len, chunk_extras,    chunk_data_offset);    if (n < 4) {    misc->chunk_buf = buf[chunk_offset..];    misc->chunk_len = 0;    return 0; // More data needed to parse the chunk length.    }    +  misc->len += misc->chunk_len; +    #ifdef CONNECTION_DEBUG    werror("HTTP[%s]: Got chunk with %d bytes of data.\n",    DEBUG_GET_FD, misc->chunk_len);   #endif       // FIXME: Currently we ignore the chunk_extras.       if (sizeof(buf) < chunk_data_offset + misc->chunk_len) {    if (!data_buffer) {    // The 16384 is some reasonable extra padding to
Roxen.git/server/protocols/http.pike:970:       TIMER_START(parse_got_2_parse_headers);    foreach (request_headers; string linename; array|string contents)    {    if( arrayp(contents) ) contents = contents[0];    switch (linename)    {    case "cache-control": // Opera sends "no-cache" here.    case "pragma": pragma|=(multiset)((contents-" ")/","); break;    -  case "content-length": misc->len = (int)contents; break; +  case "content-length": +  if (misc->chunked) break; +  misc->len = (int)contents; +  break;    case "transfer-encoding":    misc->transfer_encoding =    map(lower_case(contents)/";", String.trim_all_whites);    if (has_value(misc->transfer_encoding, "chunked")) { -  +  misc->len = 0;    misc->chunked = 1;    misc->chunk_buf = "";    new_data = data || ""; // For got_chunk_fragment() below.    }    break;    case "authorization": rawauth = contents; break;    case "referer": referer = ({contents}); break;    case "if-modified-since": since=contents; break;    case "if-match": break; // Not supported yet.    case "if-none-match":