browser wasm
This commit is contained in:
parent
28fab2509b
commit
e8630528af
24 changed files with 2490 additions and 100 deletions
|
|
@ -130,6 +130,24 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
void ClientHTTP::SendAsync(const HTTPRequest& request,
|
||||
std::function<void(HTTPResponse)> onSuccess,
|
||||
std::function<void(std::string)> onError) {
|
||||
HTTPRequest copy = request;
|
||||
ThreadPool::Enqueue([this, copy = std::move(copy),
|
||||
onSuccess = std::move(onSuccess),
|
||||
onError = std::move(onError)]() mutable {
|
||||
try {
|
||||
HTTPResponse response = this->Send(copy);
|
||||
if (onSuccess) onSuccess(std::move(response));
|
||||
} catch (const std::exception& e) {
|
||||
if (onError) onError(e.what());
|
||||
} catch (...) {
|
||||
if (onError) onError("unknown error");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
HTTPResponse ClientHTTP::Send(const HTTPRequest& request) {
|
||||
QUICStream stream = impl->quic.OpenStream();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue