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.

Problems with LoadRequest and security settings...

Post Reply
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Problems with LoadRequest and security settings...

Post by andreykrasnodar »

I am trying to open sites sending referer but some sites do not allow me to do.

Code: Select all

procedure example;
var
  Header: ICefStringMultimap;
  Request: ICefRequest;
  Data: ICefPostData;
begin
  Request := TCefRequestRef.New;
  Request.Url := 'https://megogo.ru/ru/mult/year_2019-2020';
  Request.Method := '';
  Header := TCefStringMultimapOwn.Create;
  Header.Append('Referer', 'https://google.com');
  Request.SetHeaderMap(Header);
  Data := TCefPostDataRef.New;
  Request.PostData := Data;
  Chromium2.Browser.MainFrame.LoadRequest(Request);
end;
This site was not opened. Some of them show error 404(not found), some - not allowed, some - authorization required.
I tried to set Request.Method to GET and POST, but nothing changed.
When I try to open them with OpenURL(''); everything is ok.

Please help me. I just want to open sites in new tab sending real referer.
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: Problems with LoadRequest and security settings...

Post by andreykrasnodar »

The problem is in headers. I tried to do this

Code: Select all

  Header.Append('Origin', 'https://megogo.ru');
  Header.Append('sec-fetch-site', 'cross-site');
  Header.Append('sec-fetch-mode', 'navigate');
  Header.Append('sec-fetch-user', '?1');
  Header.Append('sec-fetch-dest', 'document');
And now I see 404 error
User avatar
salvadordf
Posts: 4575
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Problems with LoadRequest and security settings...

Post by salvadordf »

I'm not an expert in that field. I guess you would need to see the server configuration and the server logs to find what's wrong.
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: Problems with LoadRequest and security settings...

Post by andreykrasnodar »

I have found the problem. It cases when server does not recieve GET request.
When you send request with

Code: Select all

  Request.Method := 'POST';
or

Code: Select all

  Request.Method := 'GET';
The request is nill. I am going to create a new topic to describe everything...
dilfich
Posts: 368
Joined: Thu Nov 30, 2017 1:17 am

Re: Problems with LoadRequest and security settings...

Post by dilfich »

Usually you need more cookies, not a naked request, perhaps this is the problem.
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: Problems with LoadRequest and security settings...

Post by andreykrasnodar »

dilfich wrote: Thu Aug 20, 2020 11:47 am Usually you need more cookies, not a naked request, perhaps this is the problem.
What???
Now I know how to send GET request (you should use nil except PostData), but ChromiumOSR is able to send referer and origin headers sending POST request. When I use GET request I am not able to send this headers, but able to send others, like 'Accept-Language'
dilfich
Posts: 368
Joined: Thu Nov 30, 2017 1:17 am

Re: Problems with LoadRequest and security settings...

Post by dilfich »

andreykrasnodar wrote: Thu Aug 20, 2020 3:18 pm What???
Now I know how to send GET request (you should use nil except PostData), but ChromiumOSR is able to send referer and origin headers sending POST request. When I use GET request I am not able to send this headers, but able to send others, like 'Accept-Language'
But as far as I remember not a big Optimo stupid zaparos without cookies enabled\Lok.storage and other things this is not an option, i.e. it is not a browser problem, but your problem, what exactly does not work so it is necessary to study a specific site separately. Watch the sniffer in a normal browser and check 1=1 the same thing, and what exactly does not come out about it already and ask)
//
На сколько помню по не большому опыту тупо запрос без куков\лок.хранилища и прочего это не вариант, т.е. это не проблема браузера, а ваша, что именно делаеш не так это нужно изучать конкретный сайт отдельно. Смотри снифер в обычном браузере и поверяй что бы 1=1 тоже самое, а что именно не выходит про это уже и спрашивай)
Но я всё равно особо не подскажу, по этому это общая инфа. Автор против спама и прочих ботов автоматов, по этому если хочеш получить ответ эваулируй его)
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: Problems with LoadRequest and security settings...

Post by andreykrasnodar »

No spam and bots, I just want to open links in a new tab correctly (sending headers and others).
I have described the problem here viewtopic.php?f=8&t=1469
Post Reply