Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1324

AjpRequestParser does not use encoding when parsing AJP attributes

    XMLWordPrintable

Details

    • Hide
      • Set up an Apache communicating with Undertow via AJP13, mod_jk
      • Add AJP listener to Undertow
      • Send some attributes containing some characters encoded with UTF-8 (for example "é")
      • Check how they are processed in Undertow
      Show
      Set up an Apache communicating with Undertow via AJP13, mod_jk Add AJP listener to Undertow Send some attributes containing some characters encoded with UTF-8 (for example "é") Check how they are processed in Undertow

    Description

      When using Undertow 1.4.22.Final which is pulled in by Maven when using Spring Boot 2.0.0.RELEASE we have noticed that AJP attributes which use some unicode characters are not processed (encoded) properly.

      While debugging, we also have noticed that if we downgrade the version of Undertow to 1.4.21.Final the problem goes away.

      Looking at code, in the version 1.4.21.Final, in class io.undertow.server.protocol.ajp.AjpRequestParseState

      the final value of an AJP attribute will be given by the method below, which indeed takes into the account the charset (encoding)

      public String getStringAndClear(String charset) throws UnsupportedEncodingException {
              String ret = new String(currentString, 0, currentStringLength, charset);
              currentStringLength = 0;
              return ret;
          }
      

      The same method in the version 1.4.22.Final and all later versions does not take into consideration the charset, which results in the value of (unicode) attributes to be encoded incorrectly in some cases.

      Note that all the settings related to charset are set to UTF-8 in our tests: Spring Boot filters, java.file VM argument, etc.

      Attachments

        Issue Links

          Activity

            People

              rhn-cservice-bbaranow Bartosz Baranowski
              george.ushakov George Ushakov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: