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.
andreykrasnodar
Posts: 112 Joined: Wed Jul 01, 2020 10:22 am
Post
by andreykrasnodar » Thu Aug 20, 2020 9:36 pm
Code: Select all
procedure TForm1.Chromium2BeforeResourceLoad(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame;
const request: ICefRequest; const callback: ICefRequestCallback;
out Result: TCefReturnValue);
var
map: ICefStringMultimap;
begin
map := TCefStringMultimapOwn.Create;
request.GetHeaderMap(map);
map.Append('referer', 'https://google.com');
map.Append('Accept-Language', 'ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7');
request.SetHeaderMap(map);
end;
Does not send referer but sends Accept_language (and even User-Agent).
But if I type
Code: Select all
for i:=1 to map.Size do
begin
ShowMessage(map.Key[i]+':'+map.Value[i])
end;
I see the last string is
referer:https://google.com
So,
does not send referer. What's the matter?
Last edited by
andreykrasnodar on Fri Aug 21, 2020 9:00 am, edited 2 times in total.
andreykrasnodar
Posts: 112 Joined: Wed Jul 01, 2020 10:22 am
Post
by andreykrasnodar » Fri Aug 21, 2020 7:07 am
I can send referer with
Code: Select all
Header.append('referer', 'https://google.com');
and it works on POST requests. But if you set request method with
Header 'referer' does not appear.
Last edited by
andreykrasnodar on Fri Aug 21, 2020 7:58 pm, edited 1 time in total.
andreykrasnodar
Posts: 112 Joined: Wed Jul 01, 2020 10:22 am
Post
by andreykrasnodar » Fri Aug 21, 2020 7:07 pm
Any ideas?
I think, the problem is in flags or CEF settings. As I remember, some browsers do not send referer.
andreykrasnodar
Posts: 112 Joined: Wed Jul 01, 2020 10:22 am
Post
by andreykrasnodar » Fri Aug 21, 2020 8:32 pm
I found SendReferrer option in new CEF. But there is no in old CEF.
SendReferrer : Set to True if you want to send the 'referer' header.
Yes, I want, help me please
Student
Posts: 73 Joined: Tue Aug 07, 2018 9:20 am
Post
by Student » Fri Aug 21, 2020 9:05 pm
попробуй так
request.SetReferrer(refererurl, REFERRER_POLICY_DEFAULT);
andreykrasnodar
Posts: 112 Joined: Wed Jul 01, 2020 10:22 am
Post
by andreykrasnodar » Sat Aug 22, 2020 8:27 am
Student wrote: Fri Aug 21, 2020 9:05 pm
попробуй так
request.SetReferrer(refererurl, REFERRER_POLICY_DEFAULT);
Undeclared identifier: 'setreferrer'.
Student
Posts: 73 Joined: Tue Aug 07, 2018 9:20 am
Post
by Student » Sat Aug 22, 2020 9:14 am
А по какой причине ты сидишь на таком старье? Есть же компонент OldCEF4Delphi для поддержки winXP и там есть все эти методы которые нужны тебе.
andreykrasnodar
Posts: 112 Joined: Wed Jul 01, 2020 10:22 am
Post
by andreykrasnodar » Sat Aug 22, 2020 10:58 am
Скачал эту версию, написал на ней программу, теперь вылавливаю ошибки. Перейти на более новый OLDCEF4Delphi - значит много переписать кода.
Student
Posts: 73 Joined: Tue Aug 07, 2018 9:20 am
Post
by Student » Sat Aug 22, 2020 11:19 am
Ну смотри сам, а так упрешься все равно в стену, что чего то не будет хватать, то что в старом libcef многое не работает так как надо. А переписать, в чем там сложность? Названия методов другие? Так создай свой класс с нужным названием и через него обращайся к хромиуму.
andreykrasnodar
Posts: 112 Joined: Wed Jul 01, 2020 10:22 am
Post
by andreykrasnodar » Sat Aug 22, 2020 12:03 pm
I hope there is only one setting which allow my program to send referer. If not, I have to re-write it with new CEF.
P.S. What's the last version of CEF which will work on Windows XP?