mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:47:34 +00:00
RequestServer+LibProtocol: Allow users to specify a per-request proxy
This commit is contained in:
parent
cd9d740107
commit
45867435c4
16 changed files with 52 additions and 24 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <AK/URL.h>
|
||||
#include <LibCore/AnonymousBuffer.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/Proxy.h>
|
||||
#include <LibIPC/Decoder.h>
|
||||
#include <LibIPC/Dictionary.h>
|
||||
#include <LibIPC/File.h>
|
||||
|
@ -185,4 +186,14 @@ ErrorOr<void> decode(Decoder& decoder, Core::DateTime& datetime)
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> decode(Decoder& decoder, Core::ProxyData& data)
|
||||
{
|
||||
UnderlyingType<decltype(data.type)> type;
|
||||
TRY(decoder.decode(type));
|
||||
data.type = static_cast<Core::ProxyData::Type>(type);
|
||||
TRY(decoder.decode(data.host_ipv4));
|
||||
TRY(decoder.decode(data.port));
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <AK/URL.h>
|
||||
#include <LibCore/AnonymousBuffer.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/Proxy.h>
|
||||
#include <LibIPC/Dictionary.h>
|
||||
#include <LibIPC/Encoder.h>
|
||||
#include <LibIPC/File.h>
|
||||
|
@ -203,4 +204,12 @@ bool encode(Encoder& encoder, Core::DateTime const& datetime)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool encode(Encoder& encoder, Core::ProxyData const& proxy)
|
||||
{
|
||||
encoder << to_underlying(proxy.type);
|
||||
encoder << proxy.host_ipv4;
|
||||
encoder << proxy.port;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue