Re: [twsocket] HttpCli problem

2006-02-26 Thread Francois PIETTE
 Thank you for the feedback, Francois and Wilfried.  I have not been clear 
 in
 my explination.  Let me start again with more detail:

Before I answer more, probably for nothing, please answer the questions I 
asked in my previous mail:

 There is no reason to call Abort from OnRequestDone
 which is the time when the request is... done !
 Why do you think you need to call Abort from OnRequestDone ?

This is really important you answer the questions.
Giving details on what you see in your program is not relevant until I 
understand what you want to do. You have to explain at a much higher level 
than giving details about status code.
State variable is just for information. You_must_ use the events. You can't 
poll the state and do whatever you want. Operations has to be done from the 
events or _after_ OnRequestDone event. Abort can be called at anytime, 
outside of any event and the result is unpredictable except the fact that 
the current operation will be aborted or course.

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


- Original Message - 
From: Ronny [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Sunday, February 26, 2006 12:24 AM
Subject: Re: [twsocket] HttpCli problem


 Thank you for the feedback, Francois and Wilfried.  I have not been clear 
 in
 my explination.  Let me start again with more detail:

 State: httpReady
 I call  httpcli.GetASync.
 State: httpDnsLookup

 ( on HeaderEnd)
 State: httpWaitingHeader   StatusCode: 302
 I call httpcli.About
 State: httpReady

 (OnRequestDone)
 State: httpDNSLookup

 Nothing is done between OnHeaderEnd and OnRequestDone, so I assume that
 httpcli is looking for the redirect. (This only happens with a 302
 StatusCode, with a 200 Statuscode, OnRequestDone state is httpReady).

 If this is a 'Feature' and not a bug, then can I Abort again in the
 OnRequestDone?  Or what do you recommend?  I do not think that the second
 DNSLookup will provide me with any useful information, even if it is a
 redirect, I wouldn't know how to use it, so I might as well cancel it and
 try to get the next file.


 - Original Message - 
 From: Francois PIETTE [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 1:12 PM
 Subject: Re: [twsocket] HttpCli problem


 Why use a loop ?
 Why don't you want to use OnRequestDone event ?

 That is the problem. This routine is called from OnRequestDone.  That is
 why
 I think that there is a bug.  OnRequestDone gets called twice for 302s,
 but
 I have already taken that into account.
 Should httpcli.State = httpReady when OnRequestDone is called?   If so,
 this
 is not the case with 302.

 There is no reason to call Abort from OnRequestDone which is the time 
 when
 the request is... done !
 Why do you think you need to call Abort from OnRequestDone ?
 I you really have a good reason (I like to hear it), then PostMessage a
 custom message and then exit. Then from the corresponding event handler,
 call Abort.

 --
 Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
 --
 [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

 -- 
 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] HttpCli problem

2006-02-26 Thread Ronny
Computers are not my strength, so I am trying my best to speak in your 
language.

 There is no reason to call Abort from OnRequestDone
 which is the time when the request is... done !
 Why do you think you need to call Abort from OnRequestDone ?

I do NOT want to call Abort from OnRequestDone.  It is called from 
OnHeaderEnd.


 This is really important you answer the questions.
 Giving details on what you see in your program is not relevant until I
 understand what you want to do. You have to explain at a much higher level
 than giving details about status code.
 State variable is just for information. You_must_ use the events. You 
 can't
 poll the state and do whatever you want. Operations has to be done from 
 the
 events or _after_ OnRequestDone event. Abort can be called at anytime,
 outside of any event and the result is unpredictable except the fact that
 the current operation will be aborted or course.

Here is how I handle events:

Objective, to download several files, very similar to the Httpasy demo:
On GoButton.Click:  HttpCli.GetASync
OnHeaderEnd:  Check if the file to be downloaded is good.  If not, ABORT.
OnRequestDone: If ABORT, then clear the file, if not store the downloaded 
file.  Then get the next file.

The problem is that IF the statuscode is 302 and I Abort, then I cannot get 
the next file because the component is busy. (httpDNSLookup).
I have solved this problem by having the first line in OnRequestDone check 
the status, and only execute the routine if it is httpReady.
(i.e.
Procedure OnRequestDone
begin
if httpcli.state = httpReady then
  begin
  the rest of the OnRequestDone code;
  end;
end;
)
My question is:  Is there a bug in the component, or is there a better 
method of doing this?


- Original Message - 
From: Francois PIETTE [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Sunday, February 26, 2006 6:21 AM
Subject: Re: [twsocket] HttpCli problem


 Thank you for the feedback, Francois and Wilfried.  I have not been clear
 in
 my explination.  Let me start again with more detail:

 Before I answer more, probably for nothing, please answer the questions I
 asked in my previous mail:




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


 - Original Message - 
 From: Ronny [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Sunday, February 26, 2006 12:24 AM
 Subject: Re: [twsocket] HttpCli problem


 Thank you for the feedback, Francois and Wilfried.  I have not been clear
 in
 my explination.  Let me start again with more detail:

 State: httpReady
 I call  httpcli.GetASync.
 State: httpDnsLookup

 ( on HeaderEnd)
 State: httpWaitingHeader   StatusCode: 302
 I call httpcli.About
 State: httpReady

 (OnRequestDone)
 State: httpDNSLookup

 Nothing is done between OnHeaderEnd and OnRequestDone, so I assume that
 httpcli is looking for the redirect. (This only happens with a 302
 StatusCode, with a 200 Statuscode, OnRequestDone state is httpReady).

 If this is a 'Feature' and not a bug, then can I Abort again in the
 OnRequestDone?  Or what do you recommend?  I do not think that the second
 DNSLookup will provide me with any useful information, even if it is a
 redirect, I wouldn't know how to use it, so I might as well cancel it and
 try to get the next file.


 - Original Message - 
 From: Francois PIETTE [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 1:12 PM
 Subject: Re: [twsocket] HttpCli problem


 Why use a loop ?
 Why don't you want to use OnRequestDone event ?

 That is the problem. This routine is called from OnRequestDone.  That 
 is
 why
 I think that there is a bug.  OnRequestDone gets called twice for 302s,
 but
 I have already taken that into account.
 Should httpcli.State = httpReady when OnRequestDone is called?   If so,
 this
 is not the case with 302.

 There is no reason to call Abort from OnRequestDone which is the time
 when
 the request is... done !
 Why do you think you need to call Abort from OnRequestDone ?
 I you really have a good reason (I like to hear it), then PostMessage a
 custom message and then exit. Then from the corresponding event handler,
 call Abort.

 --
 Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
 --
 [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

 -- 
 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 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo

Re: [twsocket] HttpCli problem

2006-02-26 Thread Francois PIETTE

 Here is how I handle events:

 Objective, to download several files, very similar to the Httpasy demo:
 On GoButton.Click:  HttpCli.GetASync
 OnHeaderEnd:  Check if the file to be downloaded is good.  If not, ABORT.
 OnRequestDone: If ABORT, then clear the file, if not store the downloaded
 file.  Then get the next file.

Ah ! That's better explanation.
From the OnHeaderEnd, set a flag to remember the file is not good and then 
use PostMessage with a cutom message. From the event handler, call Abort if 
OnRequestDone has not been called already. From the OnRequestDone event, 
check your flag to know if the file is OK or not and process accordingly. 
Ignore any error condition if the flag is set because Abort has been called.

It is always better to use PostMessage to defer any processing out of any 
event handler. At the time an custom message is handled, the component is 
out of his own work. If you put the processing in the event handler and this 
processing involve the component itself, then it is likely you'll have 
problems because when the event handler is returns, the component continue 
what it has started and which maybe the wrong thing if you changed the 
instructions ! Of course it the processing doesnt' involve the component 
itself, there is no problem.

 The problem is that IF the statuscode is 302 and I Abort, then I cannot 
 get
 the next file because the component is busy. (httpDNSLookup).

You can turn followRelocation to false and handle the relocation yourself 
if this problem still happend with the change I outlined above.

 My question is:  Is there a bug in the component, or is there a better
 method of doing this?

No bug that I'm aware. Follow the outline I gave above.

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[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] HttpCli problem

2006-02-26 Thread Ronny
Thank you, these are just the answers that I need!
-Ronny

- Original Message - 
From: Francois PIETTE [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Sunday, February 26, 2006 11:51 AM
Subject: Re: [twsocket] HttpCli problem



 Here is how I handle events:

 Objective, to download several files, very similar to the Httpasy demo:
 On GoButton.Click:  HttpCli.GetASync
 OnHeaderEnd:  Check if the file to be downloaded is good.  If not, ABORT.
 OnRequestDone: If ABORT, then clear the file, if not store the downloaded
 file.  Then get the next file.

 Ah ! That's better explanation.
From the OnHeaderEnd, set a flag to remember the file is not good and then
 use PostMessage with a cutom message. From the event handler, call Abort 
 if
 OnRequestDone has not been called already. From the OnRequestDone event,
 check your flag to know if the file is OK or not and process accordingly.
 Ignore any error condition if the flag is set because Abort has been 
 called.

 It is always better to use PostMessage to defer any processing out of any
 event handler. At the time an custom message is handled, the component is
 out of his own work. If you put the processing in the event handler and 
 this
 processing involve the component itself, then it is likely you'll have
 problems because when the event handler is returns, the component continue
 what it has started and which maybe the wrong thing if you changed the
 instructions ! Of course it the processing doesnt' involve the component
 itself, there is no problem.

 The problem is that IF the statuscode is 302 and I Abort, then I cannot
 get
 the next file because the component is busy. (httpDNSLookup).

 You can turn followRelocation to false and handle the relocation 
 yourself
 if this problem still happend with the change I outlined above.

 My question is:  Is there a bug in the component, or is there a better
 method of doing this?

 No bug that I'm aware. Follow the outline I gave above.

 --
 Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
 --
 [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 

-- 
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] HttpCli problem

2006-02-25 Thread Francois PIETTE
 After httpcli.abort is called, the statuscode is normally 404 if the
 statuscode before the call is 200.  The statuscode is 0 if the original
 statuscode is 302.  This is causing me problems (i.e. httpcli state is not
 ready after an abort is called if the statuscode was 302).  See example:

  log.Lines.Add(inttostr(httpcli.StatusCode);
  httpcli.abort;
  log.Lines.Add(inttostr(httpcli.StatusCode);

 D7, ICS V6 beta V1.91

StatusCode value is valid only when or after OnRequestDone has been 
triggered.
Anyway, if you abort, you obviously know what you are doing. No need to rely 
on StatusCode.

--
[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] HttpCli problem

2006-02-25 Thread Ronny
The problem is that the STATE is not ready after the abort, so when I use 
httpcli to grab another file after a 302, I would get an error. (http 
component busy, I think).
After an abort in such a case, is there anything that I have to do to make 
sure that the component is ready for the next use?
(This only happens after a 302, anything else (200, 404, etc) works well.)
-Ronny

- Original Message - 
From: Francois PIETTE [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Saturday, February 25, 2006 3:59 AM
Subject: Re: [twsocket] HttpCli problem


 After httpcli.abort is called, the statuscode is normally 404 if the
 statuscode before the call is 200.  The statuscode is 0 if the original
 statuscode is 302.  This is causing me problems (i.e. httpcli state is 
 not
 ready after an abort is called if the statuscode was 302).  See example:

  log.Lines.Add(inttostr(httpcli.StatusCode);
  httpcli.abort;
  log.Lines.Add(inttostr(httpcli.StatusCode);

 D7, ICS V6 beta V1.91

 StatusCode value is valid only when or after OnRequestDone has been
 triggered.
 Anyway, if you abort, you obviously know what you are doing. No need to 
 rely
 on StatusCode.

 --
 [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 

-- 
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] HttpCli problem

2006-02-25 Thread Ronny
I did find a work-around, but it is not pretty:

while httpcli.State  httpready do
  begin
  a:=a+1;
  log.Lines.add('Waiting '+inttostr(a));
  application.ProcessMessages;
  end;

This is only needed after a 302.  The counter ranges from 400-1000 before 
the state turns to httpready.  And I am not sure that they are real 302s. 
The same pages give a statuscode of 302 consistently when downloaded in the 
same order, but may give a 200 if downloaded in a different order.  Could a 
bug in my program make httpcli give a fake 302 statuscode?
(The above code gives an infinite loop if application.processmessages is 
removed)


- Original Message - 
From: Ronny [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Saturday, February 25, 2006 10:08 AM
Subject: Re: [twsocket] HttpCli problem


 The problem is that the STATE is not ready after the abort, so when I use
 httpcli to grab another file after a 302, I would get an error. (http
 component busy, I think).
 After an abort in such a case, is there anything that I have to do to make
 sure that the component is ready for the next use?
 (This only happens after a 302, anything else (200, 404, etc) works well.)
 -Ronny

 - Original Message - 
 From: Francois PIETTE [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 3:59 AM
 Subject: Re: [twsocket] HttpCli problem


 After httpcli.abort is called, the statuscode is normally 404 if the
 statuscode before the call is 200.  The statuscode is 0 if the original
 statuscode is 302.  This is causing me problems (i.e. httpcli state is
 not
 ready after an abort is called if the statuscode was 302).  See example:

  log.Lines.Add(inttostr(httpcli.StatusCode);
  httpcli.abort;
  log.Lines.Add(inttostr(httpcli.StatusCode);

 D7, ICS V6 beta V1.91

 StatusCode value is valid only when or after OnRequestDone has been
 triggered.
 Anyway, if you abort, you obviously know what you are doing. No need to
 rely
 on StatusCode.

 --
 [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

 -- 
 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] HttpCli problem

2006-02-25 Thread Wilfried Mestdagh
Hello Ronny,

 The problem is that the STATE is not ready after the abort

Do you also mean that OnRequestDone is not fired after Abort ? Because
normally this is the place to check if component is ready, and when it
is then take next action.

If this is the case then I assume state will be ready immediatly after
abort. So you can take the next action probably in a custom message
handler.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Saturday, February 25, 2006, 16:08, Ronny wrote:

 The problem is that the STATE is not ready after the abort, so when I use
 httpcli to grab another file after a 302, I would get an error. (http 
 component busy, I think).
 After an abort in such a case, is there anything that I have to do to make
 sure that the component is ready for the next use?
 (This only happens after a 302, anything else (200, 404, etc) works well.)
 -Ronny

 - Original Message - 
 From: Francois PIETTE [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 3:59 AM
 Subject: Re: [twsocket] HttpCli problem


 After httpcli.abort is called, the statuscode is normally 404 if the
 statuscode before the call is 200.  The statuscode is 0 if the original
 statuscode is 302.  This is causing me problems (i.e. httpcli state is
 not
 ready after an abort is called if the statuscode was 302).  See example:

  log.Lines.Add(inttostr(httpcli.StatusCode);
  httpcli.abort;
  log.Lines.Add(inttostr(httpcli.StatusCode);

 D7, ICS V6 beta V1.91

 StatusCode value is valid only when or after OnRequestDone has been
 triggered.
 Anyway, if you abort, you obviously know what you are doing. No need to
 rely
 on StatusCode.

 --
 [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 


-- 
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] HttpCli problem

2006-02-25 Thread Francois PIETTE
 The problem is that the STATE is not ready after the abort, so when I use
 httpcli to grab another file after a 302, I would get an error. (http
 component busy, I think).
 After an abort in such a case, is there anything that I have to do to make
 sure that the component is ready for the next use?
 (This only happens after a 302, anything else (200, 404, etc) works well.)

Use the OnRequestDone event which is triggered if you abort while an 
operation was already started (the componentis busy).
--
[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] HttpCli problem

2006-02-25 Thread Francois PIETTE
Why use a loop ?
Why don't you want to use OnRequestDone event ?
--
[EMAIL PROTECTED]
http://www.overbyte.be

- Original Message - 
From: Ronny [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Saturday, February 25, 2006 4:57 PM
Subject: Re: [twsocket] HttpCli problem


I did find a work-around, but it is not pretty:

 while httpcli.State  httpready do
  begin
  a:=a+1;
  log.Lines.add('Waiting '+inttostr(a));
  application.ProcessMessages;
  end;

 This is only needed after a 302.  The counter ranges from 400-1000 before
 the state turns to httpready.  And I am not sure that they are real 302s.
 The same pages give a statuscode of 302 consistently when downloaded in 
 the
 same order, but may give a 200 if downloaded in a different order.  Could 
 a
 bug in my program make httpcli give a fake 302 statuscode?
 (The above code gives an infinite loop if application.processmessages is
 removed)


 - Original Message - 
 From: Ronny [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 10:08 AM
 Subject: Re: [twsocket] HttpCli problem


 The problem is that the STATE is not ready after the abort, so when I use
 httpcli to grab another file after a 302, I would get an error. (http
 component busy, I think).
 After an abort in such a case, is there anything that I have to do to 
 make
 sure that the component is ready for the next use?
 (This only happens after a 302, anything else (200, 404, etc) works 
 well.)
 -Ronny

 - Original Message - 
 From: Francois PIETTE [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 3:59 AM
 Subject: Re: [twsocket] HttpCli problem


 After httpcli.abort is called, the statuscode is normally 404 if the
 statuscode before the call is 200.  The statuscode is 0 if the original
 statuscode is 302.  This is causing me problems (i.e. httpcli state is
 not
 ready after an abort is called if the statuscode was 302).  See 
 example:

  log.Lines.Add(inttostr(httpcli.StatusCode);
  httpcli.abort;
  log.Lines.Add(inttostr(httpcli.StatusCode);

 D7, ICS V6 beta V1.91

 StatusCode value is valid only when or after OnRequestDone has been
 triggered.
 Anyway, if you abort, you obviously know what you are doing. No need to
 rely
 on StatusCode.

 --
 [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

 -- 
 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 

-- 
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] HttpCli problem

2006-02-25 Thread Ronny
That is the problem. This routine is called from OnRequestDone.  That is why 
I think that there is a bug.  OnRequestDone gets called twice for 302s, but 
I have already taken that into account.
Should httpcli.State = httpReady when OnRequestDone is called?   If so, this 
is not the case with 302.


- Original Message - 
From: Francois PIETTE [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Saturday, February 25, 2006 11:22 AM
Subject: Re: [twsocket] HttpCli problem


 Why use a loop ?
 Why don't you want to use OnRequestDone event ?
 --
 [EMAIL PROTECTED]
 http://www.overbyte.be

 - Original Message - 
 From: Ronny [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 4:57 PM
 Subject: Re: [twsocket] HttpCli problem


I did find a work-around, but it is not pretty:

 while httpcli.State  httpready do
  begin
  a:=a+1;
  log.Lines.add('Waiting '+inttostr(a));
  application.ProcessMessages;
  end;

 This is only needed after a 302.  The counter ranges from 400-1000 before
 the state turns to httpready.  And I am not sure that they are real 302s.
 The same pages give a statuscode of 302 consistently when downloaded in
 the
 same order, but may give a 200 if downloaded in a different order.  Could
 a
 bug in my program make httpcli give a fake 302 statuscode?
 (The above code gives an infinite loop if application.processmessages is
 removed)


 - Original Message - 
 From: Ronny [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 10:08 AM
 Subject: Re: [twsocket] HttpCli problem


 The problem is that the STATE is not ready after the abort, so when I 
 use
 httpcli to grab another file after a 302, I would get an error. (http
 component busy, I think).
 After an abort in such a case, is there anything that I have to do to
 make
 sure that the component is ready for the next use?
 (This only happens after a 302, anything else (200, 404, etc) works
 well.)
 -Ronny

 - Original Message - 
 From: Francois PIETTE [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 3:59 AM
 Subject: Re: [twsocket] HttpCli problem


 After httpcli.abort is called, the statuscode is normally 404 if the
 statuscode before the call is 200.  The statuscode is 0 if the 
 original
 statuscode is 302.  This is causing me problems (i.e. httpcli state is
 not
 ready after an abort is called if the statuscode was 302).  See
 example:

  log.Lines.Add(inttostr(httpcli.StatusCode);
  httpcli.abort;
  log.Lines.Add(inttostr(httpcli.StatusCode);

 D7, ICS V6 beta V1.91

 StatusCode value is valid only when or after OnRequestDone has been
 triggered.
 Anyway, if you abort, you obviously know what you are doing. No need to
 rely
 on StatusCode.

 --
 [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

 -- 
 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

 -- 
 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] HttpCli problem

2006-02-25 Thread Francois PIETTE
 Why use a loop ?
 Why don't you want to use OnRequestDone event ?

 That is the problem. This routine is called from OnRequestDone.  That is 
 why
 I think that there is a bug.  OnRequestDone gets called twice for 302s, 
 but
 I have already taken that into account.
 Should httpcli.State = httpReady when OnRequestDone is called?   If so, 
 this
 is not the case with 302.

There is no reason to call Abort from OnRequestDone which is the time when 
the request is... done !
Why do you think you need to call Abort from OnRequestDone ?
I you really have a good reason (I like to hear it), then PostMessage a 
custom message and then exit. Then from the corresponding event handler, 
call Abort.

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[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] HttpCli problem

2006-02-25 Thread Wilfried Mestdagh
Hello Ronny,

 Should httpcli.State = httpReady when OnRequestDone is called?   If so, this
 is not the case with 302.

No becase OnRequestDone is called in different states. You have to put
there a case statement. And when state is httpREady then you do next
grab.

But you where talking of Aboft metht in another mail. I think
OnReqeustdone is also called when you call Abort if state is not yet
httpReady.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Saturday, February 25, 2006, 17:46, Ronny wrote:

 That is the problem. This routine is called from OnRequestDone.  That is why
 I think that there is a bug.  OnRequestDone gets called twice for 302s, but
 I have already taken that into account.
 Should httpcli.State = httpReady when OnRequestDone is called?   If so, this
 is not the case with 302.


 - Original Message - 
 From: Francois PIETTE [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 11:22 AM
 Subject: Re: [twsocket] HttpCli problem


 Why use a loop ?
 Why don't you want to use OnRequestDone event ?
 --
 [EMAIL PROTECTED]
 http://www.overbyte.be

 - Original Message - 
 From: Ronny [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 4:57 PM
 Subject: Re: [twsocket] HttpCli problem


I did find a work-around, but it is not pretty:

 while httpcli.State  httpready do
  begin
  a:=a+1;
  log.Lines.add('Waiting '+inttostr(a));
  application.ProcessMessages;
  end;

 This is only needed after a 302.  The counter ranges from 400-1000 before
 the state turns to httpready.  And I am not sure that they are real 302s.
 The same pages give a statuscode of 302 consistently when downloaded in
 the
 same order, but may give a 200 if downloaded in a different order.  Could
 a
 bug in my program make httpcli give a fake 302 statuscode?
 (The above code gives an infinite loop if application.processmessages is
 removed)


 - Original Message - 
 From: Ronny [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 10:08 AM
 Subject: Re: [twsocket] HttpCli problem


 The problem is that the STATE is not ready after the abort, so when I
 use
 httpcli to grab another file after a 302, I would get an error. (http
 component busy, I think).
 After an abort in such a case, is there anything that I have to do to
 make
 sure that the component is ready for the next use?
 (This only happens after a 302, anything else (200, 404, etc) works
 well.)
 -Ronny

 - Original Message - 
 From: Francois PIETTE [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Saturday, February 25, 2006 3:59 AM
 Subject: Re: [twsocket] HttpCli problem


 After httpcli.abort is called, the statuscode is normally 404 if the
 statuscode before the call is 200.  The statuscode is 0 if the 
 original
 statuscode is 302.  This is causing me problems (i.e. httpcli state is
 not
 ready after an abort is called if the statuscode was 302).  See
 example:

  log.Lines.Add(inttostr(httpcli.StatusCode);
  httpcli.abort;
  log.Lines.Add(inttostr(httpcli.StatusCode);

 D7, ICS V6 beta V1.91

 StatusCode value is valid only when or after OnRequestDone has been
 triggered.
 Anyway, if you abort, you obviously know what you are doing. No need to
 rely
 on StatusCode.

 --
 [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

 -- 
 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

 -- 
 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] HttpCli problem

2006-02-25 Thread Ronny
Thank you for the feedback, Francois and Wilfried.  I have not been clear in 
my explination.  Let me start again with more detail:

State: httpReady
I call  httpcli.GetASync.
State: httpDnsLookup

( on HeaderEnd)
State: httpWaitingHeader   StatusCode: 302
I call httpcli.About
State: httpReady

(OnRequestDone)
State: httpDNSLookup

Nothing is done between OnHeaderEnd and OnRequestDone, so I assume that 
httpcli is looking for the redirect. (This only happens with a 302 
StatusCode, with a 200 Statuscode, OnRequestDone state is httpReady).

If this is a 'Feature' and not a bug, then can I Abort again in the 
OnRequestDone?  Or what do you recommend?  I do not think that the second 
DNSLookup will provide me with any useful information, even if it is a 
redirect, I wouldn't know how to use it, so I might as well cancel it and 
try to get the next file.


- Original Message - 
From: Francois PIETTE [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Saturday, February 25, 2006 1:12 PM
Subject: Re: [twsocket] HttpCli problem


 Why use a loop ?
 Why don't you want to use OnRequestDone event ?

 That is the problem. This routine is called from OnRequestDone.  That is
 why
 I think that there is a bug.  OnRequestDone gets called twice for 302s,
 but
 I have already taken that into account.
 Should httpcli.State = httpReady when OnRequestDone is called?   If so,
 this
 is not the case with 302.

 There is no reason to call Abort from OnRequestDone which is the time when
 the request is... done !
 Why do you think you need to call Abort from OnRequestDone ?
 I you really have a good reason (I like to hear it), then PostMessage a
 custom message and then exit. Then from the corresponding event handler,
 call Abort.

 --
 Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
 --
 [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 

-- 
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