From c98083837de191d12870f9bd3907566846287459 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Fri, 4 Sep 2020 01:17:59 +0100 Subject: [PATCH] Fix for the new server's reply Just when I was about to deploy it they changed the server to return HTTP/2... lol No big deal (I think), fix the http header parser so if the "OK" message string is missing it'll keep parsing. --- sample_responses/ping.txt | 31 +++++++++++++++---------------- src/nap/http_header_parse.cpp | 2 +- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/sample_responses/ping.txt b/sample_responses/ping.txt index 7dff555..e3cecca 100644 --- a/sample_responses/ping.txt +++ b/sample_responses/ping.txt @@ -1,17 +1,16 @@ -HTTP/1.1 200 OK -Date: Mon, 22 Jun 2020 13:16:00 GMT -Content-Type: application/json -Content-Length: 89 -Connection: keep-alive -Set-Cookie: __cfduid=db00b974d1175c5928b2e1378398395291592831760; expires=Wed, 22-Jul-20 13:16:00 GMT; path=/; domain=.originsro.org; HttpOnly; SameSite=Lax -X-RateLimit-Limit: 2 -X-RateLimit-Remaining: 1 -X-RateLimit-Reset: 1592831771 -Retry-After: 10 -CF-Cache-Status: DYNAMIC -cf-request-id: 037dc4f1fe0000074eb9af4200000001 -Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" -Server: cloudflare -CF-RAY: 5a763dc99efa074e-LHR +HTTP/2 200 +date: Fri, 04 Sep 2020 00:08:24 GMT +content-type: application/json +content-length: 89 +set-cookie: __cfduid=d58ca1bc3de8452dca4695f92e7a685171599178104; expires=Sun, 04-Oct-20 00:08:24 GMT; path=/; domain=.originsro.org; HttpOnly; SameSite=Lax +x-ratelimit-limit: 2 +x-ratelimit-remaining: 1 +x-ratelimit-reset: 1599178115 +retry-after: 10 +cf-cache-status: DYNAMIC +cf-request-id: 04f80a74c90000077a3994a200000001 +expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" +server: cloudflare +cf-ray: 5cd379ce0ba9077a-LHR -{"generation_timestamp":"2020-06-22T13:16:00.927871+00:00","message":"pong","version":1} +{"generation_timestamp":"2020-09-04T00:08:24.038003+00:00","message":"pong","version":1} diff --git a/src/nap/http_header_parse.cpp b/src/nap/http_header_parse.cpp index 8000266..3caa47a 100644 --- a/src/nap/http_header_parse.cpp +++ b/src/nap/http_header_parse.cpp @@ -91,7 +91,7 @@ auto const header_entry_def = x3::rule http_header = "http_header"; auto const http_header_def = no_skip[lit("HTTP/") >> raw[+digit >> -(string(".") >> +digit)]] > uint_ > - raw[lexeme[+(char_ - eol)]] > eol >> + -raw[lexeme[+(char_ - eol)]] > eol >> (header_entry % eol) ;