about summary refs log tree commit homepage
path: root/ext/http11/http11.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/http11/http11.c')
-rw-r--r--ext/http11/http11.c14
1 files changed, 12 insertions, 2 deletions
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