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ó Valls <jo...@ventusproxy.com> on 2009/07/08 16:33:42 UTC

Http trace for cookies

Hello Oleg,

 

I’m trying to send you the trace, but your mail server does not accept it.

 

I paste here a couple of lines of this trace:

 

This is the interesting part of the trace. The expiry date is correct in the
line 7 (60 seconds from now). But it seems this expiry date does not appear
in Cookie header.

 

Joan.

 

 

CookieSpec selected: best-match

Cookie [version: 1][name: testName][value: testValue][domain:
wstest.rhodasol.es][path: /wsserhs/rhodasol][expiry: Wed Jul 08 16:22:39
CEST 2009] match [wstest.rhodasol.es:81/wsserhs/rhodasol]

 

Sending request: POST /wsserhs/rhodasol HTTP/1.1

 POST /wsserhs/rhodasol HTTP/1.1

 Accept-Encoding: gzip

 Content-Length: 444

 Content-Type: text/xml

 Host: wstest.rhodasol.es:81

 Connection: Keep-Alive

 Cookie: $Version=1; testName="testValue"; $Path="/wsserhs/rhodasol";
$Domain="wstest.rhodasol.es"

 Cookie2: $Version=1

Receiving response: HTTP/1.1 200 OK

 HTTP/1.1 200 OK

 


Re: Http trace for cookies

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, Jul 09, 2009 at 10:37:28AM +0200, Joan Balaguer? Valls wrote:
> Hello Oleg,
> 
> Then, how is it possible that I always receive -1 in "maxAge" attribute? Am
> I forgetting something, or doing something wrong?
> 

Joan

Why is this a problem? That basically means that the cookie max age is
undefined, so it should be kept for the duration of the HTTP session only.


> If I try to set the MAX_AGE_ATTR and the EXPIRES_ATTR, I get -1 again.
> How is the correct way to propagate the cookie expiry date?
> 


Max-age attributes can be set on the Set-Cookie headers only. HTTP user agents
are not supposed to send the max-age value back to the origin server.

http://www.faqs.org/rfcs/rfc2965.html

Hope this helps

Oleg


> Thanks in advance,
> 
> Joan.
> 
> 
> Date expires = new Date(System.currentTimeMillis() + 60000);
>  		   
> BasicClientCookie bcc = new BasicClientCookie("testName", "testValue");
> bcc.setVersion(1);
> bcc.setDomain("wstest.rhodasol.es");
> bcc.setPath("/wsserhs/rhodasol");
> bcc.setSecure(false);
> bcc.setExpiryDate(expires);
>   		 
> bcc.setAttribute(ClientCookie.VERSION_ATTR, "1");
> bcc.setAttribute(ClientCookie.DOMAIN_ATTR, "wstest.rhodasol.es");
> bcc.setAttribute(ClientCookie.PATH_ATTR, "/wsserhs/rhodasol");
> bcc.setAttribute(ClientCookie.MAX_AGE_ATTR, "60");
> bcc.setAttribute(ClientCookie.EXPIRES_ATTR, DateUtils.formatDate(expires));
> 
> 
> 
> -----Mensaje original-----
> De: Oleg Kalnichevski [mailto:olegk@apache.org] 
> Enviado el: mi?rcoles, 08 de julio de 2009 23:54
> Para: HttpClient User Discussion
> Asunto: Re: Http trace for cookies
> 
> Joan Balaguer? Valls wrote:
> > Hello Oleg,
> > 
> >  
> > 
> > I?m trying to send you the trace, but your mail server does not accept it.
> > 
> >  
> > 
> > I paste here a couple of lines of this trace:
> > 
> >  
> > 
> > This is the interesting part of the trace. The expiry date is correct in
> the
> > line 7 (60 seconds from now). But it seems this expiry date does not
> appear
> > in Cookie header.
> > 
> >  
> > 
> > Joan.
> > 
> >  
> > 
> >  
> > 
> > CookieSpec selected: best-match
> > 
> > Cookie [version: 1][name: testName][value: testValue][domain:
> > wstest.rhodasol.es][path: /wsserhs/rhodasol][expiry: Wed Jul 08 16:22:39
> > CEST 2009] match [wstest.rhodasol.es:81/wsserhs/rhodasol]
> > 
> >  
> > 
> > Sending request: POST /wsserhs/rhodasol HTTP/1.1
> > 
> >  POST /wsserhs/rhodasol HTTP/1.1
> > 
> >  Accept-Encoding: gzip
> > 
> >  Content-Length: 444
> > 
> >  Content-Type: text/xml
> > 
> >  Host: wstest.rhodasol.es:81
> > 
> >  Connection: Keep-Alive
> > 
> >  Cookie: $Version=1; testName="testValue"; $Path="/wsserhs/rhodasol";
> > $Domain="wstest.rhodasol.es"
> > 
> >  Cookie2: $Version=1
> > 
> > Receiving response: HTTP/1.1 200 OK
> > 
> >  HTTP/1.1 200 OK
> > 
> >  
> 
> I am sorry, Joan, but I see nothing wrong with the cookie. The cookie 
> looks perfectly valid to me.
> 
> Oleg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


