1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 00:57:43 +00:00

LibWeb: Let Resource figure out its own encoding and MIME type

Also, if the request URL is a data: URL, use the MIME type from the URL
itself if available. This makes it possible to load arbitrary MIME type
data: URLs in the browser :^)
This commit is contained in:
Andreas Kling 2020-06-06 14:02:43 +02:00
parent efe9d36eba
commit f88146c7c9
3 changed files with 53 additions and 46 deletions

View file

@ -72,6 +72,9 @@ public:
void register_client(Badge<ResourceClient>, ResourceClient&);
void unregister_client(Badge<ResourceClient>, ResourceClient&);
const String& encoding() const { return m_encoding; }
const String& mime_type() const { return m_mime_type; }
void for_each_client(Function<void(ResourceClient&)>);
void did_load(Badge<ResourceLoader>, const ByteBuffer& data, const HashMap<String, String, CaseInsensitiveStringTraits>& headers);
@ -87,6 +90,8 @@ private:
bool m_loaded { false };
bool m_failed { false };
String m_error;
String m_encoding;
String m_mime_type;
HashMap<String, String, CaseInsensitiveStringTraits> m_response_headers;
HashTable<ResourceClient*> m_clients;
};