1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:07:45 +00:00

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.
This commit is contained in:
Andreas Kling 2020-05-12 19:07:42 +02:00
parent 413ab652c8
commit 8b8a5fc6c6
5 changed files with 10 additions and 10 deletions

View file

@ -47,7 +47,7 @@ public:
Optional<u32> total_size() const { return m_total_size; }
size_t downloaded_size() const { return m_downloaded_size; }
const ByteBuffer& payload() const { return m_payload; }
const HashMap<String, String>& response_headers() const { return m_response_headers; }
const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers() const { return m_response_headers; }
void stop();
@ -57,7 +57,7 @@ protected:
void did_finish(bool success);
void did_progress(Optional<u32> total_size, u32 downloaded_size);
void set_payload(const ByteBuffer&);
void set_response_headers(const HashMap<String, String>&);
void set_response_headers(const HashMap<String, String, CaseInsensitiveStringTraits>&);
private:
i32 m_id;
@ -65,6 +65,6 @@ private:
Optional<u32> m_total_size {};
size_t m_downloaded_size { 0 };
ByteBuffer m_payload;
HashMap<String, String> m_response_headers;
HashMap<String, String, CaseInsensitiveStringTraits> m_response_headers;
WeakPtr<PSClientConnection> m_client;
};