Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Active sessions problem
#21
(06-26-2019, 09:28 PM)Alexandre Machado Wrote: Do you have some code in OnBrowserCheck event? It is interesting to note that user agent string of browsers are empty which suggests me that you might be creating a TFirefox instance as a fall back maybe?
Yes, not all are Firefox. On the sample I have, most are, though.

Yes, I have code in OnBrowserCheck and you are right, if the browser is TOther creates TFirefox instance:

Code:
if (rBrowser is TOther) then
  begin
    rBrowser.Free;
    // accept the unknown browser as Firefox (probably the best idea)
    rBrowser := TFireFox.Create(TFireFox.MIN_VERSION);
  end

I can comment it out if you think it will help find how those ghost sessions are created.
Reply
#22
Hi Ioan,

I don't recommend you remove it because it will raise an exception. But it would be good if you keep the UserAgent string so we can actually see which was the original browser UA string. I'm inclined to think it is a bot...

Just save the original UA string before freeing the original browser and set it again, after creating a new one, like:

procedure TIWServerController.IWServerControllerBaseBrowserCheck(aSession: TIWApplication; var rBrowser: TBrowser);
var
ua: string;
begin
ua := rBrowser.UserAgent;
rBrowser.Free;
rBrowser := TFirefox.Create(TFireFox.MIN_VERSION);
rBrowser.UserAgent := ua;
end;
Reply
#23
Do you have any content handler registered as a session start handler?
Reply
#24
(06-27-2019, 09:21 AM)Alexandre Machado Wrote: Do you have any content handler registered as a session start handler?

No, I don't

(06-27-2019, 08:57 AM)Alexandre Machado Wrote: Hi Ioan,

I don't recommend you remove it because it will raise an exception. But it would be good if you keep the UserAgent string so we can actually see which was the original browser UA string. I'm inclined to think it is a bot...

Just save the original UA string before freeing the original browser and set it again, after creating a new one, like:

procedure TIWServerController.IWServerControllerBaseBrowserCheck(aSession: TIWApplication; var rBrowser: TBrowser);
var
  ua: string;
begin
  ua := rBrowser.UserAgent;
  rBrowser.Free;
  rBrowser := TFirefox.Create(TFireFox.MIN_VERSION);
  rBrowser.UserAgent := ua;
end;

Done, modified the code to keep the original UserAgent string.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)