Added AbstractHandler, WrapHandler. HTTPClient Fixes.

This commit is contained in:
Vinnie Falco
2013-09-25 11:24:51 -07:00
parent 94e40dc554
commit 9c61a6df62
10 changed files with 1432 additions and 685 deletions

View File

@@ -144,8 +144,10 @@
<ClInclude Include="..\..\beast\utility\EnableIf.h" />
<ClInclude Include="..\..\beast\utility\Journal.h" />
<ClInclude Include="..\..\beast\Version.h" />
<ClInclude Include="..\..\modules\beast_asio\async\AbstractHandler.h" />
<ClInclude Include="..\..\modules\beast_asio\async\AsyncObject.h" />
<ClInclude Include="..\..\modules\beast_asio\async\ComposedAsyncOperation.h" />
<ClInclude Include="..\..\modules\beast_asio\async\WrapHandler.h" />
<ClInclude Include="..\..\modules\beast_asio\async\SharedHandler.h" />
<ClInclude Include="..\..\modules\beast_asio\async\SharedHandlerAllocator.h" />
<ClInclude Include="..\..\modules\beast_asio\async\SharedHandlerPtr.h" />

View File

@@ -38,40 +38,40 @@
<Filter>_meta</Filter>
</None>
<None Include="..\..\beast\http\impl\http-parser\.gitignore">
<Filter>beast\http\impl\http-parser</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser</Filter>
</None>
<None Include="..\..\beast\http\impl\http-parser\.mailmap">
<Filter>beast\http\impl\http-parser</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser</Filter>
</None>
<None Include="..\..\beast\http\impl\http-parser\.travis.yml">
<Filter>beast\http\impl\http-parser</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser</Filter>
</None>
<None Include="..\..\beast\http\impl\http-parser\AUTHORS">
<Filter>beast\http\impl\http-parser</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser</Filter>
</None>
<None Include="..\..\beast\http\impl\http-parser\CONTRIBUTIONS">
<Filter>beast\http\impl\http-parser</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser</Filter>
</None>
<None Include="..\..\beast\http\impl\http-parser\http_parser.gyp">
<Filter>beast\http\impl\http-parser</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser</Filter>
</None>
<None Include="..\..\beast\http\impl\http-parser\LICENSE-MIT">
<Filter>beast\http\impl\http-parser</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser</Filter>
</None>
<None Include="..\..\beast\http\impl\http-parser\Makefile">
<Filter>beast\http\impl\http-parser</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser</Filter>
</None>
<None Include="..\..\beast\http\impl\http-parser\README.md">
<Filter>beast\http\impl\http-parser</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser</Filter>
</None>
<None Include="..\..\modules\beast_core\beast_core.mm">
<Filter>beast_core</Filter>
</None>
<None Include="..\..\beast\crypto\impl\sha2\README">
<Filter>beast\crypto\impl\sha2</Filter>
<Filter>beast_asio\async\beast\crypto\impl\sha2</Filter>
</None>
<None Include="..\..\beast\crypto\impl\sha2\sha2test.pl">
<Filter>beast\crypto\impl\sha2</Filter>
<Filter>beast_asio\async\beast\crypto\impl\sha2</Filter>
</None>
</ItemGroup>
<ItemGroup>
@@ -198,15 +198,6 @@
<Filter Include="beast_extras\traits">
<UniqueIdentifier>{bf498396-2e1f-4903-be68-3053ba439af5}</UniqueIdentifier>
</Filter>
<Filter Include="beast">
<UniqueIdentifier>{92d1bb42-289a-4444-85c7-cb87540f2fff}</UniqueIdentifier>
</Filter>
<Filter Include="beast\intrusive">
<UniqueIdentifier>{8832eb52-53f9-4850-8dc9-1d579a386a0e}</UniqueIdentifier>
</Filter>
<Filter Include="beast\mpl">
<UniqueIdentifier>{5904368f-a0f2-4d26-a031-8cbe4448dc3f}</UniqueIdentifier>
</Filter>
<Filter Include="beast_asio\protocol">
<UniqueIdentifier>{c0724499-ab69-40c3-90e2-65242dbd2eaa}</UniqueIdentifier>
</Filter>
@@ -216,52 +207,61 @@
<Filter Include="_meta">
<UniqueIdentifier>{27052a76-e315-4725-9d9a-1233c7d71aba}</UniqueIdentifier>
</Filter>
<Filter Include="beast\net">
<Filter Include="beast_asio\async\beast">
<UniqueIdentifier>{92d1bb42-289a-4444-85c7-cb87540f2fff}</UniqueIdentifier>
</Filter>
<Filter Include="beast_asio\async\beast\intrusive">
<UniqueIdentifier>{8832eb52-53f9-4850-8dc9-1d579a386a0e}</UniqueIdentifier>
</Filter>
<Filter Include="beast_asio\async\beast\mpl">
<UniqueIdentifier>{5904368f-a0f2-4d26-a031-8cbe4448dc3f}</UniqueIdentifier>
</Filter>
<Filter Include="beast_asio\async\beast\net">
<UniqueIdentifier>{5faa76ea-5691-4e63-8833-577f92991356}</UniqueIdentifier>
</Filter>
<Filter Include="beast\net\impl">
<Filter Include="beast_asio\async\beast\net\impl">
<UniqueIdentifier>{93670bc9-a748-42bd-8118-8de30c468b16}</UniqueIdentifier>
</Filter>
<Filter Include="beast\type_traits">
<Filter Include="beast_asio\async\beast\type_traits">
<UniqueIdentifier>{85158eb2-9340-4b3d-a136-f7631c7f1b7c}</UniqueIdentifier>
</Filter>
<Filter Include="beast\utility">
<Filter Include="beast_asio\async\beast\utility">
<UniqueIdentifier>{56d34c67-7027-44ba-9f09-4591ce4afb36}</UniqueIdentifier>
</Filter>
<Filter Include="beast\utility\impl">
<Filter Include="beast_asio\async\beast\utility\impl">
<UniqueIdentifier>{775ab0d6-aa5f-43d7-ab3b-3c01652a9ef1}</UniqueIdentifier>
</Filter>
<Filter Include="beast\thread">
<Filter Include="beast_asio\async\beast\thread">
<UniqueIdentifier>{da8084c0-491b-4eb0-b750-97182a9deed4}</UniqueIdentifier>
</Filter>
<Filter Include="beast\http">
<Filter Include="beast_asio\async\beast\http">
<UniqueIdentifier>{56ef157f-ad92-4da7-8fbf-00723f769732}</UniqueIdentifier>
</Filter>
<Filter Include="beast\http\impl">
<Filter Include="beast_asio\async\beast\http\impl">
<UniqueIdentifier>{565f012b-42b7-42c9-81b7-9e93aa378000}</UniqueIdentifier>
</Filter>
<Filter Include="beast\http\impl\http-parser">
<Filter Include="beast_asio\async\beast\http\impl\http-parser">
<UniqueIdentifier>{7eead15d-f9dc-4b4d-a653-57d9c090e697}</UniqueIdentifier>
</Filter>
<Filter Include="beast\http\impl\http-parser\contrib">
<Filter Include="beast_asio\async\beast\http\impl\http-parser\contrib">
<UniqueIdentifier>{233e3c4d-e398-4c11-a42c-3483107eb8e9}</UniqueIdentifier>
</Filter>
<Filter Include="beast\strings">
<Filter Include="beast_asio\async\beast\strings">
<UniqueIdentifier>{8d80e304-a42d-411a-9528-811eddff3191}</UniqueIdentifier>
</Filter>
<Filter Include="beast\strings\impl">
<Filter Include="beast_asio\async\beast\strings\impl">
<UniqueIdentifier>{eabf472c-e198-409a-a65b-7c087ae911d0}</UniqueIdentifier>
</Filter>
<Filter Include="beast\config">
<Filter Include="beast_asio\async\beast\config">
<UniqueIdentifier>{1fff3bd8-44ae-41df-8dd4-8bb6f07b2908}</UniqueIdentifier>
</Filter>
<Filter Include="beast\crypto">
<Filter Include="beast_asio\async\beast\crypto">
<UniqueIdentifier>{9c1ef4c4-5623-4500-859f-12d6ce5ae362}</UniqueIdentifier>
</Filter>
<Filter Include="beast\crypto\impl">
<Filter Include="beast_asio\async\beast\crypto\impl">
<UniqueIdentifier>{fc3d3f14-9ba1-43e4-b086-cbbd2f63b944}</UniqueIdentifier>
</Filter>
<Filter Include="beast\crypto\impl\sha2">
<Filter Include="beast_asio\async\beast\crypto\impl\sha2">
<UniqueIdentifier>{44489531-f44a-439a-a6ea-d32c252b1e8b}</UniqueIdentifier>
</Filter>
</ItemGroup>
@@ -825,28 +825,28 @@
<Filter>beast_core\containers</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\intrusive\ForwardList.h">
<Filter>beast\intrusive</Filter>
<Filter>beast_asio\async\beast\intrusive</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\intrusive\PointerTraits.h">
<Filter>beast\intrusive</Filter>
<Filter>beast_asio\async\beast\intrusive</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\mpl\RemoveConst.h">
<Filter>beast\mpl</Filter>
<Filter>beast_asio\async\beast\mpl</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\mpl\RemoveConstVolatile.h">
<Filter>beast\mpl</Filter>
<Filter>beast_asio\async\beast\mpl</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\mpl\RemoveReference.h">
<Filter>beast\mpl</Filter>
<Filter>beast_asio\async\beast\mpl</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\mpl\RemoveVolatile.h">
<Filter>beast\mpl</Filter>
<Filter>beast_asio\async\beast\mpl</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\mpl\AddConst.h">
<Filter>beast\mpl</Filter>
<Filter>beast_asio\async\beast\mpl</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\mpl\PointerToOther.h">
<Filter>beast\mpl</Filter>
<Filter>beast_asio\async\beast\mpl</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_core\memory\SharedPtr.h">
<Filter>beast_core\memory</Filter>
@@ -972,7 +972,7 @@
<Filter>beast_asio\http</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\mpl\IfCond.h">
<Filter>beast\mpl</Filter>
<Filter>beast_asio\async\beast\mpl</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_asio\basics\BuffersType.h">
<Filter>beast_asio\basics</Filter>
@@ -1011,64 +1011,64 @@
<Filter>beast_core\memory</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\net\IPEndpoint.h">
<Filter>beast\net</Filter>
<Filter>beast_asio\async\beast\net</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\Config.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\CStdInt.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\MPL.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\Net.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\TypeTraits.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\type_traits\IsSigned.h">
<Filter>beast\type_traits</Filter>
<Filter>beast_asio\async\beast\type_traits</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\type_traits\IntegralConstant.h">
<Filter>beast\type_traits</Filter>
<Filter>beast_asio\async\beast\type_traits</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\type_traits\IsIntegral.h">
<Filter>beast\type_traits</Filter>
<Filter>beast_asio\async\beast\type_traits</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\type_traits\RemoveSigned.h">
<Filter>beast\type_traits</Filter>
<Filter>beast_asio\async\beast\type_traits</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\utility\EnableIf.h">
<Filter>beast\utility</Filter>
<Filter>beast_asio\async\beast\utility</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\utility\Journal.h">
<Filter>beast\utility</Filter>
<Filter>beast_asio\async\beast\utility</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\Utility.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\mpl\IsCallPossible.h">
<Filter>beast\mpl</Filter>
<Filter>beast_asio\async\beast\mpl</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\Thread.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\thread\LockGuard.h">
<Filter>beast\thread</Filter>
<Filter>beast_asio\async\beast\thread</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\thread\SharedLockGuard.h">
<Filter>beast\thread</Filter>
<Filter>beast_asio\async\beast\thread</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\thread\SharedData.h">
<Filter>beast\thread</Filter>
<Filter>beast_asio\async\beast\thread</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\thread\SharedMutexAdapter.h">
<Filter>beast\thread</Filter>
<Filter>beast_asio\async\beast\thread</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\Uncopyable.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_asio\http\HTTPRequest.h">
<Filter>beast_asio\http</Filter>
@@ -1080,116 +1080,122 @@
<Filter>beast_asio\basics</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\Intrusive.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\Atomic.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\intrusive\LockFreeStack.h">
<Filter>beast\intrusive</Filter>
<Filter>beast_asio\async\beast\intrusive</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\intrusive\List.h">
<Filter>beast\intrusive</Filter>
<Filter>beast_asio\async\beast\intrusive</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\mpl\CopyConst.h">
<Filter>beast\mpl</Filter>
<Filter>beast_asio\async\beast\mpl</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_core\thread\Stoppable.h">
<Filter>beast_core\thread</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\http\impl\http-parser\http_parser.h">
<Filter>beast\http\impl\http-parser</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\HTTP.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\strings\CharacterFunctions.h">
<Filter>beast\strings</Filter>
<Filter>beast_asio\async\beast\strings</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\strings\CharPointer_ASCII.h">
<Filter>beast\strings</Filter>
<Filter>beast_asio\async\beast\strings</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\strings\CharPointer_UTF8.h">
<Filter>beast\strings</Filter>
<Filter>beast_asio\async\beast\strings</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\strings\CharPointer_UTF16.h">
<Filter>beast\strings</Filter>
<Filter>beast_asio\async\beast\strings</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\strings\CharPointer_UTF32.h">
<Filter>beast\strings</Filter>
<Filter>beast_asio\async\beast\strings</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\strings\NewLine.h">
<Filter>beast\strings</Filter>
<Filter>beast_asio\async\beast\strings</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\strings\String.h">
<Filter>beast\strings</Filter>
<Filter>beast_asio\async\beast\strings</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\strings\StringCharPointerType.h">
<Filter>beast\strings</Filter>
<Filter>beast_asio\async\beast\strings</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\strings\StringFromNumber.h">
<Filter>beast\strings</Filter>
<Filter>beast_asio\async\beast\strings</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\Strings.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\config\CompilerConfig.h">
<Filter>beast\config</Filter>
<Filter>beast_asio\async\beast\config</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\config\PlatformConfig.h">
<Filter>beast\config</Filter>
<Filter>beast_asio\async\beast\config</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\config\StandardConfig.h">
<Filter>beast\config</Filter>
<Filter>beast_asio\async\beast\config</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\Version.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\config\ConfigCheck.h">
<Filter>beast\config</Filter>
<Filter>beast_asio\async\beast\config</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\config\ContractChecks.h">
<Filter>beast\config</Filter>
<Filter>beast_asio\async\beast\config</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\StaticAssert.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\Arithmetic.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\Memory.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\ByteOrder.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\HeapBlock.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_core\system\StandardIncludes.h">
<Filter>beast_core\system</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\http\URL.h">
<Filter>beast\http</Filter>
<Filter>beast_asio\async\beast\http</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\http\ParsedURL.h">
<Filter>beast\http</Filter>
<Filter>beast_asio\async\beast\http</Filter>
</ClInclude>
<ClInclude Include="BeastConfig.h" />
<ClInclude Include="..\..\beast\FixedArray.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\intrusive\IntrusiveArray.h">
<Filter>beast\intrusive</Filter>
<Filter>beast_asio\async\beast\intrusive</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\Crypto.h">
<Filter>beast</Filter>
<Filter>beast_asio\async\beast</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\crypto\impl\sha2\sha2.h">
<Filter>beast\crypto\impl\sha2</Filter>
<Filter>beast_asio\async\beast\crypto\impl\sha2</Filter>
</ClInclude>
<ClInclude Include="..\..\beast\crypto\Sha256.h">
<Filter>beast\crypto</Filter>
<Filter>beast_asio\async\beast\crypto</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_asio\async\WrapHandler.h">
<Filter>beast_asio\async</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_asio\async\AbstractHandler.h">
<Filter>beast_asio\async</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
@@ -1692,16 +1698,16 @@
<Filter>beast_extras</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\net\impl\IPEndpoint.cpp">
<Filter>beast\net\impl</Filter>
<Filter>beast_asio\async\beast\net\impl</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\net\Net.cpp">
<Filter>beast\net</Filter>
<Filter>beast_asio\async\beast\net</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\utility\Utility.cpp">
<Filter>beast\utility</Filter>
<Filter>beast_asio\async\beast\utility</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\utility\impl\Journal.cpp">
<Filter>beast\utility\impl</Filter>
<Filter>beast_asio\async\beast\utility\impl</Filter>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\http\HTTPRequest.cpp">
<Filter>beast_asio\http</Filter>
@@ -1710,52 +1716,52 @@
<Filter>beast_core\thread</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\http\impl\http-parser\http_parser.c">
<Filter>beast\http\impl\http-parser</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\http\impl\http-parser\test.c">
<Filter>beast\http\impl\http-parser</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\http\impl\http-parser\contrib\parsertrace.c">
<Filter>beast\http\impl\http-parser\contrib</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser\contrib</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\http\impl\http-parser\contrib\url_parser.c">
<Filter>beast\http\impl\http-parser\contrib</Filter>
<Filter>beast_asio\async\beast\http\impl\http-parser\contrib</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\http\HTTP.cpp">
<Filter>beast\http</Filter>
<Filter>beast_asio\async\beast\http</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\http\impl\http_parser.cpp">
<Filter>beast\http\impl</Filter>
<Filter>beast_asio\async\beast\http\impl</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\strings\impl\CharacterFunctions.cpp">
<Filter>beast\strings\impl</Filter>
<Filter>beast_asio\async\beast\strings\impl</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\strings\impl\String.cpp">
<Filter>beast\strings\impl</Filter>
<Filter>beast_asio\async\beast\strings\impl</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\strings\Strings.cpp">
<Filter>beast\strings</Filter>
<Filter>beast_asio\async\beast\strings</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\http\impl\URL.cpp">
<Filter>beast\http\impl</Filter>
<Filter>beast_asio\async\beast\http\impl</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\http\impl\ParsedURL.cpp">
<Filter>beast\http\impl</Filter>
<Filter>beast_asio\async\beast\http\impl</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\crypto\impl\sha2\sha2.c">
<Filter>beast\crypto\impl\sha2</Filter>
<Filter>beast_asio\async\beast\crypto\impl\sha2</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\crypto\impl\sha2\sha2prog.c">
<Filter>beast\crypto\impl\sha2</Filter>
<Filter>beast_asio\async\beast\crypto\impl\sha2</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\crypto\impl\sha2\sha2speed.c">
<Filter>beast\crypto\impl\sha2</Filter>
<Filter>beast_asio\async\beast\crypto\impl\sha2</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\crypto\Crypto.cpp">
<Filter>beast\crypto</Filter>
<Filter>beast_asio\async\beast\crypto</Filter>
</ClCompile>
<ClCompile Include="..\..\beast\crypto\impl\Sha256.cpp">
<Filter>beast\crypto\impl</Filter>
<Filter>beast_asio\async\beast\crypto\impl</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>

