diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-14 11:42:03 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-14 11:42:03 +0000 |
commit | 3b809f52adcdfc041d9fb1e6eb813af4ee082122 (patch) | |
tree | bf94e26c900e72206176afe671332765ad59f878 | |
parent | 0f66106f8c6581ff47249b5ea9dde4157a395263 (diff) |
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
-rw-r--r-- | src/modules/m_httpd.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index e7b100b05..8c4bedbd1 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -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 { |