Page 1 of 1

request.GetHeaderMap lacks of many useful data.

Posted: Wed Jan 31, 2018 3:41 pm
by michal@dorfin.waw.pl
I thought that I know how to read headers of request and response.
I use this code to decode request header:

Code: Select all

      hm:=TCefStringMultimapOwn.Create;
      request.GetHeaderMap(hm as ICefStringMultiMap);
      for i:=0 to (hm as ICefStringMultiMap).Size-1 do
        StringL.Add((hm as ICefStringMultiMap).Key[i]+ '='+(hm as ICefStringMultiMap).Value[i]);
And the result is:

Code: Select all

Accept=application/json, text/plain, */*
User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
X-DevTools-Emulate-Network-Conditions-Client-Id=(B4C420B94748722153342B675B90DC8F)
X-XSRF-TOKEN=a632ca50-4639-494d-937b-26dba61d4e12
abc.lang=pl
But when I check in DevTools the same request header I've got this (for safety reasons id info is changes by me in this post):

Code: Select all

GET /xxx/#/policies/list/?aid=123456 HTTP/1.1
Host: abc.pl
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
x-dtreferer: https://abc.pl/xxx/#/policies/list/?aid=123456
Accept: application/json, text/plain, */*
X-XSRF-TOKEN: ccccccccccc
eagent.lang: pl
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36
Referer: https://abc.pl/xxx/
Accept-Encoding: gzip, deflate, br
Accept-Language: pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: JSESSIONID=xxxxx; XSRF-TOKEN=cccccccc; abc.lang=pl; WID=ggggggggg; dtSa=-; dtLatC=6; dtCookie=ddddddddd; dtPC=eeee
Why GetHeaderMap doesn't contain full header info ? How to read the full request header ?

Re: request.GetHeaderMap lacks of many useful data.

Posted: Wed Jan 31, 2018 5:59 pm
by salvadordf
I've modified the MiniBrowser demo to inspect the request and response headers. Download CEF4Delphi again if you want to take a look.

Some TChromium events seem to include more header information than others. You can try other events with the new MiniBrowser demo but I'm afraid Blink doesn't expose all the headers.