Roxen.git / server / protocols / http.pike

version» Context lines:

Roxen.git/server/protocols/http.pike:584:    if (mixed err = catch {    f = Roxen.get_decoder_for_client_charset (input_charset) (f);    })    report_debug ("Client %O requested path %O which failed to decode "    "with the input charset %O: %s",    client_var->fullname, f, input_charset,    describe_error (err));    }    else    catch (f = utf8_to_string (f)); +  } +     if (String.width(f) > 8) {    // Wide, so it might contain combiners.    // Combine them if they are there.    f = Unicode.normalize(f, "NFC");    } -  } +        // Now after charset decode we can add the multipart/form-data    // variables in case they were rfc 2388 correct.    if (mapping(string:array(string)) ppv =    m_delete (misc, "proper_post_vars")) {    misc->post_variables = ppv;    foreach (ppv; string var; array(string) val) {    if (array(string) oldval = real_variables[var])    // Ensure POST variables come first, for consistency.    real_variables[var] = val + oldval;
Roxen.git/server/protocols/http.pike:1039:    }    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":    none_match = (multiset)((contents-" ")/",");    break;    +  case "if": + #ifdef IF_HEADER_DEBUG +  werror("IF: Raw header: %O\n", contents); + #endif +  if (!has_prefix(String.trim_all_whites(contents), "<")) { +  // Prefix with the base resource id to make the header +  // idempotent with respect to subrequests. +  contents = +  sprintf("<%s> %s", +  replace(raw_url, ({ " ", ">" }), ({ "%20", "%3e" })), +  contents); +  request_headers->if = contents; + #ifdef IF_HEADER_DEBUG +  werror("IF: Adjusted header: %O\n", contents); + #endif +  } +  break; +     case "proxy-authorization":    array y;    y = contents / " ";    if(sizeof(y) < 2)    break;    y[1] = decode(y[1]);    misc->proxyauth=y;    break;       case "user-agent":
Roxen.git/server/protocols/http.pike:1098:    // the field directly in request_headers instead if the    // lowercasing messed things up.    misc[linename] = contents;   #define WS "%*[ \t]"    sscanf (contents, WS"%[^ \t/]"WS"/"WS"%[^ \t;]"WS";"WS"%s",    string ct_type, string ct_subtype,    misc->content_type_params);    misc->content_type_type = lower_case (ct_type + "/" + ct_subtype);    break;    case "destination": +  MY_TRACE_ENTER(sprintf("Destination header: %O", contents));    // FIXME: This silently strips away the server if the    // destination is an absolute URI, and it can be a different    // one according to RFC 4918, section 10.3. If we cannot use    // it as destination (which is probably the case), then the    // request MUST NOT succeed.    if (mixed err = catch {    contents = http_decode_string (Standards.URI(contents,    "dummy:")->path);    }) {   #ifdef DEBUG    report_debug(sprintf("Destination header contained a bad URI: %O\n"    "%s", contents, describe_error(err)));   #endif /* DEBUG */    } -  +  catch { contents = utf8_to_string(contents); };    misc["new-uri"] = VFS.normalize_path (contents);    if (String.width(misc["new-uri"]) > 8) {    misc["new-uri"] = Unicode.normalize(misc["new-uri"], "NFC");    } -  +  MY_TRACE_LEAVE(sprintf("misc[\"new-uri\"] = %O", misc["new-uri"]));    break;       case "expect":    // RFC 2616, section 14.20: "A server that does not    // understand or is unable to comply with any of the    // expectation values in the Expect field of a request MUST    // respond with appropriate error status." We only handle the    // standard 100-continue case (see ready_to_receive).    // Also: "Comparison of expectation values is case-insensitive    // for unquoted tokens (including the 100-continue token), and
Roxen.git/server/protocols/http.pike:2742:       // The full header block (prot + " " + code + head_string + variant_string).    string full_headers="";      #if 0    REQUEST_WERR(sprintf("HTTP: Sending result for prot:%O, method:%O, file:%O",    prot, method, file));   #endif    if(!file->raw && (prot != "HTTP/0.9"))    { -  if (!sizeof (file) && multi_status) +  if ((sizeof(file) <= 1) && multi_status) { +  // NB: Configuration::examine_return_mapping() adds an +  // empty extra_heads entry to the mapping. +  if ((sizeof(file) != 1) || file->extra_heads) {    file = multi_status->http_answer(); -  +  } +  }       if (file->error == Protocols.HTTP.HTTP_NO_CONTENT) {    file->len = 0;    file->data = "";    }       string head_status = file->rettext;    if (head_status) {    if (!file->file && !file->data &&    (!file->type || file->type == "text/html")) {