Skip to content
Permalink
Browse files

http: Fix spin with unhandled POST

  • Loading branch information...
sconemad committed Aug 16, 2019
1 parent 6b932d7 commit a4ca4c03a699645427805c92b220fdc5ad4f8ba1
Showing with 7 additions and 5 deletions.
  1. +6 −4 http/ResponseStream.cpp
  2. +1 −1 http/ResponseStream.h
@@ -100,8 +100,7 @@ class MimeHeaderStream : public scx::LineBuffer {
if (line.empty()) {
m_done = true;
enable_event(scx::Stream::Readable,false);
m_resp.mimeheader_end();
return scx::Ok;
return m_resp.mimeheader_end();
} else {
m_resp.mimeheader_line(line);
}
@@ -585,15 +584,15 @@ void ResponseStream::mimeheader_line(const std::string& line)
}

//=========================================================================
void ResponseStream::mimeheader_end()
scx::Condition ResponseStream::mimeheader_end()
{
if (m_resp_seq == resp_ReadMultiHeader) {
RESPONSE_DEBUG_LOG("mimeheader_end");

std::string name;
scx::MimeHeader disp = m_section_headers.get_parsed("Content-Disposition");
const scx::MimeHeaderValue* fdata = disp.get_value("form-data");
if (!fdata) return; // scx::Close;
if (!fdata) return scx::Close;
fdata->get_parameter("name",name);

m_resp_seq = resp_ReadMultiBody;
@@ -609,6 +608,9 @@ void ResponseStream::mimeheader_end()
}

if (!handled) {
STREAM_DEBUG_LOG("Unhandled POST data, closing");
return scx::Close;

// Unhandled - transfer to a null file to discard the data
STREAM_DEBUG_LOG("Using NULL file to discard data");
scx::NullFile* file = new scx::NullFile();
@@ -103,7 +103,7 @@ class HTTP_API ResponseStream : public scx::Stream {
friend class MimeHeaderStream;

void mimeheader_line(const std::string& line);
void mimeheader_end();
scx::Condition mimeheader_end();

ResponseSequence m_resp_seq;

0 comments on commit a4ca4c0

Please sign in to comment.
You can’t perform that action at this time.