better standard compliance on missing content-type (matters for ie on my win8 box)

This commit is contained in:
Adam D. Ruppe 2014-06-25 23:12:25 -04:00
parent bf191b2242
commit a7823e8e6a
1 changed files with 5 additions and 2 deletions

7
cgi.d
View File

@ -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; pps.isMultipart = false;
} else if(pps.contentType == "multipart/form-data") { } else if(pps.contentType == "multipart/form-data") {
pps.isMultipart = true; pps.isMultipart = true;
enforce(pps.boundary.length, "no boundary"); enforce(pps.boundary.length, "no boundary");
} else { } else {
// FIXME: should set a http error code too // FIXME: should set a http error code too
throw new Exception("unknown request content type"); throw new Exception("unknown request content type: " ~ pps.contentType);
} }
} }