mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add Request and Response HTTP parsers
This commit is contained in:
@@ -189,7 +189,9 @@
|
||||
<ClInclude Include="..\..\modules\beast_asio\http\HTTPParserImpl.h" />
|
||||
<ClInclude Include="..\..\modules\beast_asio\http\HTTPParser.h" />
|
||||
<ClInclude Include="..\..\modules\beast_asio\http\HTTPRequest.h" />
|
||||
<ClInclude Include="..\..\modules\beast_asio\http\HTTPRequestParser.h" />
|
||||
<ClInclude Include="..\..\modules\beast_asio\http\HTTPResponse.h" />
|
||||
<ClInclude Include="..\..\modules\beast_asio\http\HTTPResponseParser.h" />
|
||||
<ClInclude Include="..\..\modules\beast_asio\http\HTTPVersion.h" />
|
||||
<ClInclude Include="..\..\modules\beast_asio\protocol\HandshakeDetectLogic.h" />
|
||||
<ClInclude Include="..\..\modules\beast_asio\protocol\HandshakeDetectLogicPROXY.h" />
|
||||
@@ -564,12 +566,24 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\beast_asio\http\HTTPRequestParser.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\beast_asio\http\HTTPResponse.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\beast_asio\http\HTTPResponseParser.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\beast_asio\http\HTTPVersion.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
|
||||
@@ -1215,6 +1215,12 @@
|
||||
<ClInclude Include="..\..\beast\net\BufferType.h">
|
||||
<Filter>beast\net</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\beast_asio\http\HTTPRequestParser.h">
|
||||
<Filter>beast_asio\http</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\beast_asio\http\HTTPResponseParser.h">
|
||||
<Filter>beast_asio\http</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\modules\beast_core\containers\AbstractFifo.cpp">
|
||||
@@ -1748,6 +1754,12 @@
|
||||
<ClCompile Include="..\..\beast\net\impl\DynamicBuffer.cpp">
|
||||
<Filter>beast\net\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\beast_asio\http\HTTPRequestParser.cpp">
|
||||
<Filter>beast_asio\http</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\beast_asio\http\HTTPResponseParser.cpp">
|
||||
<Filter>beast_asio\http</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\..\TODO.txt">
|
||||
|
||||
@@ -61,3 +61,5 @@ namespace beast {
|
||||
}
|
||||
|
||||
#include "http/HTTPParser.cpp"
|
||||
#include "http/HTTPRequestParser.cpp"
|
||||
#include "http/HTTPResponseParser.cpp"
|
||||
|
||||
@@ -91,6 +91,8 @@ namespace beast {
|
||||
}
|
||||
|
||||
# include "http/HTTPParser.h"
|
||||
#include "http/HTTPRequestParser.h"
|
||||
#include "http/HTTPResponseParser.h"
|
||||
|
||||
#include "http/HTTPClientType.h"
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ public:
|
||||
URL m_url;
|
||||
boost::asio::ssl::context m_context;
|
||||
MemoryBlock m_buffer;
|
||||
HTTPParser m_parser;
|
||||
HTTPResponseParser m_parser;
|
||||
std::size_t m_messageLimitBytes;
|
||||
std::size_t m_bytesReceived;
|
||||
|
||||
@@ -218,7 +218,6 @@ public:
|
||||
, m_url (url)
|
||||
, m_context (boost::asio::ssl::context::sslv23)
|
||||
, m_buffer (bufferSize)
|
||||
, m_parser (HTTPParser::typeResponse)
|
||||
, m_messageLimitBytes (messageLimitBytes)
|
||||
, m_bytesReceived (0)
|
||||
{
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
*/
|
||||
SharedPtr <HTTPResponse> const& response ();
|
||||
|
||||
private:
|
||||
protected:
|
||||
Type m_type;
|
||||
ScopedPointer <HTTPParserImpl> m_impl;
|
||||
SharedPtr <HTTPRequest> m_request;
|
||||
|
||||
38
modules/beast_asio/http/HTTPRequestParser.cpp
Normal file
38
modules/beast_asio/http/HTTPRequestParser.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
//#include "HTTPRequestParser.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
HTTPRequestParser::HTTPRequestParser ()
|
||||
: HTTPParser (typeRequest)
|
||||
{
|
||||
}
|
||||
|
||||
HTTPRequestParser::~HTTPRequestParser ()
|
||||
{
|
||||
}
|
||||
|
||||
SharedPtr <HTTPRequest> const& HTTPRequestParser::request ()
|
||||
{
|
||||
return m_request;
|
||||
}
|
||||
|
||||
}
|
||||
46
modules/beast_asio/http/HTTPRequestParser.h
Normal file
46
modules/beast_asio/http/HTTPRequestParser.h
Normal file
@@ -0,0 +1,46 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_HTTP_REQUESTPARSER_H_INCLUDED
|
||||
#define BEAST_HTTP_REQUESTPARSER_H_INCLUDED
|
||||
|
||||
#include "HTTPParser.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
/** A parser for HTTPRequest objects. */
|
||||
class HTTPRequestParser : public HTTPParser
|
||||
{
|
||||
public:
|
||||
/** Construct a new parser for the specified HTTPMessage type. */
|
||||
HTTPRequestParser ();
|
||||
|
||||
/** Destroy the parser. */
|
||||
~HTTPRequestParser ();
|
||||
|
||||
/** Return the HTTPRequest object produced from the parsing. */
|
||||
SharedPtr <HTTPRequest> const& request ();
|
||||
|
||||
private:
|
||||
//SharedPtr <HTTPRequest> m_request;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
38
modules/beast_asio/http/HTTPResponseParser.cpp
Normal file
38
modules/beast_asio/http/HTTPResponseParser.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
//#include "HTTPResponseParser.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
HTTPResponseParser::HTTPResponseParser ()
|
||||
: HTTPParser (typeResponse)
|
||||
{
|
||||
}
|
||||
|
||||
HTTPResponseParser::~HTTPResponseParser ()
|
||||
{
|
||||
}
|
||||
|
||||
SharedPtr <HTTPResponse> const& HTTPResponseParser::response ()
|
||||
{
|
||||
return m_response;
|
||||
}
|
||||
|
||||
}
|
||||
46
modules/beast_asio/http/HTTPResponseParser.h
Normal file
46
modules/beast_asio/http/HTTPResponseParser.h
Normal file
@@ -0,0 +1,46 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_HTTP_RESPONSEPARSER_H_INCLUDED
|
||||
#define BEAST_HTTP_RESPONSEPARSER_H_INCLUDED
|
||||
|
||||
#include "HTTPParser.h"
|
||||
|
||||
namespace beast {
|
||||
|
||||
/** A parser for HTTPResponse objects. */
|
||||
class HTTPResponseParser : public HTTPParser
|
||||
{
|
||||
public:
|
||||
/** Construct a new parser for the specified HTTPMessage type. */
|
||||
HTTPResponseParser ();
|
||||
|
||||
/** Destroy the parser. */
|
||||
~HTTPResponseParser ();
|
||||
|
||||
/** Return the HTTPResponse object produced from the parsing. */
|
||||
SharedPtr <HTTPResponse> const& response ();
|
||||
|
||||
private:
|
||||
//SharedPtr <HTTPResponse> m_response;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user