Yes, i put them manually. In fact, these cookies are sent by another url, but to test, i put them manually. I sent the class java in the mail before. You can view the code there.
-----Mensaje original----- De: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] Enviado el: martes, 07 de febrero de 2006 14:03 Para: HttpClient User Discussion Asunto: RE: Persistent connections On Tue, 2006-02-07 at 09:41 +0100, Juan Luis de Amaya Robles wrote: > Hi Oleg, > > I send httpclient class traced and firefox information about same page. > I send the java class too. > Thanks a lot!!!!! > > I configured log4j to: > > log4j.logger.httpclient.wire.header=DEBUG > log4j.logger.org.apache.commons.httpclient=DEBUG > > Traces (httpclient): > Juan, How come the first request already includes two cookies? Where do they come from? Do you set them manually? 09:29:11: >> "GET /index.php HTTP/1.1[\r][\n]" 09:29:11: >> "User-Agent: Mozilla/4.0[\r][\n]" 09:29:11: >> "Cookie: PHPSESSID=23ed591387689e00636ec63a59a2248a[\r][\n]" 09:29:11: >> "Cookie: cookIdioma=2[\r][\n]" -----------------^ 09:29:11: >> "Host: www-dev.fundacionolgatorres.org[\r][\n]" 09:29:11: >> "[\r][\n]" 09:29:11: << "HTTP/1.1 200 OK[\r][\n]" 09:29:11: << "Date: Tue, 07 Feb 2006 08:23:39 GMT[\r][\n]" 09:29:11: << "Server: Apache[\r][\n]" 09:29:11: << "X-Powered-By: PHP/5.0.5[\r][\n]" 09:29:11: << "Set-Cookie: PHPSESSID=23ed591387689e00636ec63a59a2248a, cookIdioma=2; path=/[\r][\n]" 09:29:11: << "Expires: Thu, 19 Nov 1981 08:52:00 GMT[\r][\n]" 09:29:11: << "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0[\r][\n]" 09:29:11: << "Pragma: no-cache[\r][\n]" 09:29:11: << "Transfer-Encoding: chunked[\r][\n]" 09:29:11: << "Content-Type: text/html; charset=ISO-8859-1[\r][\n]" Oleg > 09:29:10: Java version: 1.5.0_01 > 09:29:10: Java vendor: Sun Microsystems Inc. > 09:29:10: Java class path: > C:\projects\DocFinder\temp\classes-eclipse;C:\projects\DocFinder\prepa > ra > tor.old\HtmlPreparator.jar;C:\projects\DocFinder\preparator.old\JacobM > sO > fficePreparators.jar;C:\projects\DocFinder\preparator.old\OpenOfficePr > ep > arator.jar;C:\projects\DocFinder\preparator.old\PdfBoxPreparator.jar;C > :\ > projects\DocFinder\preparator.old\PlainTextPreparator.jar;C:\projects\ > Do > cFinder\preparator.old\PoiMsOfficePreparators.jar;C:\projects\DocFinde > r\ > preparator.old\SimpleRtfPreparator.jar;C:\projects\DocFinder\preparator. > old\SwingRtfPreparator.jar;C:\projects\DocFinder\preparator.old\XmlPre > pa > rator.jar;C:\projects\DocFinder\lib\simple-2.5.3.jar;C:\projects\DocFi > nd > er\lib\jacobgen-msoffice2000.jar;C:\projects\DocFinder\lib\jakarta-reg > ex > p-1.3.jar;C:\projects\DocFinder\lib\jacob.jar;C:\projects\DocFinder\li > b\ > log4j-1.2.11.jar;C:\projects\DocFinder\lib\lucene-1.4.3.jar;C:\project > s\ > DocFinder\lib\mysql-connector-317.jar;C:\projects\DocFinder\lib\PDFBox > -0 > .7.1.jar;C:\projects\DocFinder\lib\poi-3.0-alpha1-20050704.jar;C:\proj > ec > ts\DocFinder\lib\poi-scratchpad-3.0-alpha1-20050704.jar;C:\projects\Do > cF > inder\lib\servlet.jar;C:\projects\DocFinder\lib\xercesImpl.jar;C:\proj > ec > ts\DocFinder\lib\xml-apis.jar;C:\projects\DocFinder\lib\win\jdic.jar;C > :\ > projects\pfw-java\bin;C:\projects\pfw-java\lib\activation.jar;C:\proje > ct > s\pfw-java\lib\classes12.jar;C:\projects\pfw-java\lib\db2java.jar;C:\p > ro > jects\pfw-java\lib\jaas.jar;C:\projects\pfw-java\lib\jconn2.jar;C:\pro > je > cts\pfw-java\lib\jms-1.0.2a.jar;C:\projects\pfw-java\lib\jnet.jar;C:\p > ro > jects\pfw-java\lib\jsse.jar;C:\projects\pfw-java\lib\mail.jar;C:\proje > ct > s\pfw-java\lib\md5.jar;C:\projects\pfw-java\lib\mysql-connector-317.ja > r; > C:\projects\pfw-java\lib\soap.jar;C:\projects\pfw-java\lib\xalan.jar;C > :\ > projects\pfw-java\lib\xercesImpl.jar;C:\projects\pfw-java\lib\xml-apis > .j > ar;C:\projects\pfw-java\lib\xmlrpc.jar;C:\projects\pfw-java\lib\log4j-1. > 2.5.jar;C:\projects\pfw-java\lib\servlet.jar;C:\projects\pfw-java\lib\ > sy > nthetica.jar;C:\projects\DocFinder\lib\commons-httpclient-3.0.jar;C:\p > ro > jects\DocFinder\lib\commons-logging.jar;C:\projects\DocFinder\lib\comm > on s-logging-api.jar;C:\projects\DocFinder\lib\commons-codec-1.3.jar > 09:29:10: Operating system name: Windows XP > 09:29:10: Operating system architecture: x86 > 09:29:10: Operating system version: 5.1 > 09:29:11: SUN 1.5: SUN (DSA key/parameter generation; DSA signing; > SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS keystore; > PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection > CertStores) > 09:29:11: SunRsaSign 1.5: Sun RSA signature provider > 09:29:11: SunJSSE 1.5: Sun JSSE provider(PKCS12, SunX509 key/trust > factories, SSLv3, TLSv1) > 09:29:11: SunJCE 1.5: SunJCE Provider (implements RSA, DES, Triple > DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC) > 09:29:11: SunJGSS 1.0: Sun (Kerberos v5) > 09:29:11: SunSASL 1.5: Sun SASL provider(implements client mechanisms > for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5; server mechanisms > for: DIGEST-MD5, GSSAPI, CRAM-MD5) > 09:29:11: Set parameter http.useragent = Jakarta > Commons-HttpClient/3.0 > 09:29:11: Set parameter http.protocol.version = HTTP/1.1 > 09:29:11: Set parameter http.connection-manager.class = class > org.apache.commons.httpclient.SimpleHttpConnectionManager > 09:29:11: Set parameter http.protocol.cookie-policy = rfc2109 > 09:29:11: Set parameter http.protocol.element-charset = US-ASCII > 09:29:11: Set parameter http.protocol.content-charset = ISO-8859-1 > 09:29:11: Set parameter http.method.retry-handler = > [EMAIL PROTECTED] > 09:29:11: Set parameter http.dateparser.patterns = [EEE, dd MMM yyyy > HH:mm:ss zzz, EEEE, dd-MMM-yy HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, > EEE, dd-MMM-yyyy HH:mm:ss z, EEE, dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM > yy HH:mm:ss z, EEE dd-MMM-yyyy HH:mm:ss z, EEE dd MMM yyyy HH:mm:ss z, > EEE dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy HH:mm:ss z, EEE dd MMM yy > HH:mm:ss z, EEE,dd-MMM-yy HH:mm:ss z, EEE,dd-MMM-yyyy HH:mm:ss z, EEE, > dd-MM-yyyy HH:mm:ss z] > 09:29:11: Set parameter http.connection.timeout = 30000 > 09:29:11: Set parameter http.protocol.cookie-policy = compatibility > Target URL: http://www-dev.fundacionolgatorres.org/index.php > 09:29:11: enter GetMethod(String) > 09:29:11: HttpMethodBase.addRequestHeader(Header) > 09:29:11: HttpMethodBase.addRequestHeader(Header) > 09:29:11: HttpMethodBase.addRequestHeader(Header) > 09:29:11: enter HttpClient.executeMethod(HttpMethod) > 09:29:11: enter > HttpClient.executeMethod(HostConfiguration,HttpMethod,HttpState) > 09:29:11: Attempt number 1 to process request > 09:29:11: enter HttpConnection.open() > 09:29:11: Open connection to www-dev.fundacionolgatorres.org:80 > 09:29:11: enter HttpMethodBase.execute(HttpState, HttpConnection) > 09:29:11: enter HttpMethodBase.writeRequest(HttpState, HttpConnection) > 09:29:11: enter HttpMethodBase.writeRequestLine(HttpState, > HttpConnection) > 09:29:11: enter HttpMethodBase.generateRequestLine(HttpConnection, > String, String, String, String) > 09:29:11: >> "GET /index.php HTTP/1.1[\r][\n]" > 09:29:11: enter HttpConnection.print(String) > 09:29:11: enter HttpConnection.write(byte[]) > 09:29:11: enter HttpConnection.write(byte[], int, int) > 09:29:11: enter > HttpMethodBase.writeRequestHeaders(HttpState,HttpConnection) > 09:29:11: enter HttpMethodBase.addRequestHeaders(HttpState, > HttpConnection) > 09:29:11: enter HttpMethodBase.addUserAgentRequestHeaders(HttpState, > HttpConnection) > 09:29:11: enter HttpMethodBase.addHostRequestHeader(HttpState, > HttpConnection) > 09:29:11: Adding Host request header > 09:29:11: enter HttpMethodBase.addCookieRequestHeader(HttpState, > HttpConnection) > 09:29:11: enter HttpState.getCookies() > 09:29:11: enter CookieSpecBase.match(String, int, String, boolean, > Cookie[]) > 09:29:11: enter HttpMethodBase.addProxyConnectionHeader(HttpState, > HttpConnection) > 09:29:11: >> "User-Agent: Mozilla/4.0[\r][\n]" > 09:29:11: enter HttpConnection.print(String) > 09:29:11: enter HttpConnection.write(byte[]) > 09:29:11: enter HttpConnection.write(byte[], int, int) > 09:29:11: >> "Cookie: > PHPSESSID=23ed591387689e00636ec63a59a2248a[\r][\n]" > 09:29:11: enter HttpConnection.print(String) > 09:29:11: enter HttpConnection.write(byte[]) > 09:29:11: enter HttpConnection.write(byte[], int, int) > 09:29:11: >> "Cookie: cookIdioma=2[\r][\n]" > 09:29:11: enter HttpConnection.print(String) > 09:29:11: enter HttpConnection.write(byte[]) > 09:29:11: enter HttpConnection.write(byte[], int, int) > 09:29:11: >> "Host: www-dev.fundacionolgatorres.org[\r][\n]" > 09:29:11: enter HttpConnection.print(String) > 09:29:11: enter HttpConnection.write(byte[]) > 09:29:11: enter HttpConnection.write(byte[], int, int) > 09:29:11: enter HttpConnection.writeLine() > 09:29:11: enter HttpConnection.write(byte[]) > 09:29:11: enter HttpConnection.write(byte[], int, int) > 09:29:11: >> "[\r][\n]" > 09:29:11: enter HttpConnection.flushRequestOutputStream() > 09:29:11: enter HttpMethodBase.readResponse(HttpState, HttpConnection) > 09:29:11: enter HttpMethodBase.readStatusLine(HttpState, > HttpConnection) > 09:29:11: enter HttpConnection.readLine() > 09:29:11: enter HttpParser.readLine(InputStream, String) > 09:29:11: enter HttpParser.readRawLine() > 09:29:11: << "HTTP/1.1 200 OK[\r][\n]" > 09:29:11: enter > HttpMethodBase.readResponseHeaders(HttpState,HttpConnection) > 09:29:11: enter HttpConnection.getResponseInputStream() > 09:29:11: enter HeaderParser.parseHeaders(InputStream, String) > 09:29:11: enter HttpParser.readLine(InputStream, String) > 09:29:11: enter HttpParser.readRawLine() > 09:29:11: enter HttpParser.readLine(InputStream, String) > 09:29:11: enter HttpParser.readRawLine() > 09:29:11: enter HttpParser.readLine(InputStream, String) > 09:29:11: enter HttpParser.readRawLine() > 09:29:11: enter HttpParser.readLine(InputStream, String) > 09:29:11: enter HttpParser.readRawLine() > 09:29:11: enter HttpParser.readLine(InputStream, String) > 09:29:11: enter HttpParser.readRawLine() > 09:29:11: enter HttpParser.readLine(InputStream, String) > 09:29:11: enter HttpParser.readRawLine() > 09:29:11: enter HttpParser.readLine(InputStream, String) > 09:29:11: enter HttpParser.readRawLine() > 09:29:11: enter HttpParser.readLine(InputStream, String) > 09:29:11: enter HttpParser.readRawLine() > 09:29:11: enter HttpParser.readLine(InputStream, String) > 09:29:11: enter HttpParser.readRawLine() > 09:29:11: enter HttpParser.readLine(InputStream, String) > 09:29:11: enter HttpParser.readRawLine() > 09:29:11: << "Date: Tue, 07 Feb 2006 08:23:39 GMT[\r][\n]" > 09:29:11: << "Server: Apache[\r][\n]" > 09:29:11: << "X-Powered-By: PHP/5.0.5[\r][\n]" > 09:29:11: << "Set-Cookie: PHPSESSID=23ed591387689e00636ec63a59a2248a, > cookIdioma=2; path=/[\r][\n]" > 09:29:11: << "Expires: Thu, 19 Nov 1981 08:52:00 GMT[\r][\n]" > 09:29:11: << "Cache-Control: no-store, no-cache, must-revalidate, > post-check=0, pre-check=0[\r][\n]" > 09:29:11: << "Pragma: no-cache[\r][\n]" > 09:29:11: << "Transfer-Encoding: chunked[\r][\n]" > 09:29:11: << "Content-Type: text/html; charset=ISO-8859-1[\r][\n]" > 09:29:11: enter HttpMethodBase.processResponseHeaders(HttpState, > HttpConnection) > 09:29:11: enter CookieSpecBase.parse(String, port, path, boolean, > String) > 09:29:11: enter CookieSpecBase.parse(String, port, path, boolean, > Header) > 09:29:11: enter HeaderElement.parseElements(char[]) > 09:29:11: enter Cookie(String, String, String, String, Date, boolean) > 09:29:11: enter Cookie(String, String, String, String, Date, boolean) > 09:29:11: enter CookieSpecBase.validate(String, port, path, boolean, > Cookie) > 09:29:11: enter HttpState.addCookie(Cookie) > 09:29:11: enter CookieSpecBase.formatCookie(Cookie) > 09:29:11: Cookie accepted: "PHPSESSID=23ed591387689e00636ec63a59a2248a" > 09:29:11: enter CookieSpecBase.validate(String, port, path, boolean, > Cookie) > 09:29:11: enter HttpState.addCookie(Cookie) > 09:29:11: enter CookieSpecBase.formatCookie(Cookie) > 09:29:11: Cookie accepted: "cookIdioma=2" > 09:29:11: enter HttpMethodBase.readResponseBody(HttpState, > HttpConnection) > 09:29:11: enter HttpMethodBase.readResponseBody(HttpConnection) > 09:29:11: enter HttpConnection.getResponseInputStream() > 09:29:11: enter HttpMethodBase.canResponseHaveBody(int) > 09:29:11: enter HeaderElement.parseElements(String) > 09:29:11: enter HeaderElement.parseElements(char[]) > 09:29:11: enter HttpConnection.isResponseAvailable(int) > Response status code: 200 > 09:29:11: enter HttpState.getCookies() Present cookies: > 09:29:11: enter CookieSpecBase.formatCookie(Cookie) > - PHPSESSID=23ed591387689e00636ec63a59a2248a expire: false > 09:29:11: enter CookieSpecBase.formatCookie(Cookie) > - cookIdioma=2 expire: false > > Request headers: > User-Agent: Mozilla/4.0 > Cookie: PHPSESSID=23ed591387689e00636ec63a59a2248a > Cookie: cookIdioma=2 > Host: www-dev.fundacionolgatorres.org > > Response headers: > Date: Tue, 07 Feb 2006 08:23:39 GMT > Server: Apache > X-Powered-By: PHP/5.0.5 > Set-Cookie: PHPSESSID=23ed591387689e00636ec63a59a2248a, cookIdioma=2; > path=/ > Expires: Thu, 19 Nov 1981 08:52:00 GMT > Cache-Control: no-store, no-cache, must-revalidate, post-check=0, > pre-check=0 > Pragma: no-cache > Transfer-Encoding: chunked > Content-Type: text/html; charset=ISO-8859-1 > 09:29:11: Going to buffer response body of large or unknown size. > Using getResponseBodyAsStream instead is recommended. > 09:29:11: Buffering response body > 09:29:11: enter HeaderParser.parseHeaders(InputStream, String) > 09:29:11: enter HttpParser.readLine(InputStream, String) > 09:29:11: enter HttpParser.readRawLine() > 09:29:11: Resorting to protocol version default close connection > policy > 09:29:11: Should NOT close connection, using HTTP/1.1 > 09:29:11: enter HttpConnection.isResponseAvailable() > 09:29:11: enter HttpConnection.releaseConnection() > 09:29:11: Releasing connection back to connection manager. > 09:29:11: enter getContentCharSet( Header contentheader ) > 09:29:11: enter HeaderElement.parseElements(String) > 09:29:11: enter HeaderElement.parseElements(char[]) > 09:29:11: enter HeaderElement.getParameterByName(String) > > > And now, firefox information about same page: > > > Cookie Information - http://www-dev.fundacionolgatorres.org/index.php > http://www-dev.fundacionolgatorres.org/index.php > Name PHPSESSID > Value 23ed591387689e00636ec63a59a2248a > Host www-dev.fundacionolgatorres.org > Path / > Secure No > Expires At End Of Session > > Name cookIdioma > Value 2 > Host www-dev.fundacionolgatorres.org > Path / > Secure No > Expires viernes, 06 de febrero de 2009 9:34:04 > > > And response headers: > > Response Headers - http://www-dev.fundacionolgatorres.org/index.php > > Date: Tue, 07 Feb 2006 08:29:31 GMT > Server: Apache > X-Powered-By: PHP/5.0.5 > Set-Cookie: PHPSESSID=23ed591387689e00636ec63a59a2248a; path=/ > Expires: Thu, 19 Nov 1981 08:52:00 GMT > Cache-Control: no-store, no-cache, must-revalidate, post-check=0, > pre-check=0 > Pragma: no-cache > Keep-Alive: timeout=15, max=100 > Connection: Keep-Alive > Transfer-Encoding: chunked > Content-Type: text/html; charset=ISO-8859-1 > > 200 OK > > > > Thank a lot!!!!! > > > -----Mensaje original----- > De: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] Enviado el: lunes, 06 > de febrero de 2006 16:36 > Para: HttpClient User Discussion > Asunto: RE: Persistent connections > > On Mon, 2006-02-06 at 16:31 +0100, Juan Luis de Amaya Robles wrote: > > Ok, > > I change the user-agent to Mozilla: > > httpget.addRequestHeader("User-Agent","Mozilla/4.0"); > > > > And cookiePolicy: > > httpclient.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIB > > IL > > IT > > Y); > > > > And the next one is some trace: > > > > Target URL: http://www-dev.fundacionolgatorres.org/index.php > > Response status code: 200 > > Present cookies: > > - PHPSESSID=23ed591387689e00636ec63a59a2248a expire: false > > - cookIdioma=2 expire: false > > > > Request headers: > > > > User-Agent: Mozilla/4.0 > > Cookie: PHPSESSID=23ed591387689e00636ec63a59a2248a > > Cookie: cookIdioma=2 > > Host: www-dev.fundacionolgatorres.org > > > > Response headers: > > > > Date: Mon, 06 Feb 2006 15:20:53 GMT > > Server: Apache > > X-Powered-By: PHP/5.0.5 > > Set-Cookie: PHPSESSID=23ed591387689e00636ec63a59a2248a, > > cookIdioma=2; path=/ > > Expires: Thu, 19 Nov 1981 08:52:00 GMT > > Cache-Control: no-store, no-cache, must-revalidate, post-check=0, > > pre-check=0 > > Pragma: no-cache > > Transfer-Encoding: chunked > > Content-Type: text/html; charset=ISO-8859-1 > > > > This one returns a incorrect page. > > > > But as i tell you before, if I remove the second cookie, The page > > returned is ok. > > > > Where is the error exactly in the header? > > > > I have to correct myself. The header is okay from the spec standpoint. > It is just ambiguous. The trouble is that the path attribute applies > to the last cookie only. Therefore, the path attribute of PHPSESSID is > that of the target URL which may or may not happen to be '/'. > > Post to this list a wire trace generated with a common browser and a > wire trace generated with HttpClient. I'll see what I can make out of > that information. > > Oleg > > --------------------------------------------------------------------- > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
