summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-05-12 19:07:42 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-12 19:10:01 +0200
commit8b8a5fc6c6fa8f34e6d2059fb94114473f2e5063 (patch)
tree5920f9f6fc58eeb35afd51a7ffe5b396471085a5 /Libraries
parent413ab652c88a9a5ee025d67ab097e047235b9d09 (diff)
downloadserenity-8b8a5fc6c6fa8f34e6d2059fb94114473f2e5063.zip
LibHTTP+ProtocolServer: Use CaseInsensitiveStringTraits for headers
These are supposed to be interpreted caselessly so let's just use the case insensitive traits throughout. This means we'll understand things like "Content-Length" even when they send "content-length" etc.
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibHTTP/HttpResponse.cpp2
-rw-r--r--Libraries/LibHTTP/HttpResponse.h8
-rw-r--r--Libraries/LibHTTP/Job.h2
3 files changed, 6 insertions, 6 deletions
diff --git a/Libraries/LibHTTP/HttpResponse.cpp b/Libraries/LibHTTP/HttpResponse.cpp
index dc8f6468f4..db5711ff5c 100644
--- a/Libraries/LibHTTP/HttpResponse.cpp
+++ b/Libraries/LibHTTP/HttpResponse.cpp
@@ -28,7 +28,7 @@
namespace HTTP {
-HttpResponse::HttpResponse(int code, HashMap<String, String>&& headers, ByteBuffer&& payload)
+HttpResponse::HttpResponse(int code, HashMap<String, String, CaseInsensitiveStringTraits>&& headers, ByteBuffer&& payload)
: Core::NetworkResponse(move(payload))
, m_code(code)
, m_headers(move(headers))
diff --git a/Libraries/LibHTTP/HttpResponse.h b/Libraries/LibHTTP/HttpResponse.h
index 4f86cbe9e9..f36b98bd13 100644
--- a/Libraries/LibHTTP/HttpResponse.h
+++ b/Libraries/LibHTTP/HttpResponse.h
@@ -35,19 +35,19 @@ namespace HTTP {
class HttpResponse : public Core::NetworkResponse {
public:
virtual ~HttpResponse() override;
- static NonnullRefPtr<HttpResponse> create(int code, HashMap<String, String>&& headers, ByteBuffer&& payload)
+ static NonnullRefPtr<HttpResponse> create(int code, HashMap<String, String, CaseInsensitiveStringTraits>&& headers, ByteBuffer&& payload)
{
return adopt(*new HttpResponse(code, move(headers), move(payload)));
}
int code() const { return m_code; }
- const HashMap<String, String>& headers() const { return m_headers; }
+ const HashMap<String, String, CaseInsensitiveStringTraits>& headers() const { return m_headers; }
private:
- HttpResponse(int code, HashMap<String, String>&&, ByteBuffer&&);
+ HttpResponse(int code, HashMap<String, String, CaseInsensitiveStringTraits>&&, ByteBuffer&&);
int m_code { 0 };
- HashMap<String, String> m_headers;
+ HashMap<String, String, CaseInsensitiveStringTraits> m_headers;
};
}
diff --git a/Libraries/LibHTTP/Job.h b/Libraries/LibHTTP/Job.h
index c441660635..9631dde4ae 100644
--- a/Libraries/LibHTTP/Job.h
+++ b/Libraries/LibHTTP/Job.h
@@ -73,7 +73,7 @@ protected:
HttpRequest m_request;
State m_state { State::InStatus };
int m_code { -1 };
- HashMap<String, String> m_headers;
+ HashMap<String, String, CaseInsensitiveStringTraits> m_headers;
Vector<ByteBuffer> m_received_buffers;
size_t m_received_size { 0 };
bool m_sent_data { 0 };