You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Dmitry Potapov (JIRA)" <ji...@apache.org> on 2013/05/25 13:25:20 UTC

[jira] [Commented] (HTTPCLIENT-1356) [commons-httpclient 3.1] HttpElement.parseElements missing values

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13667052#comment-13667052 ] 

Dmitry Potapov commented on HTTPCLIENT-1356:
--------------------------------------------

You can get "Path" value by calling getParameterByName("Path");
See RFC2616 ยง4.2 for more information about commas in field content
                
> [commons-httpclient 3.1] HttpElement.parseElements missing values
> -----------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1356
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1356
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 3.1 Final
>         Environment: commons-httpclient 3.1
>            Reporter: Joson
>              Labels: commons-httpclient
>             Fix For: 3.1 Final
>
>
> I'm using commons-httpclient-3.1. 
> I invoked a login request by PostMethod and get a success response. Here is the Set-Cookie header:
>     Set-Cookie: JSESSIONID=7798b313-6892-4c45-ac8e-8ccb6f390472; Path=/nexus; HttpOnly
> I tried to parse it:
>     HeaderElement[] elems = HeaderElement.parseElements(header.getValue());
>     System.out.println(header+"--->"+elems.length);
> It would only got the first element JSESSIONID, and others such as Path is missing.
> I trace it and found such codes in HeaderElement.parseElements:
>     if (ch == '"') {
>         qouted = !qouted;
>     }
>     HeaderElement element = null;
>     if ((!qouted) && (ch == ',')) {
>         element = new HeaderElement(headerValue, from, i);
>         from = i + 1;
>     } else if (i == len - 1) {
>         element = new HeaderElement(headerValue, from, len);
>     }
> Is this a bug 'coz org.apache.commons.httpclient.Header.getValue just return a header string without quotes and ',' ?

--
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