Skip to content

Commit

Permalink
translation: Comply with HTTP Headers standard allowing case insensit…
Browse files Browse the repository at this point in the history
…ive headers

https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
  • Loading branch information
ljmf00 committed Jun 6, 2021
1 parent 50c8fba commit d053c4b
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit d053c4b

Please sign in to comment.