Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1356

[commons-httpclient 3.1] HttpElement.parseElements missing values

    XMLWordPrintableJSON

Details

    Description

      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 ',' ?

      Attachments

        Activity

          People

            Unassigned Unassigned
            joson Joson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: