mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
Ladybird: Actually add request headers to outgoing HTTP requests
This commit is contained in:
parent
d60f8807e3
commit
9073d60f00
1 changed files with 9 additions and 4 deletions
|
@ -42,6 +42,15 @@ ErrorOr<NonnullRefPtr<RequestManagerQt::Request>> RequestManagerQt::Request::cre
|
|||
|
||||
QNetworkReply* reply = nullptr;
|
||||
|
||||
for (auto& it : request_headers) {
|
||||
// FIXME: We currently strip the Accept-Encoding header on outgoing requests from LibWeb
|
||||
// since otherwise it'll ask for compression without Qt being aware of it.
|
||||
// This is very hackish and I'm sure we can do it in concert with Qt somehow.
|
||||
if (it.key == "Accept-Encoding")
|
||||
continue;
|
||||
request.setRawHeader(QByteArray(it.key.characters()), QByteArray(it.value.characters()));
|
||||
}
|
||||
|
||||
if (method.equals_ignoring_case("head"sv)) {
|
||||
reply = qnam.head(request);
|
||||
} else if (method.equals_ignoring_case("get"sv)) {
|
||||
|
@ -50,10 +59,6 @@ ErrorOr<NonnullRefPtr<RequestManagerQt::Request>> RequestManagerQt::Request::cre
|
|||
reply = qnam.post(request, QByteArray((char const*)request_body.data(), request_body.size()));
|
||||
}
|
||||
|
||||
for (auto& it : request_headers) {
|
||||
request.setRawHeader(it.key.characters(), it.value.characters());
|
||||
}
|
||||
|
||||
return adopt_ref(*new Request(*reply));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue