Re: [twsocket] No response problem [THttpServer - TCustomLineWSocket]

2005-06-20 Thread Christophe

Ok, still with my problem...sorry it's gonna be a little long mail.

Bjørnar wrote:
> It would be interesting to se if the lost requests is happening on
> newly created connections, or maybe only on connections that are used
> a second time (many requests on same connection, http1.1 and
> keepalive).
I checked this and I am pretty sure it happens only on second time 
connections. When I first do a GET or POST, it always works.


This brings me to this:
I tried to find a reproductible case, and it seems I found one, with a 
solution that works (but it is not nice I think). Anyway, here it is:


I have a page called login.htm, that contain a form (action="Login") 
with a text input, a password input, and a submit button. A page 
loginfailed.htm exists and is displayed when the user didn't input the 
correct login/password. In this loginfailed.htm there is a link to go 
back to login.htm so the user can retry.

When I do the following operations, the bug always happens:
- get login.htm >always OK
- leave username and login blank (or input wrong username/password)
- click Submit, post the data >always OK
- get loginfailed.htm >always OK
- click retry, get login.htm >always OK
- repost some data (any username/password) >ALWAYS BUG: no communication 
until timeout. The PostDocument or PostedData functions never execute.


The functions for GetDocument, PostDocument and PostedData are similar 
to the ones of the WebServ example. The password checking (called from 
PostedData, when all the data has been received) does a simple test 
(using AnsiSameText) and:

  if Allowed then
  begin
Body := //a string
Header := //another string
Stream.Write(Header[1], Length(Header));
Stream.Write(Body[1],   Length(Body));
Stream.Seek(0, 0);
Client.DocStream := Stream;
Client.SendStream;
  end
  else
  begin
Client.Document:=HttpServer.DocDir+'\loginfailed.htm';
Client.SendDocument(httpSendDoc);
  end;

Now, as I said, I found a solution, that is to do a 
Client.TriggerSessionClosed(0) after the POST command is handled and the 
answer sent to the client.

For now, it seems to works in 100% of the time, but:
1-Does it sounds you normal to have to use TriggerSessionClosed ?
2-What are the consequences of using TriggerSessionClosed ?
3-Is there something "softer" than closing the session ? I tried 
TriggerHttpRequestDone but it doesn't work.


Thanks for all your help !
Christophe

Francois Piette wrote:

Does it occurs with the sample "WebServ" delivered with ICS ?




Well it seems it doesn't (at least I didn't experienced the problem
yet), which is surprising because my program is quite identical to the
demo (I mean, I implemented some functions but nothing that directly
change the way THttpServer works).



It is likely that you introduced something wrong. Or failed to follow some 
programming rule.

One important thing: never call the message pump, directly or indirectly from 
one of the ICS
component event. You would get all kind of strange results. Be aware that some 
VCL internally call
the message pump, like ShowMessage.

--
[EMAIL PROTECTED]
http://www.overbyte.be





--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] HttpSrv: implementing NTLM

2005-06-20 Thread Maurizio Lotauro
On 19-Jun-05 09:11:21 Francois PIETTE wrote:

>>>Is there someone willing to implement NTLM
>>>authentication into HTTP server component ?
>>
>> If no other has offered yourself I can help you in this but only if
>> you have a documentation how to it should work. Otherwise I have no
>> idea how to start it.

>Well, we have the client side, you participated a lot in that development.

Yes, and now I partially know how the client works internally. But I
never worked on the source of the server, so I should first learn how
it works internally.

>So it should not be too difficult to build the replies the server has to do.

I think that the main problem is to handle automatically all steps of the
authentications. As said, I must first examine and understand how the
component works.
Is there already a similar situation, i.e. the component exchange
automatically more that one request with the client?

>I don't want to peek into Windows user base, just implement the NTLM
>authentication protocol. A simple event to get the usercode/password from
>the application host the server component is enough.

This should be true for authentication in general, not only for NTLM.
I checked (very quickly) the code but I don't understood how it
handle the basic authentication.

Speaking about the NTLM, I don't know if it will be "correct" to
don't use the Windows domain user base. Probably it is the only
reason to use the NTLM instead other authentications.


Bye, Maurizio.


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] 2 questions concerning cookies

2005-06-20 Thread Francois PIETTE
This is a HTML entity encoding. In HTML, you can replace the ampersand 
character by "&". You can do that for a lot of other characters. For 
example ">" is the greather-than sign.


--
[EMAIL PROTECTED]
http://www.overbyte.be


- Original Message - 
From: "Julian S." <[EMAIL PROTECTED]>

To: 
Sent: Monday, June 20, 2005 7:31 PM
Subject: [twsocket] 2 questions concerning cookies


I found an interesting thing. (the case referes to the page where the link 
was: http://blablabla.site.pl/?we=airstriker )
When I choose 'show page source' in IE I find the following url which the 
link refers to:


?we=airstriker&kod=962463

But whenever I save a page on the drive and then edit this page I see that 
the link refers to:


http://blablabla.site.pl/?we=airstriker&kod=361152

What is amp doing here? What is it for? And what is semi-colon doing here? 
I think it's something with php but I searched google and found nothing 
about it;]




--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be




--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] 2 questions concerning cookies

2005-06-20 Thread Julian S.
I found an interesting thing. (the case referes to the page where the link was: 
http://blablabla.site.pl/?we=airstriker )
When I choose 'show page source' in IE I find the following url which the link 
refers to:

?we=airstriker&kod=962463

But whenever I save a page on the drive and then edit this page I see that the 
link refers to:

http://blablabla.site.pl/?we=airstriker&kod=361152

What is amp doing here? What is it for? And what is semi-colon doing here? I 
think it's something with php but I searched google and found nothing about it;]



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Is a 'reference' property used to change a refererheader?

2005-06-20 Thread Francois Piette
> Is a 'reference' property in ICS used to change a referer header?
> If not is there a way to do it using ICS?

THttpCli.Reference is what you are looking for.

--
Contribute to the SSL Effort. Visit
http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be



-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Is a 'reference' property used to change a referer header?

2005-06-20 Thread Julian S.
Is a 'reference' property in ICS used to change a referer header?

If not is there a way to do it using ICS?



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


RE: [twsocket] No response problem [THttpServer - TCustomLineWSocket]

2005-06-20 Thread Bjørnar Nielsen

> Yes, as I explained in my last mail, when a user makes a 
> request (GET or 
> POST or HEAD or whatever), the server get it, and start to analyze it 
> but stops inside TCustomLineWSocket.TriggerDataAvailable.

Ok, I missed that part, my previos message does not explain your problem.

In PostedData-event, be sure to call PostedDataReceived on the
client-connection (linemode is set to true and FState is set to hcRequest).
This will enable the client to receive more requests on same connection (if
http1.1 and keepalive).

It would be interesting to se if the lost requests is happening on newly
created connections, or maybe only on connections that are used a second
time (many requests on same connection, http1.1 and keepalive).


Regards Bjørnar



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] No response problem [THttpServer - TCustomLineWSocket]

2005-06-20 Thread Francois Piette
> > Does it occurs with the sample "WebServ" delivered with ICS ?

> Well it seems it doesn't (at least I didn't experienced the problem
> yet), which is surprising because my program is quite identical to the
> demo (I mean, I implemented some functions but nothing that directly
> change the way THttpServer works).

It is likely that you introduced something wrong. Or failed to follow some 
programming rule.

One important thing: never call the message pump, directly or indirectly from 
one of the ICS
component event. You would get all kind of strange results. Be aware that some 
VCL internally call
the message pump, like ShowMessage.

--
[EMAIL PROTECTED]
http://www.overbyte.be


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] No response problem [THttpServer - TCustomLineWSocket]

2005-06-20 Thread Christophe

Francois Piette wrote:

The first important thing is: Are you using the very latest ICS version 
downloaded from my website ?


Yes, I re-installed the last version this morning.



When users clicks links or post forms in their browsers, sometimes they 
don't get any answer. By debugging the server I realized that in such a 
case the OnPostDocument event is never triggered.



Do you have a reproductible case ?

>
No and that's my main problem. I tested this morning, it was awful (like 
25% of connections "lost", on two different PCs. But now I'm trying 
again and it works better (I didn't change anything to the program since 
this morning, but now I only get very few connections loss).
Also, this morning I talked about the OnPostDocument event because at 
that time, nearly only POST commands had a problem. Now the post 
commands work totally fine, and the few errors concern basic GET commands.



Does it occurs with the sample "WebServ" delivered with ICS ?
Well it seems it doesn't (at least I didn't experienced the problem 
yet), which is surprising because my program is quite identical to the 
demo (I mean, I implemented some functions but nothing that directly 
change the way THttpServer works).




--
[EMAIL PROTECTED]
http://www.overbyte.be


- Original Message - 
From: "Christophe" <[EMAIL PROTECTED]>

To: 
Sent: Monday, June 20, 2005 4:01 AM
Subject: [twsocket] No response problem [THttpServer - TCustomLineWSocket]




Hi,

First of all, I'd like to apologize if my question is inapropriate, it 
is the first time I am using a mailing list (I usually use php based 
forums for development issues).


I searched a lot about the following problem, but I still don't have a 
clue of what's happening:


I have been developping few applications that use the THttpServer 
component. I noticed that sometimes (randomly), the server gives no 
answer to clients.
When users clicks links or post forms in their browsers, sometimes they 
don't get any answer. By debugging the server I realized that in such a 
case the OnPostDocument event is never triggered.


I checked the call stack at that time, and it seems the problem is in 
TCustomLineWSocket.TriggerDataAvailable (Unit WSocket). At the beginning 
of this function there is the following test:

if (not FLineMode) or (Length(FLineEnd) = 0) or (FSocksState <> socksData)
then begin
  Result := inherited TriggerDataAvailable(Error);
  Exit;
end;

I placed breakpoints and I am pretty sure that if FLineMode is false, 
then there is no problem (the component will continue and send back data 
to the client).
If FLineMode is false, the component will stop here (after the Exit), 
and will never send anything back to the client browsers (they wait, 
and, after a while, they fail because of a timeout).


It brings 2 questions:
- For the same link (GET) or form (POST), why does sometimes FlineMode 
is true and sometimes false ?
- How to force FLineMode to be true, or more generally how to solve such 
a problem. (I tried to do a (Client as THTTPConnection).LineMode:=true 
in the OnClientConnect event but it doesn't change a thing).


PS: It is the first time I checked ICS source, so my analysis of the 
problem is maybe totally wrong.
PS2: I tested this on two different PCs with WindowsXP (no firewall, no 
antivirus) on a LAN. I re-downloaded ICS today to be sure, but the 
problem is still there.


Thank you,
Christophe

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be







--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] No response problem [THttpServer - TCustomLineWSocket]

2005-06-20 Thread Christophe

Bjørnar Nielsen wrote:
When users clicks links or post forms in their browsers, 
sometimes they don't get any answer. By debugging the server 
I realized that in such a case the OnPostDocument event is 
never triggered.



Are you sure the request you don't get an answer from is received on the
server?

Yes, as I explained in my last mail, when a user makes a request (GET or 
POST or HEAD or whatever), the server get it, and start to analyze it 
but stops inside TCustomLineWSocket.TriggerDataAvailable.



When you run a server on a non-server-platform you might miss some requests
when many requests arrive at the same time. On a non-server-platform (w2000,
XP etc) there is a listen backlog set to 5. That means that 5 connects is
queued by the os if your server is not ready to accept the connection yet.
The sixth connection will be lost. On a server-platform (w2000 server, w2003
server etc), this backlog is set to 200.

>
Well I can understand that, except that this problem occurs even when I 
do debugging (which means only one client, on the local machine). Also, 
I checked in the MS event manager (I guess if windows drops some 
connections it would place an entry here), but I found nothing.




Regards
Bjørnar






--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] No response problem [THttpServer - TCustomLineWSocket]

2005-06-20 Thread Wilfried Mestdagh
Hello Christophe,

> - How to force FLineMode to be true, or more generally how to solve such
> a problem. (I tried to do a (Client as THTTPConnection).LineMode:=true
> in the OnClientConnect event but it doesn't change a thing).

In OnPostDocument you have to set LineMode to False (since binary data
can be posted), and when data posting is complete you have to set
LineMode of that data socket back to true.

---
Rgds, Wilfried
http://www.mestdagh.biz


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] 2 questions concerning cookies

2005-06-20 Thread Francois Piette
I think all answers are at http://wp.netscape.com/newsref/std/cookie_spec.html

--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be

- Original Message - 
From: "Julian S." <[EMAIL PROTECTED]>
To: 
Sent: Sunday, June 19, 2005 9:53 PM
Subject: [twsocket] 2 questions concerning cookies


> Firstly thx for your last answer - helped a lot.
> I am using an event "OnCookie" to grab a cookie from the site I mentioned 
> earlier
(http://blablabla.site.pl/?we=airstriker ). I am getting something like this:
>
> cookie_kod=773321
>
> The problem is that when I am using different software (webfetch) I am 
> geeting a cookie like this:
>
> cookie_kod=773321; domain=blablabla.site.pl; path=/
>
> The problem is that when I am using the first cookie I get no result.
> So my question is: should the cookie look like the second one? And if so what 
> is the way (in ICS)
to get it all look like this?
> And the second question: Should I change something in the cookie I want to 
> pass later to the
server? For example should I change path=/ to 
path=http://blablabla.site.pl/?we=airstriker or maybe
to something else?
> And the third question: Should I change cookie_kod to kod ? Because when 
> clicking the URL (I
mentioned about it in the earlier post) using IE it opens
http://blablabla.site.pl/?we=airstriker&kod=773321 and not:
http://blablabla.site.pl/?we=airstriker&cookie_kod=773321
>
> Thx for any help!
> Regards,
> Airstriker
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] No response problem [THttpServer - TCustomLineWSocket]

2005-06-20 Thread Francois Piette
The first important thing is: Are you using the very latest ICS version 
downloaded from my website ?

> When users clicks links or post forms in their browsers, sometimes they 
> don't get any answer. By debugging the server I realized that in such a 
> case the OnPostDocument event is never triggered.

Do you have a reproductible case ?
Does it occurs with the sample "WebServ" delivered with ICS ?

--
[EMAIL PROTECTED]
http://www.overbyte.be


- Original Message - 
From: "Christophe" <[EMAIL PROTECTED]>
To: 
Sent: Monday, June 20, 2005 4:01 AM
Subject: [twsocket] No response problem [THttpServer - TCustomLineWSocket]


> Hi,
> 
> First of all, I'd like to apologize if my question is inapropriate, it 
> is the first time I am using a mailing list (I usually use php based 
> forums for development issues).
> 
> I searched a lot about the following problem, but I still don't have a 
> clue of what's happening:
> 
> I have been developping few applications that use the THttpServer 
> component. I noticed that sometimes (randomly), the server gives no 
> answer to clients.
> When users clicks links or post forms in their browsers, sometimes they 
> don't get any answer. By debugging the server I realized that in such a 
> case the OnPostDocument event is never triggered.
> 
> I checked the call stack at that time, and it seems the problem is in 
> TCustomLineWSocket.TriggerDataAvailable (Unit WSocket). At the beginning 
> of this function there is the following test:
> if (not FLineMode) or (Length(FLineEnd) = 0) or (FSocksState <> socksData)
> then begin
>Result := inherited TriggerDataAvailable(Error);
>Exit;
> end;
> 
> I placed breakpoints and I am pretty sure that if FLineMode is false, 
> then there is no problem (the component will continue and send back data 
> to the client).
> If FLineMode is false, the component will stop here (after the Exit), 
> and will never send anything back to the client browsers (they wait, 
> and, after a while, they fail because of a timeout).
> 
> It brings 2 questions:
> - For the same link (GET) or form (POST), why does sometimes FlineMode 
> is true and sometimes false ?
> - How to force FLineMode to be true, or more generally how to solve such 
> a problem. (I tried to do a (Client as THTTPConnection).LineMode:=true 
> in the OnClientConnect event but it doesn't change a thing).
> 
> PS: It is the first time I checked ICS source, so my analysis of the 
> problem is maybe totally wrong.
> PS2: I tested this on two different PCs with WindowsXP (no firewall, no 
> antivirus) on a LAN. I re-downloaded ICS today to be sure, but the 
> problem is still there.
> 
> Thank you,
> Christophe
> 
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
> 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


RE: [twsocket] No response problem [THttpServer - TCustomLineWSocket]

2005-06-20 Thread Bjørnar Nielsen
> When users clicks links or post forms in their browsers, 
> sometimes they don't get any answer. By debugging the server 
> I realized that in such a case the OnPostDocument event is 
> never triggered.

Are you sure the request you don't get an answer from is received on the
server?

When you run a server on a non-server-platform you might miss some requests
when many requests arrive at the same time. On a non-server-platform (w2000,
XP etc) there is a listen backlog set to 5. That means that 5 connects is
queued by the os if your server is not ready to accept the connection yet.
The sixth connection will be lost. On a server-platform (w2000 server, w2003
server etc), this backlog is set to 200.

Regards
Bjørnar



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be