Fixed recognition of multipart-form-data forms.

This commit is contained in:
madmaxoft 2013-09-28 20:06:35 +02:00
parent 8130e6dd54
commit b883a0b514
2 changed files with 3 additions and 2 deletions

View File

@ -34,7 +34,7 @@ cHTTPFormParser::cHTTPFormParser(cHTTPRequest & a_Request) :
m_Kind = fpkFormUrlEncoded; m_Kind = fpkFormUrlEncoded;
return; return;
} }
if (a_Request.GetContentType() == "multipart/form-data") if (strncmp(a_Request.GetContentType().c_str(), "multipart/form-data", 19) == 0)
{ {
m_Kind = fpkMultipart; m_Kind = fpkMultipart;
return; return;
@ -98,7 +98,7 @@ bool cHTTPFormParser::HasFormData(const cHTTPRequest & a_Request)
{ {
return ( return (
(a_Request.GetContentType() == "application/x-www-form-urlencoded") || (a_Request.GetContentType() == "application/x-www-form-urlencoded") ||
(a_Request.GetContentType() == "multipart/form-data") || (strncmp(a_Request.GetContentType().c_str(), "multipart/form-data", 19) == 0) ||
( (
(a_Request.GetMethod() == "GET") && (a_Request.GetMethod() == "GET") &&
(a_Request.GetURL().find('?') != AString::npos) (a_Request.GetURL().find('?') != AString::npos)

View File

@ -69,6 +69,7 @@ class cDebugCallbacks :
Resp.SetContentType("text/plain"); Resp.SetContentType("text/plain");
a_Connection.Send(Resp); a_Connection.Send(Resp);
a_Connection.Send("Form parsing failed"); a_Connection.Send("Form parsing failed");
return;
} }
cHTTPResponse Resp; cHTTPResponse Resp;