Re: [twsocket] THttpCli -> How to know what URL is requested?

2012-12-21 Thread brian -
Maybe skip grabbing the cookies when request code result is 302 (redirect
etc)

On Fri, Dec 21, 2012 at 1:53 PM, brian -  wrote:

> I think when OnLocationChange triggers, Location already has the new URL.
>
>
> On Fri, Dec 21, 2012 at 5:06 AM, Albert Wiersch  > wrote:
>
>>
>> > -Original Message-
>> > From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org]
>> On
>> > Behalf Of brian -
>> >
>> > Then it should be Location.
>> >
>> > checking LocationChange and RequestDone for the loc ends in the same
>> final
>> > URL at the end, going from .com to the localized domain
>>
>> Hello,
>>
>> I would assume 'Location' would be the URL on the RequestDone() event,
>> but how
>> do you determine the current URL in a LocationChange() event? You wouldn't
>> know (for sure) whether it is  URL or whether it was the previous value in
>> Location.
>>
>> I think I came up with a method of getting the 'current URL' though,
>> using two
>> variables 'lastloc' and 'currloc':
>>
>> 1. In OnLocationChange(), I set 'lastloc' to Location.
>> 2. In OnRequestHeaderBegin(), I set 'currloc' to the value of 'lastloc'
>> (if it
>> exists).
>> 3. To get the true current location of the request, I check 'currloc' and
>> use
>> that if there is a value assigned, otherwise I use the 'URL' property.
>>
>> If one just uses the 'Location' property, it's not always the current URL
>> - at
>> least not until the OnRequestHeaderBegin() event... in fact, the current
>> URL
>> could be a previous value of 'Location', if there was more than one
>> location
>> change.
>>
>> Am I making sense? :)
>>
>> Does the above method make sense or does someone know an easier way? Or
>> am I
>> making this too complicated?
>>
>> I need the 'real' URL to handle cookies properly. I need the current URL
>> in
>> OnCookie, and if there is a location header before the cookie header,
>> then the
>> Location property is not the current URL for the cookie... the URL
>> property
>> might be, but it could also have been the previous value of Location if
>> there
>> was more than one relocation. See the problem? :)
>>
>> Thanks,
>> Albert
>>
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
>>
>
>
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] THttpCli -> How to know what URL is requested?

2012-12-21 Thread brian -
I think when OnLocationChange triggers, Location already has the new URL.

On Fri, Dec 21, 2012 at 5:06 AM, Albert Wiersch
wrote:

>
> > -Original Message-
> > From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org]
> On
> > Behalf Of brian -
> >
> > Then it should be Location.
> >
> > checking LocationChange and RequestDone for the loc ends in the same
> final
> > URL at the end, going from .com to the localized domain
>
> Hello,
>
> I would assume 'Location' would be the URL on the RequestDone() event, but
> how
> do you determine the current URL in a LocationChange() event? You wouldn't
> know (for sure) whether it is  URL or whether it was the previous value in
> Location.
>
> I think I came up with a method of getting the 'current URL' though, using
> two
> variables 'lastloc' and 'currloc':
>
> 1. In OnLocationChange(), I set 'lastloc' to Location.
> 2. In OnRequestHeaderBegin(), I set 'currloc' to the value of 'lastloc'
> (if it
> exists).
> 3. To get the true current location of the request, I check 'currloc' and
> use
> that if there is a value assigned, otherwise I use the 'URL' property.
>
> If one just uses the 'Location' property, it's not always the current URL
> - at
> least not until the OnRequestHeaderBegin() event... in fact, the current
> URL
> could be a previous value of 'Location', if there was more than one
> location
> change.
>
> Am I making sense? :)
>
> Does the above method make sense or does someone know an easier way? Or am
> I
> making this too complicated?
>
> I need the 'real' URL to handle cookies properly. I need the current URL in
> OnCookie, and if there is a location header before the cookie header, then
> the
> Location property is not the current URL for the cookie... the URL property
> might be, but it could also have been the previous value of Location if
> there
> was more than one relocation. See the problem? :)
>
> Thanks,
> Albert
>
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] THttpCli -> How to know what URL is requested?

