Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

request.GetHeaderMap lacks of many useful data.

Post Reply
michal@dorfin.waw.pl
Posts: 41
Joined: Sun Feb 05, 2017 8:53 am

request.GetHeaderMap lacks of many useful data.

Post 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 ?
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: request.GetHeaderMap lacks of many useful data.

Post 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.
Post Reply