Branch: Tag:

2001-11-14

2001-11-14 10:28:36 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Comply with RFC 2068 5.1.2.
Fixes [bug 2058 (#2058)].

Rev: server/protocols/http.pike:1.346

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2001, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.345 2001/11/07 09:53:07 grubba Exp $"; + constant cvs_version = "$Id: http.pike,v 1.346 2001/11/14 10:28:36 grubba Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR   
2038:    {    // FIXME: port_obj->name & port_obj->default_port are constant    // consider caching them? +  +  // RFC 2068 5.1.2: +  // +  // To allow for transition to absoluteURIs in all requests in future +  // versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI +  // form in requests, even though HTTP/1.1 clients will only generate +  // them in requests to proxies. +  if (has_prefix(raw_url, port_obj->name+"://") && +  (conf = port_obj->find_configuration_for_url(raw_url, +  this_object(), 1))) { +  sscanf(raw_url[sizeof(port_obj->name+"://")..], +  "%[^/]%s", misc->host, raw_url); +  } else { +  if (misc->host) {    conf =    port_obj->find_configuration_for_url(port_obj->name + "://" + -  (misc->host||"*") + -  (search(misc->host||"", ":")<0? +  misc->host + +  (search(misc->host, ":")<0?    (":"+port_obj->port):"") +    raw_url,    this_object()); -  +  } else { +  conf = +  port_obj->find_configuration_for_url(port_obj->name + +  "://*:" + port_obj->port + +  raw_url, +  this_object());    } -  +  } +  }    else if( strlen(path) )    adjust_for_config_path( path );