View File

@@ -0,0 +1,706 @@
//------------------------------------------------------------------------------
/*
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_ASIO_ABSTRACTHANDLER_H_INCLUDED
#define BEAST_ASIO_ABSTRACTHANDLER_H_INCLUDED
namespace beast {
namespace detail {
struct AbstractHandlerCallBase : SharedObject
{
//typedef SharedFunction <void(void),
// AbstractHandlerAllocator <char> > invoked_type;
typedef SharedFunction <void(void)> invoked_type;
virtual void* allocate (std::size_t size) = 0;
virtual void deallocate (void* p, std::size_t size) = 0;
virtual bool is_continuation () = 0;
virtual void invoke (invoked_type& invoked) = 0;
template <typename Function>
void invoke (BEAST_MOVE_ARG(Function) f)
{
invoked_type invoked (BEAST_MOVE_CAST(Function)(f)
//, AbstractHandlerAllocator<char>(this)
);
invoke (invoked);
}
};
/*
template <typename T>
struct AbstractHandlerAllocator
{
typedef T value_type;
typedef T* pointer;
typedef T& reference;
typedef T const* const_pointer;
typedef T const& const_reference;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
AbstractHandlerAllocator (AbstractHandler* handler) noexcept
: m_ptr (handler)
{
}
AbstractHandlerAllocator (SharedPtr <AbstractHandler> const& ptr) noexcept
: m_ptr (ptr)
{
}
template <typename U>
AbstractHandlerAllocator (AbstractHandlerAllocator <U> const& other)
: m_ptr (other.m_ptr)
{
}
template <typename U>
struct rebind
{
typedef AbstractHandlerAllocator <U> other;
};
pointer address (reference x) const
{
return &x;
}
const_pointer address (const_reference x) const
{
return &x;
}
pointer allocate (size_type n) const
{
size_type const bytes = n * sizeof (value_type);
return static_cast <pointer> (m_ptr->allocate (bytes));
}
void deallocate (pointer p, size_type n) const
{
size_type const bytes = n * sizeof (value_type);
m_ptr->deallocate (p, bytes);
}
size_type max_size () const noexcept
{
return std::numeric_limits <size_type>::max () / sizeof (value_type);
}
void construct (pointer p, const_reference val) const
{
new ((void *)p) value_type (val);
}
void destroy (pointer p) const
{
p->~value_type ();
}
private:
template <typename>
friend struct AbstractHandlerAllocator;
friend class AbstractHandler;
SharedPtr <AbstractHandler> m_ptr;
};
*/
}
/** A reference counted, abstract completion handler. */
template <typename Signature, class Allocator = std::allocator <char> >
class AbstractHandler;
//------------------------------------------------------------------------------
// arity 0
template <class R, class A>
struct AbstractHandler <R (void), A>
{
typedef R result_type;
struct Call : detail::AbstractHandlerCallBase
{ virtual R operator() () = 0; };
template <typename H>
struct CallType : public Call
{
typedef typename A:: template rebind <CallType <H> >::other Allocator;
CallType (BEAST_MOVE_ARG(H) h, A a = A ())
: m_h (BEAST_MOVE_CAST(H)(h)), m_alloc (a)
{ }
R operator()()
{ return (m_h)(); }
R operator()() const
{ return (m_h)(); }
void* allocate (std::size_t size)
{ return boost_asio_handler_alloc_helpers::allocate(size, m_h); }
void deallocate (void* pointer, std::size_t size)
{ boost_asio_handler_alloc_helpers::deallocate( pointer, size, m_h); }
bool is_continuation ()
#if BEAST_ASIO_HAS_CONTINUATION_HOOKS
{ return boost_asio_handler_cont_helpers::is_continuation(m_h); }
#else
{ return false; }
#endif
void invoke (invoked_type& invoked)
{ boost_asio_handler_invoke_helpers::invoke <invoked_type, H> (invoked, m_h); }
private:
H m_h;
Allocator m_alloc;
};
template <typename H>
AbstractHandler (BEAST_MOVE_ARG(H) h, A a = A ())
: m_call (new (
typename A:: template rebind <CallType <H> >::other (a)
.allocate (1)) CallType <H> (BEAST_MOVE_CAST(H)(h), a))
{ }
R operator() ()
{ return (*m_call)(); }
R operator() () const
{ return (*m_call)(); }
void* allocate (std::size_t size) const { return m_call->allocate(size); }
void deallocate (void* pointer, std::size_t size) const { m_call->deallocate(pointer,size); }
bool is_continuation () const { return m_call->is_continuation(); }
template <typename Function>
void invoke (Function& function) const
{
m_call->invoke(function);
}
template <typename Function>
void invoke (Function const& function) const
{
m_call->invoke(function);
}
private:
SharedPtr <Call> m_call;
};
template <class R, class A>
void* asio_handler_allocate (std::size_t size,
AbstractHandler <R (void), A>* handler)
{
return handler->allocate (size);
}
template <class R, class A>
void asio_handler_deallocate (void* pointer, std::size_t size,
AbstractHandler <R (void), A>* handler)
{
handler->deallocate (pointer, size);
}
template <class R, class A>
bool asio_handler_is_continuation(
AbstractHandler <R (void), A>* handler)
{
return handler->is_continuation();
}
template <typename Function, class R, class A>
void asio_handler_invoke (BEAST_MOVE_ARG(Function) function,
AbstractHandler <R (void), A>* handler)
{
handler->invoke (BEAST_MOVE_CAST(Function)(function));
}
//------------------------------------------------------------------------------
// arity 1
template <class R, class P1, class A>
struct AbstractHandler <R (P1), A>
{
typedef R result_type;
struct Call : detail::AbstractHandlerCallBase
{ virtual R operator() (P1) = 0; };
template <typename H>
struct CallType : public Call
{
typedef typename A:: template rebind <CallType <H> >::other Allocator;
CallType (H h, A a = A ())
: m_h (h)
, m_alloc (a)
{
}
R operator()(P1 p1)
{ return (m_h)(p1); }
R operator()(P1 p1) const
{ return (m_h)(p1); }
void* allocate (std::size_t size)
{ return boost_asio_handler_alloc_helpers::allocate(size, m_h); }
void deallocate (void* pointer, std::size_t size)
{ boost_asio_handler_alloc_helpers::deallocate( pointer, size, m_h); }
bool is_continuation ()
#if BEAST_ASIO_HAS_CONTINUATION_HOOKS
{ return boost_asio_handler_cont_helpers::is_continuation(m_h); }
#else
{ return false; }
#endif
void invoke (invoked_type& invoked)
{ boost_asio_handler_invoke_helpers::invoke <invoked_type, H> (invoked, m_h); }
private:
H m_h;
Allocator m_alloc;
};
template <typename H>
AbstractHandler (H h, A a = A ())
: m_call (new (
typename A:: template rebind <CallType <H> >::other (a)
.allocate (1)) CallType <H> (h, a))
{
}
R operator() (P1 p1)
{ return (*m_call)(p1); }
R operator() (P1 p1) const
{ return (*m_call)(p1); }
void* allocate (std::size_t size) const { return m_call->allocate(size); }
void deallocate (void* pointer, std::size_t size) const { m_call->deallocate(pointer,size); }
bool is_continuation () const { return m_call->is_continuation(); }
template <typename Function>
void invoke (Function& function) const
{
m_call->invoke(function);
}
template <typename Function>
void invoke (Function const& function) const
{
m_call->invoke(function);
}
private:
SharedPtr <Call> m_call;
};
template <class R, class P1, class A>
void* asio_handler_allocate (std::size_t size,
AbstractHandler <R (P1), A>* handler)
{
return handler->allocate (size);
}
template <class R, class P1, class A>
void asio_handler_deallocate (void* pointer, std::size_t size,
AbstractHandler <R (P1), A>* handler)
{
handler->deallocate (pointer, size);
}
template <class R, class P1, class A>
bool asio_handler_is_continuation(
AbstractHandler <R (P1), A>* handler)
{
return handler->is_continuation();
}
template <typename Function, class R, class P1, class A>
void asio_handler_invoke (BEAST_MOVE_ARG(Function) function,
AbstractHandler <R (P1), A>* handler)
{
handler->invoke (BEAST_MOVE_CAST(Function)(function));
}
//------------------------------------------------------------------------------
// arity 2
template <class R, class P1, class P2, class A>
struct AbstractHandler <R (P1, P2), A>
{
typedef R result_type;
struct Call : detail::AbstractHandlerCallBase
{ virtual R operator() (P1, P2) = 0; };
template <typename H>
struct CallType : public Call
{
typedef typename A:: template rebind <CallType <H> >::other Allocator;
CallType (BEAST_MOVE_ARG(H) h, A a = A ())
: m_h (BEAST_MOVE_CAST(H)(h)), m_alloc (a)
{ }
R operator()(P1 p1, P2 p2)
{ return (m_h)(p1, p2); }
R operator()(P1 p1, P2 p2) const
{ return (m_h)(p1, p2); }
void* allocate (std::size_t size)
{ return boost_asio_handler_alloc_helpers::allocate(size, m_h); }
void deallocate (void* pointer, std::size_t size)
{ boost_asio_handler_alloc_helpers::deallocate( pointer, size, m_h); }
bool is_continuation ()
#if BEAST_ASIO_HAS_CONTINUATION_HOOKS
{ return boost_asio_handler_cont_helpers::is_continuation(m_h); }
#else
{ return false; }
#endif
void invoke (invoked_type& invoked)
{ boost_asio_handler_invoke_helpers::invoke <invoked_type, H> (invoked, m_h); }
private:
H m_h;
Allocator m_alloc;
};
template <typename H>
AbstractHandler (BEAST_MOVE_ARG(H) h, A a = A ())
: m_call (new (
typename A:: template rebind <CallType <H> >::other (a)
.allocate (1)) CallType <H> (BEAST_MOVE_CAST(H)(h), a))
{ }
R operator() (P1 p1, P2 p2)
{ return (*m_call)(p1, p2); }
R operator() (P1 p1, P2 p2) const
{ return (*m_call)(p1, p2); }
void* allocate (std::size_t size) const { return m_call->allocate(size); }
void deallocate (void* pointer, std::size_t size) const { m_call->deallocate(pointer,size); }
bool is_continuation () const { return m_call->is_continuation(); }
template <typename Function>
void invoke (Function& function) const
{
m_call->invoke(function);
}
template <typename Function>
void invoke (Function const& function) const
{
m_call->invoke(function);
}
private:
SharedPtr <Call> m_call;
};
template <class R, class P1, class P2, class A>
void* asio_handler_allocate (std::size_t size,
AbstractHandler <R (P1, P2), A>* handler)
{
return handler->allocate (size);
}
template <class R, class P1, class P2, class A>
void asio_handler_deallocate (void* pointer, std::size_t size,
AbstractHandler <R (P1, P2), A>* handler)
{
handler->deallocate (pointer, size);
}
template <class R, class P1, class P2, class A>
bool asio_handler_is_continuation(
AbstractHandler <R (P1, P2), A>* handler)
{
return handler->is_continuation();
}
template <typename Function, class R, class P1, class P2, class A>
void asio_handler_invoke (BEAST_MOVE_ARG(Function) function,
AbstractHandler <R (P1, P2), A>* handler)
{
handler->invoke (BEAST_MOVE_CAST(Function)(function));
}
//------------------------------------------------------------------------------
// arity 3
template <class R, class P1, class P2, class P3, class A>
struct AbstractHandler <R (P1, P2, P3), A>
{
typedef R result_type;
struct Call : detail::AbstractHandlerCallBase
{ virtual R operator() (P1, P2, P3) = 0; };
template <typename H>
struct CallType : public Call
{
typedef typename A:: template rebind <CallType <H> >::other Allocator;
CallType (BEAST_MOVE_ARG(H) h, A a = A ())
: m_h (BEAST_MOVE_CAST(H)(h)), m_alloc (a)
{ }
R operator()(P1 p1, P2 p2, P3 p3)
{ return (m_h)(p1, p2, p3); }
R operator()(P1 p1, P2 p2, P3 p3) const
{ return (m_h)(p1, p2, p3); }
void* allocate (std::size_t size)
{ return boost_asio_handler_alloc_helpers::allocate(size, m_h); }
void deallocate (void* pointer, std::size_t size)
{ boost_asio_handler_alloc_helpers::deallocate( pointer, size, m_h); }
bool is_continuation ()
#if BEAST_ASIO_HAS_CONTINUATION_HOOKS
{ return boost_asio_handler_cont_helpers::is_continuation(m_h); }
#else
{ return false; }
#endif
void invoke (invoked_type& invoked)
{ boost_asio_handler_invoke_helpers::invoke <invoked_type, H> (invoked, m_h); }
private:
H m_h;
Allocator m_alloc;
};
template <typename H>
AbstractHandler (BEAST_MOVE_ARG(H) h, A a = A ())
: m_call (new (
typename A:: template rebind <CallType <H> >::other (a)
.allocate (1)) CallType <H> (BEAST_MOVE_CAST(H)(h), a))
{ }
R operator() (P1 p1, P2 p2, P3 p3)
{ return (*m_call)(p1, p2, p3); }
R operator() (P1 p1, P2 p2, P3 p3) const
{ return (*m_call)(p1, p2, p3); }
void* allocate (std::size_t size) const { return m_call->allocate(size); }
void deallocate (void* pointer, std::size_t size) const { m_call->deallocate(pointer,size); }
bool is_continuation () const { return m_call->is_continuation(); }
template <typename Function>
void invoke (Function& function) const
{
m_call->invoke(function);
}
template <typename Function>
void invoke (Function const& function) const
{
m_call->invoke(function);
}
private:
SharedPtr <Call> m_call;
};
template <class R, class P1, class P2, class P3, class A>
void* asio_handler_allocate (std::size_t size,
AbstractHandler <R (P1, P2, P3), A>* handler)
{
return handler->allocate (size);
}
template <class R, class P1, class P2, class P3, class A>
void asio_handler_deallocate (void* pointer, std::size_t size,
AbstractHandler <R (P1, P2, P3), A>* handler)
{
handler->deallocate (pointer, size);
}
template <class R, class P1, class P2, class P3, class A>
bool asio_handler_is_continuation(
AbstractHandler <R (P1, P2, P3), A>* handler)
{
return handler->is_continuation();
}
template <typename Function, class R, class P1, class P2, class P3, class A>
void asio_handler_invoke (BEAST_MOVE_ARG(Function) function,
AbstractHandler <R (P1, P2, P3), A>* handler)
{
handler->invoke (BEAST_MOVE_CAST(Function)(function));
}
//------------------------------------------------------------------------------
// arity 4
template <class R, class P1, class P2, class P3, class P4, class A>
struct AbstractHandler <R (P1, P2, P3, P4), A>
{
typedef R result_type;
struct Call : detail::AbstractHandlerCallBase
{ virtual R operator() (P1, P2, P3, P4) = 0; };
template <typename H>
struct CallType : public Call
{
typedef typename A:: template rebind <CallType <H> >::other Allocator;
CallType (BEAST_MOVE_ARG(H) h, A a = A ())
: m_h (BEAST_MOVE_CAST(H)(h)), m_alloc (a)
{ }
R operator()(P1 p1, P2 p2, P3 p3, P4 p4)
{ return (m_h)(p1, p2, p3, p4); }
R operator()(P1 p1, P2 p2, P3 p3, P4 p4) const
{ return (m_h)(p1, p2, p3, p4); }
void* allocate (std::size_t size)
{ return boost_asio_handler_alloc_helpers::allocate(size, m_h); }
void deallocate (void* pointer, std::size_t size)
{ boost_asio_handler_alloc_helpers::deallocate( pointer, size, m_h); }
bool is_continuation ()
#if BEAST_ASIO_HAS_CONTINUATION_HOOKS
{ return boost_asio_handler_cont_helpers::is_continuation(m_h); }
#else
{ return false; }
#endif
void invoke (invoked_type& invoked)
{ boost_asio_handler_invoke_helpers::invoke <invoked_type, H> (invoked, m_h); }
private:
H m_h;
Allocator m_alloc;
};
template <typename H>
AbstractHandler (BEAST_MOVE_ARG(H) h, A a = A ())
: m_call (new (
typename A:: template rebind <CallType <H> >::other (a)
.allocate (1)) CallType <H> (BEAST_MOVE_CAST(H)(h), a))
{ }
R operator() (P1 p1, P2 p2, P3 p3, P4 p4)
{ return (*m_call)(p1, p2, p3, p4); }
R operator() (P1 p1, P2 p2, P3 p3, P4 p4) const
{ return (*m_call)(p1, p2, p3, p4); }
void* allocate (std::size_t size) const { return m_call->allocate(size); }
void deallocate (void* pointer, std::size_t size) const { m_call->deallocate(pointer,size); }
bool is_continuation () const { return m_call->is_continuation(); }
template <typename Function>
void invoke (Function& function) const
{
m_call->invoke(function);
}
template <typename Function>
void invoke (Function const& function) const
{
m_call->invoke(function);
}
private:
SharedPtr <Call> m_call;
};
template <class R, class P1, class P2, class P3, class P4, class A>
void* asio_handler_allocate (std::size_t size,
AbstractHandler <R (P1, P2, P3, P4), A>* handler)
{
return handler->allocate (size);
}
template <class R, class P1, class P2, class P3, class P4, class A>
void asio_handler_deallocate (void* pointer, std::size_t size,
AbstractHandler <R (P1, P2, P3, P4), A>* handler)
{
handler->deallocate (pointer, size);
}
template <class R, class P1, class P2, class P3, class P4, class A>
bool asio_handler_is_continuation(
AbstractHandler <R (P1, P2, P3, P4), A>* handler)
{
return handler->is_continuation();
}
template <typename Function, class R, class P1, class P2, class P3, class P4, class A>
void asio_handler_invoke (BEAST_MOVE_ARG(Function) function,
AbstractHandler <R (P1, P2, P3, P4), A>* handler)
{
handler->invoke (BEAST_MOVE_CAST(Function)(function));
}
//------------------------------------------------------------------------------
// arity 5
template <class R, class P1, class P2, class P3, class P4, class P5, class A>
struct AbstractHandler <R (P1, P2, P3, P4, P5), A>
{
typedef R result_type;
struct Call : detail::AbstractHandlerCallBase
{ virtual R operator() (P1, P2, P3, P4, P5) = 0; };
template <typename H>
struct CallType : public Call
{
typedef typename A:: template rebind <CallType <H> >::other Allocator;
CallType (BEAST_MOVE_ARG(H) h, A a = A ())
: m_h (BEAST_MOVE_CAST(H)(h)), m_alloc (a)
{ }
R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
{ return (m_h)(p1, p2, p3, p4, p5); }
R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) const
{ return (m_h)(p1, p2, p3, p4, p5); }
void* allocate (std::size_t size)
{ return boost_asio_handler_alloc_helpers::allocate(size, m_h); }
void deallocate (void* pointer, std::size_t size)
{ boost_asio_handler_alloc_helpers::deallocate( pointer, size, m_h); }
bool is_continuation ()
#if BEAST_ASIO_HAS_CONTINUATION_HOOKS
{ return boost_asio_handler_cont_helpers::is_continuation(m_h); }
#else
{ return false; }
#endif
void invoke (invoked_type& invoked)
{ boost_asio_handler_invoke_helpers::invoke <invoked_type, H> (invoked, m_h); }
private:
H m_h;
Allocator m_alloc;
};
template <typename H>
AbstractHandler (BEAST_MOVE_ARG(H) h, A a = A ())
: m_call (new (
typename A:: template rebind <CallType <H> >::other (a)
.allocate (1)) CallType <H> (BEAST_MOVE_CAST(H)(h), a))
{ }
R operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
{ return (*m_call)(p1, p2, p3, p4, p5); }
R operator() (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) const
{ return (*m_call)(p1, p2, p3, p4, p5); }
void* allocate (std::size_t size) const { return m_call->allocate(size); }
void deallocate (void* pointer, std::size_t size) const { m_call->deallocate(pointer,size); }
bool is_continuation () const { return m_call->is_continuation(); }
template <typename Function>
void invoke (Function& function) const
{
m_call->invoke(function);
}
template <typename Function>
void invoke (Function const& function) const
{
m_call->invoke(function);
}
private:
SharedPtr <Call> m_call;
};
template <class R, class P1, class P2, class P3, class P4, class P5, class A>
void* asio_handler_allocate (std::size_t size,
AbstractHandler <R (P1, P2, P3, P4, P5), A>* handler)
{
return handler->allocate (size);
}
template <class R, class P1, class P2, class P3, class P4, class P5, class A>
void asio_handler_deallocate (void* pointer, std::size_t size,
AbstractHandler <R (P1, P2, P3, P4, P5), A>* handler)
{
handler->deallocate (pointer, size);
}
template <class R, class P1, class P2, class P3, class P4, class P5, class A>
bool asio_handler_is_continuation(
AbstractHandler <R (P1, P2, P3, P4, P5), A>* handler)
{
return handler->is_continuation();
}
template <typename Function, class R, class P1, class P2, class P3, class P4, class P5, class A>
void asio_handler_invoke (BEAST_MOVE_ARG(Function) function,
AbstractHandler <R (P1, P2, P3, P4, P5), A>* handler)
{
handler->invoke (BEAST_MOVE_CAST(Function)(function));
}
}
#endif

