You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Perttu Roger <ro...@rfv.sfa.se> on 2004/04/19 17:22:00 UTC

[HttpClient] Cookie and header problems

Hi!

I'm having trouble with cookies. My server doesn't seem to understand multiple
cookie-headers sent by HttpClient.

The server sends me this (edited):
HTTP/1.0 200 OK
Server: TeamWARE Web Service/5.3L13
Content-Type: text/html
Date: Mon, 19 Apr 2004 14:15:23 GMT
Pragma: no-cache
Cache-Control: no-cache
Expires: Mon, 19 Apr 2004 14:15:23 GMT
Content-Length: 482
Connection: close
Set-Cookie: TeamWARE=4e44; domain=.ads.sfa.se; path=/
Set-Cookie: TWUN=5065; domain=.ads.sfa.se; path=/

***********************************************************************
And HttpClient returns this (edited)
User-Agent: Jakarta Commons-HttpClient/2.0final
Host: xxx.yyy.sfa.se
Cookie: TeamWARE=4e44
Cookie: TWUN=5065
Proxy-Connection: Keep-Alive

***********************************************************************

The problem is that the server doesn't seem to understad when multiple
Cookie-headers are used. Mozilla sends it like this:
  Cookie: TWUN=5065; TeamWARE=4e44
which works with my server.

Is there a way to make HttpClient use a one line cookie-header like Mozilla?
What does the HTTP-spec. and other "standards" say about this? I've done some
digging but I didn't come up with much.

Thanks,
Roger P

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [HttpClient] Cookie and header problems

Posted by Oleg Kalnichevski <ol...@bluewin.ch>.
Roger,

Setting 'strict mode' flag to true should do the trick:

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpMethod.html#setStrictMode(boolean)

Oleg




On Mon, 2004-04-19 at 17:22, Perttu Roger wrote:
> Hi!
> 
> I'm having trouble with cookies. My server doesn't seem to understand multiple
> cookie-headers sent by HttpClient.
> 
> The server sends me this (edited):
> HTTP/1.0 200 OK
> Server: TeamWARE Web Service/5.3L13
> Content-Type: text/html
> Date: Mon, 19 Apr 2004 14:15:23 GMT
> Pragma: no-cache
> Cache-Control: no-cache
> Expires: Mon, 19 Apr 2004 14:15:23 GMT
> Content-Length: 482
> Connection: close
> Set-Cookie: TeamWARE=4e44; domain=.ads.sfa.se; path=/
> Set-Cookie: TWUN=5065; domain=.ads.sfa.se; path=/
> 
> ***********************************************************************
> And HttpClient returns this (edited)
> User-Agent: Jakarta Commons-HttpClient/2.0final
> Host: xxx.yyy.sfa.se
> Cookie: TeamWARE=4e44
> Cookie: TWUN=5065
> Proxy-Connection: Keep-Alive
> 
> ***********************************************************************
> 
> The problem is that the server doesn't seem to understad when multiple
> Cookie-headers are used. Mozilla sends it like this:
>   Cookie: TWUN=5065; TeamWARE=4e44
> which works with my server.
> 
> Is there a way to make HttpClient use a one line cookie-header like Mozilla?
> What does the HTTP-spec. and other "standards" say about this? I've done some
> digging but I didn't come up with much.
> 
> Thanks,
> Roger P
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org