hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francois-Xavier Bonnet <francois-xavier.bon...@centraliens.net>
Subject Re: Exception parsing cookies
Date Fri, 15 Mar 2013 04:55:03 GMT
I guess the application you are calling is developed with Zend framework
and the framework is setting automatically this cookie. I don't know if
there is a way to remove it.

An HttpClient instance has a default CookieStore. If you don't set a
different HttpContext for each request with a CookieStore in it, HttpClient
will use the same default CookieStore for all users. I think your problem
comes from concurrent accesses to this CookieStore which is not thread safe.

If you want to be stateless, I suggest that you set HttpClient to just
ignore all cookies, this should solve your problem:
httpclient.getParams().setParameter(ClientPNames.COOKIE_POLICY,
CookiePolicy.IGNORE_COOKIES);

2013/3/15 Albek, Elli (contractor) <ealbek-contractor@shaklee.com>

> This is not a common error, so it will take some time until I have a log
> message with an exception. This is what I have now (hostname masked).
>
> +++++++++++++++++++++++++++++++++++
> "2013-03-14 20:28:53" DEBUG RequestAddCookies  CookieSpec selected:
> best-match
>
> "2013-03-14 20:28:53" DEBUG RequestAddCookies  Cookie [version: 0][name:
> ZDEDebuggerPresent][value: php,phtml,php3][domain:
> mobile.example.com][path: /][expiry: null] match
> [mobile.example.com:80/us/en/ api_questionnaire.php]
>
>  "2013-03-14 20:28:53" DEBUG RequestAddCookies  Cookie [version:
> 0][name: mobileexample_php_session][value: ujcjb0kk8vbiv01m7o4][domain:
> .example.com][path: /][expiry: null] match [mobile.example.com:80/us/en/
> api_questionnaire.php]
>
> "2013-03-14 20:28:53" DEBUG ResponseProcessCookies  Cookie accepted:
> "[version: 0][name: ZDEDebuggerPresent][value: php,phtml,php3][domain:
> mobile.example.com][path: /][expiry: null]".
> +++++++++++++++++++++++++++++++++
>
> Where is this coming from?
> RequestAddCookies  Cookie [version: 0][name: ZDEDebuggerPresent][value:
> php,phtml,php3]
>
> We are not sending any cookie in the request. Is this a result of a
> previous call using the same client instance? We need every call to be
> atomic and stateless with no state between calls.
>
> There is one client instance for the JVM created with:
>
> static final DefaultHttpClient client = createClient();
>
> private static DefaultHttpClient createClient() {
>   PoolingClientConnectionManager cm = new
> PoolingClientConnectionManager();
>   cm.setDefaultMaxPerRoute(100));
>   cm.setMaxTotal(200));
>
>   return new DefaultHttpClient(cm);
> }
>
>
> -----Original Message-----
>  Francois-Xavier Bonnet
> Sent: Thursday, March 14, 2013 7:23 PM
> To: HttpComponents Project
> Subject: Re: Exception parsing cookies
>
> Hi,
>
> Could you set org.apache.http.client.protocol.RequestAddCookies
> and org.apache.http.client.protocol.ResponseProcessCookies categories to
> DEBUG
> In addition could your code ?
>
> > I would normally put this in Jira, but it does not let me create an
> > account from some reason.
> >
> >
> >
> > We get this exception sporadically in a production system:
> >
> >
> >
> > java.lang.ArrayIndexOutOfBoundsException: -857528244
> >
> >       at java.util.ArrayList$Itr.next(ArrayList.java:762)
> >
> >       at
> >
> org.apache.http.impl.cookie.BestMatchSpec.formatCookies(BestMatchSpec.ja
> > va:189)
> >
> >       at
> >
> org.apache.http.client.protocol.RequestAddCookies.process(RequestAddCook
> > ies.java:196)
> >
> >       at
> >
> org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpPro
> > cessor.java:109)
> >
> >       at
> >
> org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecu
> > tor.java:176)
> >
> >       at
> >
> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultReques
> > tDirector.java:515)
> >
> >       at
> >
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClien
> > t.java:906)
> >
> >       at
> >
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClien
> > t.java:805)
> >
> >       at
> >
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClien
> > t.java:784)
> >
> >
> >
> > We are calling POST URL and we do not send any cookie.
> >
> > Versions:
> >
> > httpclient-4.2.3.jar
> >
> > httpcore-4.2.2.jar
> >
> >
> >
> > If you reply to this post please make sure my email address is not
> > visible in the body of the email.
> >
> >
> >
> > Thanks
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message