mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add HTTPRequest and improvements to HTTPMessage parsing
This commit is contained in:
@@ -44,7 +44,15 @@ std::size_t HTTPParser::process (void const* buf, std::size_t bytes)
|
||||
|
||||
if (m_impl->finished ())
|
||||
{
|
||||
if (m_type == typeResponse)
|
||||
if (m_type == typeRequest)
|
||||
{
|
||||
m_request = new HTTPRequest (
|
||||
m_impl->version (),
|
||||
m_impl->fields (),
|
||||
m_impl->body (),
|
||||
m_impl->method ());
|
||||
}
|
||||
else if (m_type == typeResponse)
|
||||
{
|
||||
m_response = new HTTPResponse (
|
||||
m_impl->version (),
|
||||
@@ -54,7 +62,7 @@ std::size_t HTTPParser::process (void const* buf, std::size_t bytes)
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_request = new HTTPRequest (
|
||||
bassertfalse;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +79,23 @@ bool HTTPParser::finished () const
|
||||
return m_impl->finished();
|
||||
}
|
||||
|
||||
StringPairArray const& HTTPParser::fields () const
|
||||
{
|
||||
return m_impl->fields();
|
||||
}
|
||||
|
||||
bool HTTPParser::headersComplete () const
|
||||
{
|
||||
return m_impl->headers_complete();
|
||||
}
|
||||
|
||||
SharedPtr <HTTPRequest> const& HTTPParser::request ()
|
||||
{
|
||||
bassert (m_type == typeRequest);
|
||||
|
||||
return m_request;
|
||||
}
|
||||
|
||||
SharedPtr <HTTPResponse> const& HTTPParser::response ()
|
||||
{
|
||||
bassert (m_type == typeResponse);
|
||||
|
||||
Reference in New Issue
Block a user