Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C436BE653 for ; Tue, 4 Dec 2012 10:16:59 +0000 (UTC) Received: (qmail 57016 invoked by uid 500); 4 Dec 2012 10:16:59 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 56985 invoked by uid 500); 4 Dec 2012 10:16:59 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 56963 invoked by uid 99); 4 Dec 2012 10:16:58 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Dec 2012 10:16:58 +0000 Date: Tue, 4 Dec 2012 10:16:58 +0000 (UTC) From: "Francois-Xavier Bonnet (JIRA)" To: dev@hc.apache.org Message-ID: <236760789.58241.1354616218886.JavaMail.jiratomcat@arcas> In-Reply-To: <780432049.51516.1354493878361.JavaMail.jiratomcat@arcas> Subject: [jira] [Commented] (HTTPCLIENT-1267) There seems to be no way to get HttpClient to include cookies from a custom store MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HTTPCLIENT-1267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13509639#comment-13509639 ] Francois-Xavier Bonnet commented on HTTPCLIENT-1267: ---------------------------------------------------- Oleg, I think Expires is the header for the response, not the expiry of the cookie. Unless I miss something, Expires header on the response should have no impact on how cookies are handled. I am using httpclient for a long time with applications that use transient cookies (typically java applications with JSESSIONID cookie) and it works fine. The problem may be somewhere else. > There seems to be no way to get HttpClient to include cookies from a custom store > --------------------------------------------------------------------------------- > > Key: HTTPCLIENT-1267 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1267 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpCookie > Affects Versions: 4.2.2 > Reporter: Karl Wright > > In the port of ManifoldCF from commons-httpclient to httpcomponents, we discovered a problem or maybe a design flaw with how cookies are handled. > What we're trying to do is to follow a certain series of html pages, and record the cookies after that is done, and use exactly those cookies for a subsequent series of pages. So I have code that looks something like this: > {code} > DefaultHttpClient httpClient = new DefaultHttpClient(); > ... > CookieStore cs = new BasicCookieStore(); > cs.addCookie(...); // for each saved cookie > httpClient.setCookieStore(cs); > HttpGet httpget = new HttpGet(...); > HttpResponse response = httpClient.execute(httpget); > Cookie[] cookiesToSave = httpClient.getCookieStore().getCookies(); > [save the cookies aside] > {code} > What happens when I do this against a page that sets a cookie, is I get a perfectly reasonable cookie, and save it. For the next page, the code to add the cookie to the custom store then seems to work fine as well. But when I watch what is transmitted for the request (via header logging) I see no Cookie header being sent, and indeed the cookie seems to be lost. > Similar logic was done with HttpState in commons-httpclient, and worked perfectly there against the same website. > I have not yet tried the HttpContext approach for implementing this - I may try that while awaiting an answer to this ticket, but the above seems like it ought to work, according to the documentation. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org