From a7823e8e6a52bae5f5517b20fd6224a8dc87b21f Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Wed, 25 Jun 2014 23:12:25 -0400 Subject: [PATCH] better standard compliance on missing content-type (matters for ie on my win8 box) --- cgi.d | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cgi.d b/cgi.d index 9230e61..50d1e83 100644 --- a/cgi.d +++ b/cgi.d @@ -812,14 +812,17 @@ class Cgi { } } - if(pps.contentType == "application/x-www-form-urlencoded") { + // while a content type SHOULD be sent according to the RFC, it is + // not required. We're told we SHOULD guess by looking at the content + // but it seems to me that this only happens when it is urlencoded. + if(pps.contentType == "application/x-www-form-urlencoded" || pps.contentType == "") { pps.isMultipart = false; } else if(pps.contentType == "multipart/form-data") { pps.isMultipart = true; enforce(pps.boundary.length, "no boundary"); } else { // FIXME: should set a http error code too - throw new Exception("unknown request content type"); + throw new Exception("unknown request content type: " ~ pps.contentType); } }