Hi Paul, I don't see anything wrong with the output. What will have you expected?
JM 2012/11/6, [email protected] <[email protected]>: > > I'm using httpcore-4.2.1 , and code below shows the problem. > The code is similar to that on page 2 of the httpcore tutorial pdf. > I only added a Set-Cookie with an expires header element . > ------------------------------------------------------------------- > > import org.apache.http.*; > import org.apache.http.message.*; > > public class Page2 { > > public static void main(String[] args) { > HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, > HttpStatus.SC_OK, "OK"); > response.addHeader("Set-Cookie", "c1=a; path=/; domain=localhost"); > response.addHeader("Set-Cookie", > "c2=b; path=\"/\", c3=c; domain=\"localhost\""); > response.addHeader("Set-Cookie", > "c2=b; expires=Sun, 03-Nov-2013 10:54:41 GMT;" + > " path=\"/\", c3=c; domain=\"localhost\""); > HeaderElementIterator it = new BasicHeaderElementIterator( > response.headerIterator("Set-Cookie")); > while (it.hasNext()) { > HeaderElement elem = it.nextElement(); > System.out.println(elem.getName() + " = " + elem.getValue()); > NameValuePair[] params = elem.getParameters(); > for (int i = 0; i < params.length; i++) { > System.out.println(" " + params[i]); > } > } > } > } > ------------------------------------------------------------------- > It produces output > > c1 = a > path=/ > domain=localhost > c2 = b > path=/ > c3 = c > domain=localhost > c2 = b > expires=Sun > 03-Nov-2013 10:54:41 GMT = null > path=/ > c3 = c > domain=localhost > > Clearly the date is parsed wrong. > > Is this a bug in httpcore, or am i doing something wrong? > > Regards, > Paul van Bemmelen > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
