1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

LibGemini: Implement rendering text/gemini documents to HTML

This also sets Content-Type to whatever 'meta' contains on success, to
allow the browser to pick up what the document contains.
This commit is contained in:
AnotherTest 2020-05-16 15:38:13 +04:30 committed by Andreas Kling
parent a4902e0eec
commit 013cb76d77
8 changed files with 424 additions and 1 deletions

View file

@ -40,6 +40,12 @@ GeminiDownload::GeminiDownload(ClientConnection& client, NonnullRefPtr<Gemini::G
if (!response->meta().is_empty()) {
HashMap<String, String, CaseInsensitiveStringTraits> headers;
headers.set("meta", response->meta());
// Note: We're setting content-type to meta only on status==SUCCESS
// we should prehaps have a better mechanism for this, since we
// are already shoehorning the concept of "headers" here
if (response->status() >= 20 && response->status() < 30) {
headers.set("content-type", response->meta());
}
set_response_headers(headers);
}
}