From 78c7455fc3c7e0e464134d5d294e6185a0114e56 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Sep 2009 14:29:48 -0700 Subject: http: clarify the setting of the actual header in the hash 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. --- ext/unicorn_http/unicorn_http.rl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ext') 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); } -- cgit v1.2.3-24-ge0c7