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

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

Joson created HTTPCLIENT-1356:
---------------------------------

             Summary: [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
             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