2012-12-20 Thread Albert Wiersch

> -Original Message-
> From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On
> Behalf Of brian -
> 
> Then it should be Location.
> 
> checking LocationChange and RequestDone for the loc ends in the same final
> URL at the end, going from .com to the localized domain

Hello,

I would assume 'Location' would be the URL on the RequestDone() event, but how
do you determine the current URL in a LocationChange() event? You wouldn't
know (for sure) whether it is  URL or whether it was the previous value in
Location.

I think I came up with a method of getting the 'current URL' though, using two
variables 'lastloc' and 'currloc':

1. In OnLocationChange(), I set 'lastloc' to Location.
2. In OnRequestHeaderBegin(), I set 'currloc' to the value of 'lastloc' (if it
exists).
3. To get the true current location of the request, I check 'currloc' and use
that if there is a value assigned, otherwise I use the 'URL' property.

If one just uses the 'Location' property, it's not always the current URL - at
least not until the OnRequestHeaderBegin() event... in fact, the current URL
could be a previous value of 'Location', if there was more than one location
change.

Am I making sense? :)

Does the above method make sense or does someone know an easier way? Or am I
making this too complicated?

I need the 'real' URL to handle cookies properly. I need the current URL in
OnCookie, and if there is a location header before the cookie header, then the
Location property is not the current URL for the cookie... the URL property
might be, but it could also have been the previous value of Location if there
was more than one relocation. See the problem? :)

Thanks,
Albert

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


Re: [twsocket] THttpCli -> How to know what URL is requested?

2012-12-20 Thread brian -
*for Google.com
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] THttpCli -> How to know what URL is requested?

2012-12-20 Thread brian -
Then it should be Location.

checking LocationChange and RequestDone for the loc ends in the same final
URL at the end, going from .com to the localized domain

procedure TForm1.HttpCli1LocationChange(Sender: TObject);
> begin
>   memo1.Lines.Add(HttpCli1.CtrlSocket.Addr);
>   memo1.Lines.Add(HttpCli1.Location);
> end;
> procedure TForm1.HttpCli1RequestDone(Sender: TObject; RqType:
> THttpRequest; ErrCode: Word);
> begin
>   memo1.Lines.Add(HttpCli1.Location);
> end;


Do you have a URL where this isn't the case to test?

On Thu, Dec 20, 2012 at 10:21 PM, Albert Wiersch
wrote:

>
> > -Original Message-
> > From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org]
> On
> > Behalf Of brian -
> >
> > You can use the OnLocationChange event to know when the URL changed.
>
> That seems to let me know when the 'Location' property changes (like in
> response to a 'Location' HTTP header), but that property doesn't always
> indicate the correct URL of the current request.
>
> Albert
>
>
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] THttpCli -> How to know what URL is requested?

2012-12-20 Thread Albert Wiersch

> -Original Message-
> From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On
> Behalf Of brian -
> 
> You can use the OnLocationChange event to know when the URL changed.

That seems to let me know when the 'Location' property changes (like in
response to a 'Location' HTTP header), but that property doesn't always
indicate the correct URL of the current request.

Albert


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


Re: [twsocket] THttpCli -> How to know what URL is requested?

2012-12-20 Thread brian -
You can use the OnLocationChange event to know when the URL changed.

On Thu, Dec 20, 2012 at 4:10 PM, Albert Wiersch
wrote:

>
> How can I know what URL was last requested?
>
> The "URL" property seems to always be the original URL, so this doesn't
> work
> in the case of a redirection.
> The "Location" property seems to indicate the last value of the "location"
> property that was received, and is sometimes, but not always the URL of the
> current request.
>
> Is there an easy way to do always know the URL of the current request when
> redirections are used? Or do I have to use more complicated method than
> simply
> accessing a property?
>
> I would think this is very important for proper cookie handling, because
> cookies always need to be based on the current URL (as far as I know
> anyway).
>
> Thanks,
> Albert Wiersch
> AI Internet Solutions LLC
> supp...@htmlvalidator.com
> http://www.htmlvalidator.com/
>
>
>
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be