about summary refs log tree commit homepage
path: root/ext
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-02-19 14:40:37 -0800
committerEric Wong <normalperson@yhbt.net>2009-02-20 00:00:28 -0800
commit2ff0f8ae66623424dd64b865e7415dd007ade280 (patch)
tree53f19e4571323dba9ad3094de0fd408d750ef860 /ext
parentf32cac1cc89aed460fae99689ae7e5dd806f7682 (diff)
downloadunicorn-2ff0f8ae66623424dd64b865e7415dd007ade280.tar.gz
The Rack spec requires it.  So we'll just set it to "localhost"
if we're dealing with HTTP/1.0 clients that omit the "Host:"
header.
Diffstat (limited to 'ext')
-rw-r--r--ext/http11/http11.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/http11/http11.c b/ext/http11/http11.c
index ee5704b..82982e7 100644
--- a/ext/http11/http11.c
+++ b/ext/http11/http11.c
@@ -42,6 +42,7 @@ static VALUE global_server_protocol;
 static VALUE global_server_protocol_value;
 static VALUE global_http_host;
 static VALUE global_port_80;
+static VALUE global_localhost;
 
 #define TRIE_INCREASE 30
 
@@ -302,6 +303,9 @@ void header_done(void *data, const char *at, size_t length)
       rb_hash_aset(req, global_server_name, temp);
       rb_hash_aset(req, global_server_port, global_port_80);
     }
+  } else {
+    rb_hash_aset(req, global_server_name, global_localhost);
+    rb_hash_aset(req, global_server_port, global_port_80);
   }
 
   /* grab the initial body and stuff it into the hash */
@@ -507,6 +511,7 @@ void Init_http11()
   DEF_GLOBAL(server_protocol_value, "HTTP/1.1");
   DEF_GLOBAL(http_host, "HTTP_HOST");
   DEF_GLOBAL(port_80, "80");
+  DEF_GLOBAL(localhost, "localhost");
 
   eHttpParserError = rb_define_class_under(mUnicorn, "HttpParserError", rb_eIOError);