View File

@@ -45,11 +45,9 @@ class SharedHandler : public SharedObject
{
protected:
typedef boost::system::error_code error_code;
#if 0
typedef boost::function <void(void)> invoked_type;
#else
typedef SharedFunction <void(void), SharedHandlerAllocator <char> > invoked_type;
#endif
typedef SharedFunction <void(void),
SharedHandlerAllocator <char> > invoked_type;
SharedHandler () noexcept { }
@@ -65,9 +63,6 @@ public:
template <typename Function>
void invoke (BOOST_ASIO_MOVE_ARG(Function) f)
#if 0
;
#else
{
// The allocator will hold a reference to the SharedHandler
// so that we can safely destroy the function object.
@@ -75,7 +70,6 @@ public:
SharedHandlerAllocator <char> (this));
invoke (invoked);
}
#endif
virtual void invoke (invoked_type& invoked) = 0;
virtual void* allocate (std::size_t size) = 0;

View File

@@ -43,7 +43,7 @@ public:
@see isNull, isNotNull
*/
inline SharedHandlerPtr () noexcept
inline SharedHandlerPtr ()
{
}
@@ -55,15 +55,14 @@ public:
{
}
/** Construct a reference from an existing container.
*/
inline SharedHandlerPtr (SharedHandlerPtr const& other) noexcept
/** Construct a reference from an existing container. */
inline SharedHandlerPtr (SharedHandlerPtr const& other)
: m_ptr (other.m_ptr)
{
}
/** Assign a reference from an existing container. */
inline SharedHandlerPtr& operator= (SharedHandlerPtr const& other) noexcept
inline SharedHandlerPtr& operator= (SharedHandlerPtr const& other)
{
m_ptr = other.m_ptr;
return *this;
@@ -73,7 +72,7 @@ public:
/** Move-construct a reference from an existing container.
The other container is set to a null handler.
*/
inline SharedHandlerPtr (SharedHandlerPtr&& other) noexcept
inline SharedHandlerPtr (SharedHandlerPtr&& other)
: m_ptr (other.m_ptr)
{
other.m_ptr = nullptr;
@@ -82,7 +81,7 @@ public:
/** Move-assign a reference from an existing container.
The other container is set to a null handler.
*/
inline SharedHandlerPtr& operator= (SharedHandlerPtr&& other) noexcept
inline SharedHandlerPtr& operator= (SharedHandlerPtr&& other)
{
m_ptr = other.m_ptr;
other.m_ptr = nullptr;
@@ -91,13 +90,13 @@ public:
#endif
/** Returns true if the handler is a null handler. */
inline bool isNull () const noexcept
inline bool isNull () const
{
return m_ptr == nullptr;
}
/** Returns true if the handler is not a null handler. */
inline bool isNotNull () const noexcept
inline bool isNotNull () const
{
return m_ptr != nullptr;
}
@@ -105,7 +104,7 @@ public:
/** Dereference the container.
This returns a reference to the underlying SharedHandler object.
*/
inline SharedHandler& operator* () const noexcept
inline SharedHandler& operator* () const
{
return *m_ptr;
}
@@ -113,7 +112,7 @@ public:
/** SharedHandler member access.
This lets you call functions directly on the SharedHandler.
*/
inline SharedHandler* operator-> () const noexcept
inline SharedHandler* operator-> () const
{
return m_ptr.get ();
}
@@ -132,7 +131,7 @@ public:
@endcode
*/
inline SharedHandler* get () const noexcept
inline SharedHandler* get () const
{
return m_ptr.get ();
}
@@ -144,7 +143,7 @@ public:
{
(*m_ptr)();
}
/** Invoke the SharedHandler with signature void(error_code)
Normally this is called by a dispatcher, you shouldn't call it directly.
*/
@@ -180,7 +179,7 @@ private:
//
template <class Function>
inline void asio_handler_invoke (BOOST_ASIO_MOVE_ARG(Function) f, SharedHandlerPtr* ptr)
void asio_handler_invoke (BOOST_ASIO_MOVE_ARG(Function) f, SharedHandlerPtr* ptr)
{
boost_asio_handler_invoke_helpers::
invoke <Function, SharedHandler>

View File

@@ -21,7 +21,6 @@
#define BEAST_ASIO_ASYNC_SHAREDHANDLERTYPE_H_INCLUDED
/** An instance of SharedHandler that wraps an existing Handler.
The wrapped handler will meet all the execution guarantees of
the original Handler object.
*/

View File

@@ -0,0 +1,205 @@
//------------------------------------------------------------------------------
/*
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_ASIO_WRAPHANDLER_H_INCLUDED
#define BEAST_ASIO_WRAPHANDLER_H_INCLUDED
namespace beast {
namespace detail {
// Wrapper returned by wrapHandler, calls the Handler in the given Context
//
template <typename Handler, typename Context>
class WrappedHandler
{
public:
typedef void result_type; // for result_of
WrappedHandler (Handler& handler, Context const& context)
: m_handler (handler)
, m_context (context)
{
}
WrappedHandler (Handler const& handler, Context const& context)
: m_handler (handler)
, m_context (context)
{
}
#if BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS
WrappedHandler (WrappedHandler const& other)
: m_handler (other.m_handler)
, m_context (other.m_context)
{
}
WrappedHandler (BEAST_MOVE_ARG(WrappedHandler) other)
: m_handler (BEAST_MOVE_CAST(Handler)(other.m_handler))
, m_context (BEAST_MOVE_CAST(Context)(other.m_context))
{
}
#endif
Handler& handler()
{ return m_handler; }
Handler const& handler() const
{ return m_handler; }
Context& context()
{ return m_context; }
Context const& context() const
{ return m_context; }
void operator() ()
{ m_handler(); }
void operator() () const
{ m_handler(); }
template <class P1>
void operator() (P1 const& p1)
{ m_handler(p1); }
template <class P1>
void operator() (P1 const& p1) const
{ m_handler(p1); }
template <class P1, class P2>
void operator() (P1 const& p1, P2 const& p2)
{ m_handler(p1, p2); }
template <class P1, class P2>
void operator() (P1 const& p1, P2 const& p2) const
{ m_handler(p1, p2); }
template <class P1, class P2, class P3>
void operator() (P1 const& p1, P2 const& p2, P3 const& p3)
{ m_handler(p1, p2, p3); }
template <class P1, class P2, class P3>
void operator() (P1 const& p1, P2 const& p2, P3 const& p3) const
{ m_handler(p1, p2, p3); }
template <class P1, class P2, class P3, class P4>
void operator()
(P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4)
{ m_handler(p1, p2, p3, p4); }
template <class P1, class P2, class P3, class P4>
void operator()
(P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4) const
{ m_handler(p1, p2, p3, p4); }
template <class P1, class P2, class P3,
class P4, class P5>
void operator() (P1 const& p1, P2 const& p2, P3 const& p3,
P4 const& p4, P5 const& p5)
{ m_handler(p1, p2, p3, p4, p5); }
template <class P1, class P2, class P3,
class P4, class P5>
void operator() (P1 const& p1, P2 const& p2, P3 const& p3,
P4 const& p4, P5 const& p5) const
{ m_handler(p1, p2, p3, p4, p5); }
template <class P1, class P2, class P3,
class P4, class P5, class P6>
void operator() (P1 const& p1, P2 const& p2, P3 const& p3,
P4 const& p4, P5 const& p5, P6 const& p6)
{ m_handler(p1, p2, p3, p4, p5, p6); }
template <class P1, class P2, class P3,
class P4, class P5, class P6>
void operator() (P1 const& p1, P2 const& p2, P3 const& p3,
P4 const& p4, P5 const& p5, P6 const& p6) const
{ m_handler(p1, p2, p3, p4, p5, p6); }
private:
Handler m_handler;
Context m_context;
};
//------------------------------------------------------------------------------
template <typename Handler, typename Context>
void* asio_handler_allocate (std::size_t size,
WrappedHandler <Handler, Context>* this_handler)
{
return boost_asio_handler_alloc_helpers::allocate(
size, this_handler->context());
}
template <typename Handler, typename Context>
void asio_handler_deallocate (void* pointer, std::size_t size,
WrappedHandler <Handler, Context>* this_handler)
{
boost_asio_handler_alloc_helpers::deallocate(
pointer, size, this_handler->context());
}
template <typename Handler, typename Context>
bool asio_handler_is_continuation(
WrappedHandler <Handler, Context>* this_handler)
{
return boost_asio_handler_cont_helpers::is_continuation(
this_handler->handler());
}
template <typename Function, typename Handler, typename Context>
void asio_handler_invoke (Function& function,
WrappedHandler <Handler, Context>* handler)
{
boost_asio_handler_invoke_helpers::invoke(
function, handler->context());
}
template <typename Function, typename Handler, typename Context>
void asio_handler_invoke (Function const& function,
WrappedHandler <Handler, Context>* handler)
{
boost_asio_handler_invoke_helpers::invoke(
function, handler->context());
}
}
//------------------------------------------------------------------------------
/** Returns a handler that calls Handler using Context hooks.
This is useful when implementing composed asynchronous operations that
need to call their own intermediate handlers before issuing the final
completion to the original handler.
*/
template <typename Handler, typename Context>
detail::WrappedHandler <Handler, Context>
wrapHandler (
BEAST_MOVE_ARG(Handler) handler,
BEAST_MOVE_ARG(Context) context)
{
return detail::WrappedHandler <Handler, Context> (
BEAST_MOVE_CAST(Handler)(handler),
BEAST_MOVE_CAST(Context)(context));
}
}
#endif

View File

@@ -57,8 +57,10 @@
#include "../../beast/Utility.h"
#include "../../beast/HTTP.h"
namespace beast
{
#include "async/AbstractHandler.h"
#include "async/WrapHandler.h"
namespace beast {
// Order matters
# include "async/SharedHandler.h"
@@ -88,8 +90,13 @@ namespace beast
# include "http/HTTPRequest.h"
# include "http/HTTPResponse.h"
# include "http/HTTPParser.h"
}
#include "http/HTTPClientType.h"
namespace beast {
# include "protocol/InputParser.h"
# include "protocol/HandshakeDetectLogic.h"
#include "protocol/HandshakeDetectLogicPROXY.h"

File diff suppressed because it is too large Load Diff

View File

@@ -20,46 +20,49 @@
#ifndef BEAST_ASIO_HTTPCLIENTTYPE_H_INCLUDED
#define BEAST_ASIO_HTTPCLIENTTYPE_H_INCLUDED
#include <utility>
namespace beast {
class HTTPClientBase
{
public:
struct Result
{
boost::system::error_code error;
SharedPtr <HTTPResponse> response;
};
class Listener
{
public:
virtual void onHTTPRequestComplete (
HTTPClientBase const& client,
Result const& result) = 0;
};
typedef boost::system::error_code error_type;
typedef SharedPtr <HTTPResponse> value_type;
typedef std::pair <error_type, value_type> result_type;
static HTTPClientBase* New (
Journal journal = Journal(),
double timeoutSeconds = 30,
std::size_t messageLimitBytes = 256 * 1024,
std::size_t bufferSize = 16 * 1024);
/** Destroy the client.
This will cancel any pending i/o and block until all completion
handlers have been called.
*/
virtual ~HTTPClientBase () { }
virtual Result const& result () const = 0;
virtual result_type get (URL const& url) = 0;
virtual Result const& get (
URL const& url) = 0;
template <typename GetHandler>
void async_get (boost::asio::io_service& io_service,
URL const& url, GetHandler handler)
{
abstract_async_get (io_service, url,
AbstractHandler <void (result_type)> (handler));
}
virtual void async_get (boost::asio::io_service& io_service,
Listener* listener,
URL const& url) = 0;
virtual void abstract_async_get (boost::asio::io_service& io_service,
URL const& url, AbstractHandler <void (result_type)> handler) = 0;
/** Cancel any pending asynchronous operations.
This must be called before destroying the container if there are
any pending asynchronous operations. This routine does nothing if
there are no pending operations. The call will block until all
pending i/o is canceled.
*/
virtual void cancel () = 0;
/** Cancel any pending asynchronous operations. */
virtual void cancel() = 0;
/** Block until all asynchronous i/o completes. */
virtual void wait() = 0;
};
}
#endif