i'm having problems with the HTTP:Cookies extract_cookies() method, i have a HTTP::Header object with multiple cookies in it under a single field name and the method is only extracting a single cookie. The solution is possibly to have each cookie under a separate 'Set-Cookie" field, but from which i can see HTTP::Headers does not allow you to have more than 1 field with the same name. Ideas?
A:
How does this come about? A browser should never send multiple cookies with the same name (at least for the same domain/host and path).
Update: sorry, I misunderstood. It does appear that multiple Netscape cookies are only expected in multiple Set-Cookie headers (but new-style cookies are all expected in the same Set-Cookie2 header). HTTP::Headers should work fine with multiple headers with the same name; what are you seeing?
ysth
2010-08-30 05:39:13
im talking about HTTP header fields with the same name
Dee
2010-08-30 05:49:49
@Dee: updated my answer
ysth
2010-08-30 06:26:41
thanks this kinda of helps,it appears that when i place the cookies under a 'Set-Cookies2' field the method does extract (some) of the cookies which is more than before. So your saying that with normally cookies it expects that they are each in separate fields? Is there anyway to place them into separate fields in a HTML::Response object? because i cannot find a way
Dee
2010-08-30 06:47:14
if i use "$response->header('Set-Cookie' => $cookie_str);" in a loop to set multiple cookies it just overrides the previous cookie
Dee
2010-08-30 06:55:50
@Dee: `$response->header('Set-Cookie' => [ $cookie1_str, $cookie2_str ])` or `$response->push_header('Set-Cookie' => $cookie1_str); $response->push_header('Set-Cookie' => $cookie2_str);`
ysth
2010-08-30 07:03:10
push_header() places all the cookies in a list under the same 'set-cookie' field which extract_cookies() appears to be unable to process
Dee
2010-08-30 07:08:56
@Dee: it's working for me with libwww-perl version 5.836; what version are you using? Could you add code demonstrating the problem to your question?
ysth
2010-08-30 07:55:03