Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translation: Comply with HTTP Headers standard allowing case insensitive headers #34

Merged
merged 1 commit into from
Jun 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions source/gboardforensics/gatherers/translatecache.d
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private:
import std.json : parseJSON;
import std.string : startsWith;
import std.zlib : UnCompress;
import std.uni : toLower;

import vibe.textfilter.urlencode : urlDecode;
import vibe.inet.url : URL;
Expand All @@ -69,8 +70,10 @@ private:
// get the response base on the enconding
// defaults to plain text
string response;
import std.stdio : writeln;
writeln(lines);
switch (lines
.filter!(s => s.startsWith("Content-Encoding:"))
.filter!(s => s.toLower.startsWith("content-encoding:"))
.front // extract the string from the range
.split // split by white characters
.back // get the last value
Expand Down Expand Up @@ -101,7 +104,7 @@ private:
data.requestURL = lines.front;

data.time = lines
.filter!(s => s.startsWith("Date:"))
.filter!(s => s.toLower.startsWith("date:"))
.front
.findSplitAfter(", ")[1]
.findSplitBefore(" GMT")[0];
Expand Down