You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Joan Balagueró <jo...@grupoventus.com> on 2013/04/14 18:48:51 UTC
Repeated cookies with same name and value
Hello,
Im querying an url (with head method) and printing all the response headers
received:
HttpResponse response = objHttp.execute(objHead);
HeaderIterator it = response.headerIterator();
while (it.hasNext())
{
Header h = it.nextHeader();
System.out.println(h.getName() + " = " + h.getValue());
}
These are the headers:
Date = Sun, 14 Apr 2013 16:43:04 GMT
Server = Microsoft-IIS/6.0
Etag =
X-XSS-Protection = 0
SRV = 18
X-Powered-By = ASP.NET
X-AspNet-Version = 4.0.30319
Set-Cookie = purgado=1; expires=Tue, 14-May-2013 16:43:04 GMT; path=/
Set-Cookie = devType=0; expires=Tue, 14-May-2013 16:43:04 GMT; path=/
Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
Set-Cookie = ck_idioma=es; expires=Mon, 14-Apr-2014 16:43:04 GMT; path=/;
HttpOnly
Set-Cookie = ck_sesion=2128718291; expires=Mon, 14-Apr-2014 16:43:04 GMT;
path=/; HttpOnly
Set-Cookie = USW_codigo=1615631414; expires=Mon, 14-Apr-2014 16:43:04 GMT;
path=/; HttpOnly
Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
Cache-Control = private
Content-Type = text/html; charset=iso-8859-1
Content-Length = 172813
Obviously this is not a problem with HttpClient, but is it posible to
receive the same cookie 12 times? Does this complain the http specification?
Should HttpResponse remove the repeated headers with exactly the same name
and value?
Thanks,
Joan.
Re: Repeated cookies with same name and value
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sun, 2013-04-14 at 18:48 +0200, Joan Balagueró wrote:
> Hello,
>
>
>
> Im querying an url (with head method) and printing all the response headers
> received:
>
>
>
> HttpResponse response = objHttp.execute(objHead);
>
>
>
> HeaderIterator it = response.headerIterator();
>
>
>
> while (it.hasNext())
>
> {
>
> Header h = it.nextHeader();
>
> System.out.println(h.getName() + " = " + h.getValue());
>
> }
>
>
>
> These are the headers:
>
>
>
> Date = Sun, 14 Apr 2013 16:43:04 GMT
>
> Server = Microsoft-IIS/6.0
>
> Etag =
>
> X-XSS-Protection = 0
>
> SRV = 18
>
> X-Powered-By = ASP.NET
>
> X-AspNet-Version = 4.0.30319
>
> Set-Cookie = purgado=1; expires=Tue, 14-May-2013 16:43:04 GMT; path=/
>
> Set-Cookie = devType=0; expires=Tue, 14-May-2013 16:43:04 GMT; path=/
>
> Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
>
> Set-Cookie = ck_idioma=es; expires=Mon, 14-Apr-2014 16:43:04 GMT; path=/;
> HttpOnly
>
> Set-Cookie = ck_sesion=2128718291; expires=Mon, 14-Apr-2014 16:43:04 GMT;
> path=/; HttpOnly
>
> Set-Cookie = USW_codigo=1615631414; expires=Mon, 14-Apr-2014 16:43:04 GMT;
> path=/; HttpOnly
>
> Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
>
> Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
>
> Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
>
> Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
>
> Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
>
> Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
>
> Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
>
> Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
>
> Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
>
> Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
>
> Set-Cookie = preferencia=-1; expires=Sun, 14-Apr-2013 17:43:04 GMT; path=/
>
> Cache-Control = private
>
> Content-Type = text/html; charset=iso-8859-1
>
> Content-Length = 172813
>
>
>
>
>
> Obviously this is not a problem with HttpClient, but is it posible to
> receive the same cookie 12 times? Does this complain the http specification?
This behavior is silly but I do not think it violates the HTTP state
management spec.
> Should HttpResponse remove the repeated headers with exactly the same name
> and value?
>
No, I do not think so. As long as the response message is well formed it
is not up to HttpClient to decide which headers may be superfluous or
meaningless.
Oleg
>
>
> Thanks,
>
> Joan.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org