[Rssbandit-developers] [ rssbandit-Bugs-1717566 ] Cookie handling broken - only sends one cookie
Browsing web news without a browser
Brought to you by:
carnage4life,
t_rendelmann
From: SourceForge.net <no...@so...> - 2007-06-26 10:57:01
|
Bugs item #1717566, was opened at 2007-05-12 05:53 Message generated for change (Comment added) made by t_rendelmann You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=615248&aid=1717566&group_id=96589 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Networking Group: v1.5.0.10 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dare Obasanjo (carnage4life) Assigned to: Dare Obasanjo (carnage4life) Summary: Cookie handling broken - only sends one cookie Initial Comment: Hi team, Something about the cookie handler isn't working right. RSS Bandit only sends the first cookie name/value pair for a domain when requesting a feed update. ex: IE sends this cookie when requesting a page on my domain: a=1; b=2; c=3; test=a RSS bandit sends this cookie: a=1 Suggestions? Looking in CurrentWork\Source\NewsComponents\Net\AsyncWebRequest.cs(1403), clearly there's a bug in there somewhere. I'll be happy to try to fix it rather than wait for the next release. :) Does this project build with VC# 2005? On import it said the project was built with a prior version. Change this function AsyncWebRequest.cs:GetCookieContainerUri to this: private static CookieContainer GetCookieContainerUri(Uri url) { CookieContainer container = new CookieContainer(); string cookieHeaders = RetrieveIECookiesForUrl(url.AbsoluteUri); if (cookieHeaders.Length > 0) { try{ // This doesn't work for ';' separated cookies!!! //container.SetCookies(url, cookieHeaders); // example: a=2; b=3; c=4; d=5; e=YES string cookieHeaders2 = cookieHeaders.Replace(';', ','); container.SetCookies(url, cookieHeaders2); }catch(System.Net.CookieException ce){ //we might get an error on malformed cookies _log.Error("GetCookieContainerUri() caused exception", ce); } } return container; } The blind swap of a semicolon in the raw cookie string to the expected comma separator of the CookieContainer set method *may* cause other problems if your cookies expect to store semicolons. Though it works for my purposes. ---------------------------------------------------------------------- >Comment By: Torsten Rendelmann (t_rendelmann) Date: 2007-06-26 12:57 Message: Logged In: YES user_id=714452 Originator: NO We also get exceptions on Vista/CLR 2.0 like this: System.Net.CookieException: An error occurred when parsing the Cookie header for Uri 'http://weblogs.asp.net/favicon.ico'. ---> System.Net.CookieException: Cookie format error. at System.Net.CookieContainer.CookieCutter(Uri uri, String headerName, String setCookieHeader, Boolean isThrow) --- End of inner exception stack trace --- at System.Net.CookieContainer.CookieCutter(Uri uri, String headerName, String setCookieHeader, Boolean isThrow) at System.Net.CookieContainer.SetCookies(Uri uri, String cookieHeader) at NewsComponents.Net.HttpCookieManager.GetCookieContainerUri(Uri url) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=615248&aid=1717566&group_id=96589 |