RE: Http trace for cookies

Posted by Joan Balagueró Valls <jo...@grupoventus.com>.
Hello Oleg,

Then, how is it possible that I always receive -1 in "maxAge" attribute? Am
I forgetting something, or doing something wrong?

If I try to set the MAX_AGE_ATTR and the EXPIRES_ATTR, I get -1 again.
How is the correct way to propagate the cookie expiry date?

Thanks in advance,

Joan.


Date expires = new Date(System.currentTimeMillis() + 60000);
 		   
BasicClientCookie bcc = new BasicClientCookie("testName", "testValue");
bcc.setVersion(1);
bcc.setDomain("wstest.rhodasol.es");
bcc.setPath("/wsserhs/rhodasol");
bcc.setSecure(false);
bcc.setExpiryDate(expires);
  		 
bcc.setAttribute(ClientCookie.VERSION_ATTR, "1");
bcc.setAttribute(ClientCookie.DOMAIN_ATTR, "wstest.rhodasol.es");
bcc.setAttribute(ClientCookie.PATH_ATTR, "/wsserhs/rhodasol");
bcc.setAttribute(ClientCookie.MAX_AGE_ATTR, "60");
bcc.setAttribute(ClientCookie.EXPIRES_ATTR, DateUtils.formatDate(expires));



-----Mensaje original-----
De: Oleg Kalnichevski [mailto:olegk@apache.org] 
Enviado el: miércoles, 08 de julio de 2009 23:54
Para: HttpClient User Discussion
Asunto: Re: Http trace for cookies

Joan Balagueró Valls wrote:
> Hello Oleg,
> 
>  
> 
> I’m trying to send you the trace, but your mail server does not accept it.
> 
>  
> 
> I paste here a couple of lines of this trace:
> 
>  
> 
> This is the interesting part of the trace. The expiry date is correct in
the
> line 7 (60 seconds from now). But it seems this expiry date does not
appear
> in Cookie header.
> 
>  
> 
> Joan.
> 
>  
> 
>  
> 
> CookieSpec selected: best-match
> 
> Cookie [version: 1][name: testName][value: testValue][domain:
> wstest.rhodasol.es][path: /wsserhs/rhodasol][expiry: Wed Jul 08 16:22:39
> CEST 2009] match [wstest.rhodasol.es:81/wsserhs/rhodasol]
> 
>  
> 
> Sending request: POST /wsserhs/rhodasol HTTP/1.1
> 
>  POST /wsserhs/rhodasol HTTP/1.1
> 
>  Accept-Encoding: gzip
> 
>  Content-Length: 444
> 
>  Content-Type: text/xml
> 
>  Host: wstest.rhodasol.es:81
> 
>  Connection: Keep-Alive
> 
>  Cookie: $Version=1; testName="testValue"; $Path="/wsserhs/rhodasol";
> $Domain="wstest.rhodasol.es"
> 
>  Cookie2: $Version=1
> 
> Receiving response: HTTP/1.1 200 OK
> 
>  HTTP/1.1 200 OK
> 
>  

I am sorry, Joan, but I see nothing wrong with the cookie. The cookie 
looks perfectly valid to me.

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Http trace for cookies

Posted by Oleg Kalnichevski <ol...@apache.org>.
Joan Balagueró Valls wrote:
> Hello Oleg,
> 
>  
> 
> I’m trying to send you the trace, but your mail server does not accept it.
> 
>  
> 
> I paste here a couple of lines of this trace:
> 
>  
> 
> This is the interesting part of the trace. The expiry date is correct in the
> line 7 (60 seconds from now). But it seems this expiry date does not appear
> in Cookie header.
> 
>  
> 
> Joan.
> 
>  
> 
>  
> 
> CookieSpec selected: best-match
> 
> Cookie [version: 1][name: testName][value: testValue][domain:
> wstest.rhodasol.es][path: /wsserhs/rhodasol][expiry: Wed Jul 08 16:22:39
> CEST 2009] match [wstest.rhodasol.es:81/wsserhs/rhodasol]
> 
>  
> 
> Sending request: POST /wsserhs/rhodasol HTTP/1.1
> 
>  POST /wsserhs/rhodasol HTTP/1.1
> 
>  Accept-Encoding: gzip
> 
>  Content-Length: 444
> 
>  Content-Type: text/xml
> 
>  Host: wstest.rhodasol.es:81
> 
>  Connection: Keep-Alive
> 
>  Cookie: $Version=1; testName="testValue"; $Path="/wsserhs/rhodasol";
> $Domain="wstest.rhodasol.es"
> 
>  Cookie2: $Version=1
> 
> Receiving response: HTTP/1.1 200 OK
> 
>  HTTP/1.1 200 OK
> 
>  

I am sorry, Joan, but I see nothing wrong with the cookie. The cookie 
looks perfectly valid to me.

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org