4#include "Stroika/Frameworks/StroikaPreComp.h"
11#include "Stroika/Foundation/Containers/Common.h"
16#include "Stroika/Foundation/Execution/Throw.h"
17#include "Stroika/Foundation/IO/Network/HTTP/Headers.h"
18#include "Stroika/Foundation/IO/Network/HTTP/Versions.h"
20#include "Stroika/Foundation/Streams/MemoryStream.h"
29using namespace Stroika::Foundation::Memory;
30using namespace Stroika::Foundation::Streams;
32using namespace Stroika::Frameworks;
45static_assert (not copyable<Request>);
46static_assert (movable<Request>);
49 : keepAliveRequested{[qStroika_Foundation_Common_Property_ExtraCaptureStuff] ([[maybe_unused]] const auto* property) {
53 if (thisObj->
httpVersion == IO::Network::HTTP::Versions::kOnePointZero) {
54 return thisObj->
headers ().connection ().value_or (ConnectionValue::eClose) == ConnectionValue::eKeepAlive;
56 if (thisObj->
httpVersion == IO::Network::HTTP::Versions::kOnePointOne) {
57 return thisObj->
headers ().connection ().value_or (ConnectionValue::eKeepAlive) == ConnectionValue::eKeepAlive;
61 , fInputStream_{inStream}
67#if USE_NOISY_TRACE_IN_THIS_MODULE_
70 AssertExternallySynchronizedMutex::WriteContext declareContext{_fThisAssertExternallySynchronized};
71 if (not fBody_.has_value ()) {
79 using namespace DataExchange;
82 if (InternetMediaTypeRegistry::sThe->IsA (InternetMediaTypes::kJSON, *oct)) {
83 return Variant::JSON::Reader{}.Read (
GetBody ());
88 return VariantValue{};
93#if USE_NOISY_TRACE_IN_THIS_MODULE_
96 AssertExternallySynchronizedMutex::WriteContext declareContext{_fThisAssertExternallySynchronized};
97 if (fBodyInputStream_ ==
nullptr) {
104 if (optional<uint64_t> cl =
headers ().contentLength ()) {
105 fBodyInputStream_ = InputSubStream::New<byte> (fInputStream_, {}, fInputStream_.
GetOffset () +
static_cast<size_t> (*cl));
119 fBodyInputStream_ = MemoryStream::New<byte> ();
123 return fBodyInputStream_;
128 AssertExternallySynchronizedMutex::ReadContext declareContext{_fThisAssertExternallySynchronized};
Similar to String, but intended to more efficiently construct a String. Mutable type (String is large...
String is like std::u32string, except it is much easier to use, often much more space efficient,...
nonvirtual String SubString(SZ from) const
Simple variant-value (case variant union) object, with (variant) basic types analogous to a value in ...
NOT a real mutex - just a debugging infrastructure support tool so in debug builds can be assured thr...
shared_lock< const AssertExternallySynchronizedMutex > ReadContext
Instantiate AssertExternallySynchronizedMutex::ReadContext to designate an area of code where protect...
nonvirtual String ToString() const
Common::ReadOnlyProperty< const Headers & > headers
Common::ReadOnlyProperty< optional< InternetMediaType > > contentType
Common::Property< String > httpVersion
this represents a HTTP request object for the WebServer module
nonvirtual String ToString() const
nonvirtual Memory::BLOB GetBody()
nonvirtual Streams::InputStream::Ptr< byte > GetBodyStream()
Common::ReadOnlyProperty< bool > keepAliveRequested
mostly looks at Connection: ARG header, but if not there takes into account HTTP-version specific def...
nonvirtual DataExchange::VariantValue GetBodyVariantValue()
void Throw(T &&e2Throw)
identical to builtin C++ 'throw' except that it does helpful, type dependent DbgTrace() messages firs...