I think the problem here is with your expires= value.  The output  
format of 'date' is also a good reference.

We currently support the following formats for date strings: ascii  
time, RFC1123 and RFC2616.

Please feel free to file a bug if there is another widely supported  
date format that we don't support.


On Aug 18, 2008, at 2:53 AM, Andy wrote:

> Hi, all,
> I want to set a cookie for a url, the cookie comes from a cookie
> string, I don't know what the format of the cookie string is supposed
> to be, should be like this ?? "NAME=VALUE; expires=DATE; path=PATH;
> domain=DOMAIN_NAME " , is there any standard to comply with ?
> I also have another question. In mac os x, there is a class named
> "NSHTTPCookie", I'm a little confused with how to use it. I googled a
> example like this.
>
>       void setCookies(Document* /*document*/, const KURL& url, const KURL&
> policyBaseURL, const String& cookieStr)
> 64    {
> 65        BEGIN_BLOCK_OBJC_EXCEPTIONS;
> 66    
> 67        // <rdar://problem/5632883> On 10.5, NSHTTPCookieStorage would
> happily store an empty cookie, which would be sent as "Cookie: =".
> 68        if (cookieStr.isEmpty())
> 69            return;
> 70    
> 71        NSURL *cookieURL = url;
> 72    
> 73        // <http://bugs.webkit.org/show_bug.cgi?id=6531>, <rdar://4409034 
> >
> 74        // cookiesWithResponseHeaderFields doesn't parse cookies  
> without a value
> 75        String cookieString = cookieStr.contains('=') ? cookieStr :
> cookieStr + "=";
> 76    
> 77        NSArray *cookies = [NSHTTPCookie
> cookiesWithResponseHeaderFields:[NSDictionary
> dictionaryWithObject:cookieString forKey:@"Set-Cookie"]
> forURL:cookieURL];
> 78        [[NSHTTPCookieStorage sharedHTTPCookieStorage]
> setCookies:cookies forURL:cookieURL mainDocumentURL:policyBaseURL];
> 79    
> 80        END_BLOCK_OBJC_EXCEPTIONS;
> 81    }
>
> In the example, I guess the "cookieStr" is my "cookie string", but
> when I pass a string "safarname=safarivalue; expires=Thu, 2 Aug 2009
> 20:47:11 UTC; path=/; domain=example.com " to it, the method
> "cookiesWithResponseHeaderFields:"  can't parse it into a cookie
> successfully, so can not return a cookie array, also, the method
> "setCookies:" failed, is there any problem with my cookie string ?
> Bless my poor English, I wish I make my mind clear.
>
> Thanks in advance && thanks for your time.
> _______________________________________________
> webkit-dev mailing list
> [email protected]
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

_Mark
[EMAIL PROTECTED]




_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to