From 0dcc126af099315e2b82ac12ef2317a660b72db9 Mon Sep 17 00:00:00 2001 From: zzz Date: Thu, 18 Mar 2021 11:02:26 -0400 Subject: [PATCH] DoH: Minor cleanups Handle lower-case date: header --- core/java/src/net/i2p/util/DNSOverHTTPS.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/java/src/net/i2p/util/DNSOverHTTPS.java b/core/java/src/net/i2p/util/DNSOverHTTPS.java index afc1bf7df..72e1a2d98 100644 --- a/core/java/src/net/i2p/util/DNSOverHTTPS.java +++ b/core/java/src/net/i2p/util/DNSOverHTTPS.java @@ -249,11 +249,12 @@ public class DNSOverHTTPS implements EepGet.StatusListener { */ private String query(String host, Type type, String url) { List toQuery; - if (url != null) + if (url != null) { toQuery = Collections.singletonList(url); - else + } else { toQuery = new ArrayList((type == Type.V6_ONLY) ? v6urls : v4urls); - Collections.shuffle(toQuery); + Collections.shuffle(toQuery); + } final long timeout = System.currentTimeMillis() + OVERALL_TIMEOUT; if (type == Type.V4_ONLY || type == Type.V4_PREFERRED) { // v4 query @@ -444,7 +445,7 @@ public class DNSOverHTTPS implements EepGet.StatusListener { // We do this more than once, because // the first SSL handshake may take a while, and it may take the server // a while to render the index page. - if (gotDate < MAX_DATE_SETS && "Date".equals(key)) { + if (gotDate < MAX_DATE_SETS && "date".equals(key.toLowerCase(Locale.US))) { long timeRcvd = System.currentTimeMillis(); long serverTime = RFC822Date.parse822Date(val); if (serverTime > 0) {