From 5d600bfd240a09df159b83460b81626f71ce5029 Mon Sep 17 00:00:00 2001 From: zedshaw Date: Mon, 3 Apr 2006 15:22:17 +0000 Subject: Minor tweaks to the handlers and http parser to deal with more bad input possibilities. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@139 19e92222-5c0b-0410-8929-a290d50e31e9 --- ext/http11/http11.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/http11/http11.c b/ext/http11/http11.c index d89f0d4..55ecc0f 100644 --- a/ext/http11/http11.c +++ b/ext/http11/http11.c @@ -124,10 +124,20 @@ void header_done(void *data, const char *at, size_t length) VALUE temp = Qnil; VALUE host = Qnil; VALUE port = Qnil; + VALUE ctype = Qnil; + VALUE clen = Qnil; char *colon = NULL; - rb_hash_aset(req, global_content_length, rb_hash_aref(req, global_http_content_length)); - rb_hash_aset(req, global_content_type, rb_hash_aref(req, global_http_content_type)); + clen = rb_hash_aref(req, global_http_content_length); + if(clen != Qnil) { + rb_hash_aset(req, global_content_length, clen); + } + + ctype = rb_hash_aref(req, global_http_content_type); + if(ctype != Qnil) { + rb_hash_aset(req, global_content_type, Qnil); + } + rb_hash_aset(req, global_gateway_interface, global_gateway_interface_value); if((temp = rb_hash_aref(req, global_http_host)) != Qnil) { // ruby better close strings off with a '\0' dammit -- cgit v1.2.3-24-ge0c7