about summary refs log tree commit homepage
path: root/ext
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-09-06 14:29:48 -0700
committerEric Wong <normalperson@yhbt.net>2009-09-06 14:31:25 -0700
commit78c7455fc3c7e0e464134d5d294e6185a0114e56 (patch)
tree9f56986b5ffebfb8f8fa92d6cecd6f67557f0556 /ext
parentbace4364e8a7d0ac261e407732b9354d2f017045 (diff)
downloadunicorn-78c7455fc3c7e0e464134d5d294e6185a0114e56.tar.gz
Avoid a negative conditional in the process and having an
explicit else in there makes this piece easier to track.

Also explain /why/ the Host: header can get ignored.
Diffstat (limited to 'ext')
-rw-r--r--ext/unicorn_http/unicorn_http.rl8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl
index 063b326..9aa0037 100644
--- a/ext/unicorn_http/unicorn_http.rl
+++ b/ext/unicorn_http/unicorn_http.rl
@@ -156,8 +156,12 @@ static void write_value(VALUE req, struct http_parser *hp,
   e = rb_hash_aref(req, f);
   if (e == Qnil) {
     hp->cont = rb_hash_aset(req, f, v);
-  } else if (f != g_http_host) {
-    /* full URLs in REQUEST_URI take precedence for the Host: header */
+  } else if (f == g_http_host) {
+    /*
+     * ignored, absolute URLs in REQUEST_URI take precedence over
+     * the Host: header (ref: rfc 2616, section 5.2.1)
+     */
+  } else {
     rb_str_buf_cat(e, ",", 1);
     hp->cont = rb_str_buf_append(e, v);
   }