Re: [twsocket] Httpcli cookie
On Apr 21, 2007, at 05:47, Frans van Daalen wrote: Yes, deriving would be an option, did not think about that one. But just recently I came across some weird and wonderful websites that did non-standard thinks to the cookie, so far for bad excuses :-) What sort of non-standard things? And how do they affect your handling of the cookies with HttpCli component? How would you add to the current httpcli (v6) component a cookie-manager in a non code breaking manner as the current cookie is defined as a string? I don't think you would add a cookie manager to the HttpCli component. I think Francois meant for an additional ICS component that browser-like applications could use in addition to HttpCli: Your application gets the cookie information from the event, and feeds it to the cookie manager. dZ. -- DZ-Jay [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html -- 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] Httpcli cookie
While the discussion for the urlencode on autorelocate is going nicely :-) I also have a small remark to make about the cookie property. Currently the following is done when a cookie is received - else if Field = 'set-cookie' then begin bAccept := TRUE; TriggerCookie(Data, bAccept); end - would it not be beter to save the recieved cookie somewhere in the httpcli component? I believe that this cookie-property is the only received property that is not feed back into the component when recieved. Currently I handle this in the oncookie event but that means that I have extra variables laying around for every httpcli component I use and i really not like that. It's a kind of weird that after a get or post I need to access on variable to see the real returned cookie value. I have the code available so i can propose the change but would like to see some comments on the basic idea first Kind regards, Frans -- 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 cookie
Normally, cookies are managed by the application. It is not always that simple because of path and expiration. You can have a lot of cookies grabbed from one or even several URL while redirecting. So you should really write some manager code to have cookies somewhat persistant. That's why the event pass the cookie thru an event and do not store it in the component. Note that you can derive your own HTTP component from ICS component and add the storage or manager you like. In my opinion, it is better to write a separate class for cookie management and link that class to your HTTP component. A cookie manager component would be a nice addon to ICS :-) -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Frans van Daalen [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Saturday, April 21, 2007 10:33 AM Subject: [twsocket] Httpcli cookie While the discussion for the urlencode on autorelocate is going nicely :-) I also have a small remark to make about the cookie property. Currently the following is done when a cookie is received - else if Field = 'set-cookie' then begin bAccept := TRUE; TriggerCookie(Data, bAccept); end - would it not be beter to save the recieved cookie somewhere in the httpcli component? I believe that this cookie-property is the only received property that is not feed back into the component when recieved. Currently I handle this in the oncookie event but that means that I have extra variables laying around for every httpcli component I use and i really not like that. It's a kind of weird that after a get or post I need to access on variable to see the real returned cookie value. I have the code available so i can propose the change but would like to see some comments on the basic idea first Kind regards, Frans -- 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 cookie
From: Francois PIETTE Normally, cookies are managed by the application. It is not always that simple because of path and expiration. You can have a lot of cookies grabbed from one or even several URL while redirecting. So you should really write some manager code to have cookies somewhat persistant. That's why the event pass the cookie thru an event and do not store it in the component. Note that you can derive your own HTTP component from ICS component and add the storage or manager you like. In my opinion, it is better to write a separate class for cookie management and link that class to your HTTP component. A cookie manager component would be a nice addon to ICS :-) Yes, deriving would be an option, did not think about that one. But just recently I came across some weird and wonderful websites that did non-standard thinks to the cookie, so far for bad excuses :-) How would you add to the current httpcli (v6) component a cookie-manager in a non code breaking manner as the current cookie is defined as a string? I'm willing to spend time on writing a rudimentary manager as this would add more value the your component and it's a nice way to contribute something other then the postcard :-) -- 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 cookie
Note that you can derive your own HTTP component from ICS component and add the storage or manager you like. In my opinion, it is better to write a separate class for cookie management and link that class to your HTTP component. A cookie manager component would be a nice addon to ICS :-) How would you add to the current httpcli (v6) component a cookie-manager in a non code breaking manner as the current cookie is defined as a string? Write a TCookieManager component. Create a new property CookieManager in the HTTP component. At design time, link the cookie manager component to the http component. In the http component, when a cookie is received and the cookie manage is assigned, the HTP component call the appropriate methods in the cookie manager. The same when a request is sent: if cookie manager is assigned, the http component request the cookie manager to get the cookie list to add to the request. -- 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 cookie
From: Francois PIETTE Note that you can derive your own HTTP component from ICS component and add the storage or manager you like. In my opinion, it is better to write a separate class for cookie management and link that class to your HTTP component. A cookie manager component would be a nice addon to ICS :-) How would you add to the current httpcli (v6) component a cookie-manager in a non code breaking manner as the current cookie is defined as a string? Write a TCookieManager component. Create a new property CookieManager in the HTTP component. At design time, link the cookie manager component to the http component. In the http component, when a cookie is received and the cookie manage is assigned, the HTP component call the appropriate methods in the cookie manager. The same when a request is sent: if cookie manager is assigned, the http component request the cookie manager to get the cookie list to add to the request. Nice, agreed. I will add this to my list. As soon as a first version is available I will post it here. For all readers, if you can think of any cookiemanager functions etc, just list them and I'll see what I can do. Frans -- 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 cookie
How would you add to the current httpcli (v6) component a cookie-manager in a non code breaking manner as the current cookie is defined as a string? Write a TCookieManager component. Create a new property CookieManager in the HTTP component. At design time, link the cookie manager component to the http component. In the http component, when a cookie is received and the cookie manage is assigned, the HTP component call the appropriate methods in the cookie manager. The same when a request is sent: if cookie manager is assigned, the http component request the cookie manager to get the cookie list to add to the request. Nice, agreed. I will add this to my list. As soon as a first version is available I will post it here. For all readers, if you can think of any cookiemanager functions etc, just list them and I'll see what I can do. procedure AddCookie(const Cookie : String); function ScanCookies(const URL : String) : String; // Return a list of header lines (CR/LF delimited) with all stored cookie valid for the given URL. procedure Clear; // Delete all procedure SaveToStream(Stream : TSream); procedure LoadFromStream(Stream : TStream); procedure Purge; // Purge all expired cookies -- 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 cookie
From: Francois PIETTE For all readers, if you can think of any cookiemanager functions etc, just list them and I'll see what I can do. Your funtions are based on the assumption that there is a manager per httpcli, but maybe beter to have a manager that can handle multiple httpcli? procedure AddCookie(const Cookie : String); procedure AddCookie(Host : String; Data : String); Add cookie for a host to the collection. Maybe terurn value must be set to see if the cookie is accepted by the manager? function ScanCookies(const URL : String) : String; // Return a list of header lines (CR/LF delimited) with all stored cookie valid for the given URL. procedure ScanCookies(Host:String;Path:String): String; Returns a string with all cookies for a specifiek path for a specifiek host, maybe use ; as delimeter as that would allow to connect it to the current cookie in thttpcli. If Path is not given default path =/ will be used. procedure Clear; // Delete all procedure ClearAll Clears all cookies for all hosts procedure Clear(Host: String; Path:String) Clear cookies set for a host and specifiek path. If path not set default path =/ will be used. function GetCookiePath(Host : String) : TStringList; will return all available paths for which a cookie has been saved for named host. procedure SaveToStream(Stream : TSream); Maybe also SaveHostCookieToStream(Host : String : Stream : TStream) saves all cookies for all paths for 1 specifiek host procedure LoadFromStream(Stream : TStream); Maybe also LoadHostCookieFromStrea,(Host : String : Stream : TStream) loads all cookies for all paths for 1 speciek host procedure Purge; // Purge all expired cookies ? what should this one do? -- 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 cookie
From: Frans van Daalen procedure Purge; // Purge all expired cookies ? what should this one do? arg maybe I schould read the command about the expired cookies :-) -- 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 cookie
Your funtions are based on the assumption that there is a manager per httpcli, but maybe beter to have a manager that can handle multiple httpcli? Indeed. -- 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 cookie
Plus from my perspective, there should be a conditional compilation option for thread-safety. Regards, SZ - Original Message - From: Francois PIETTE [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Saturday, April 21, 2007 5:31 PM Subject: Re: [twsocket] Httpcli cookie Your funtions are based on the assumption that there is a manager per httpcli, but maybe beter to have a manager that can handle multiple httpcli? Indeed. -- 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