mirror of
https://github.com/inspircd/inspircd.git
synced 2025-04-16 05:00:05 -04:00
Send error 400 when content-size is 0 or omitted for POST
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5246 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
0f66106f8c
commit
3b809f52ad
@ -220,12 +220,19 @@ class HttpSocket : public InspSocket
|
||||
postsize = atoi(header_item.c_str());
|
||||
}
|
||||
}
|
||||
Instance->Log(DEBUG,"%d bytes to read for POST",postsize);
|
||||
std::string::size_type x = headers.str().find("\r\n\r\n");
|
||||
postdata = headers.str().substr(x+5, headers.str().length());
|
||||
/* Get content length and store */
|
||||
if (postdata.length() >= postsize)
|
||||
ServeData();
|
||||
if (!postsize)
|
||||
{
|
||||
SendHeaders(0, 400, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
Instance->Log(DEBUG,"%d bytes to read for POST",postsize);
|
||||
std::string::size_type x = headers.str().find("\r\n\r\n");
|
||||
postdata = headers.str().substr(x+5, headers.str().length());
|
||||
/* Get content length and store */
|
||||
if (postdata.length() >= postsize)
|
||||
ServeData();
|
||||
}
|
||||
}
|
||||
else if (InternalState == HTTP_SERVE_RECV_POSTDATA)
|
||||
{
|
||||
@ -233,9 +240,7 @@ class HttpSocket : public InspSocket
|
||||
amount += strlen(data);
|
||||
postdata.append(data);
|
||||
if (amount >= postsize)
|
||||
{
|
||||
ServeData();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user