Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-13193

Camel http4 and undertow producers fails with 400 error if some unicode characters are used in any of the headers.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • None
    • fuse-7.5-GA
    • Camel, Undertow
    • None
    • % %
    • Hide
          <camelContext xmlns="http://camel.apache.org/schema/spring" >
        <restConfiguration component="jetty" contextPath="/rest" scheme="http" bindingMode="auto" port="9999"/>
              <rest path="/users/">
                  <post>
                      <to uri="log:log1?showAll=true"/>
                  </post>
              </rest>
              <route>
                 <from uri="timer:timer?period=10000&amp;delay=2000&amp;repeatCount=1"/>
                  <setBody>
                      <constant>{"phoneNumber": "3432432","message": "ewrwrwr"}</constant>
                  </setBody>
                  <setHeader headerName="header1">
                      <constant>И</constant>
                  </setHeader>
                  <setHeader headerName="CamelHttpMethod">
                      <constant>POST</constant>
                  </setHeader>
                  <to uri="http4://localhost:9999/rest/users/"/>
              </route>
          </camelContext>
      
      Show
      <camelContext xmlns= "http: //camel.apache.org/schema/spring" > <restConfiguration component= "jetty" contextPath= "/ rest " scheme= "http" bindingMode= "auto" port= "9999" /> < rest path= "/users/" > <post> <to uri= "log:log1?showAll= true " /> </post> </ rest > <route> <from uri= "timer:timer?period=10000&amp;delay=2000&amp;repeatCount=1" /> <setBody> <constant>{ "phoneNumber" : "3432432" , "message" : "ewrwrwr" }</constant> </setBody> <setHeader headerName= "header1" > <constant>И</constant> </setHeader> <setHeader headerName= "CamelHttpMethod" > <constant>POST</constant> </setHeader> <to uri= "http4: //localhost:9999/ rest /users/" /> </route> </camelContext>

      Some Unicode characters do not work in the header values for http4 or undertow producer.
      For example, И doesn't work:

      <setHeader headerName="header1">
                      <constant>И</constant>
                  </setHeader>
      

      but и works:

      <setHeader headerName="header1">
                      <constant>и</constant>
                  </setHeader>
      
      2020-03-16 19:14:24.858 DEBUG 19321 --- [- timer://timer] h.i.c.PoolingHttpClientConnectionManager : Connection leased: [id: 0][route: {}->http://localhost:9999][total kept alive: 0; route allocated: 1 of 20; total allocated: 1 of 200]
      2020-03-16 19:14:24.860 DEBUG 19321 --- [- timer://timer] o.a.http.impl.execchain.MainClientExec   : Opening connection {}->http://localhost:9999
      2020-03-16 19:14:24.864 DEBUG 19321 --- [- timer://timer] .i.c.DefaultHttpClientConnectionOperator : Connecting to localhost/127.0.0.1:9999
      2020-03-16 19:14:24.865 DEBUG 19321 --- [- timer://timer] .i.c.DefaultHttpClientConnectionOperator : Connection established 127.0.0.1:53222<->127.0.0.1:9999
      2020-03-16 19:14:24.866 DEBUG 19321 --- [- timer://timer] o.a.http.impl.execchain.MainClientExec   : Executing request POST /rest/users/ HTTP/1.1
      2020-03-16 19:14:24.866 DEBUG 19321 --- [- timer://timer] o.a.http.impl.execchain.MainClientExec   : Target auth state: UNCHALLENGED
      2020-03-16 19:14:24.867 DEBUG 19321 --- [- timer://timer] o.a.http.impl.execchain.MainClientExec   : Proxy auth state: UNCHALLENGED
      2020-03-16 19:14:24.870 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 >> POST /rest/users/ HTTP/1.1
      2020-03-16 19:14:24.870 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 >> breadcrumbId: ID-adongre-pnq-csb-1584366259201-0-1
      2020-03-16 19:14:24.870 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 >> firedTime: Mon Mar 16 19:14:24 IST 2020
      2020-03-16 19:14:24.870 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 >> header1: И
      2020-03-16 19:14:24.870 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 >> Content-Length: 47
      2020-03-16 19:14:24.870 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 >> Content-Type: text/plain
      2020-03-16 19:14:24.870 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 >> Host: localhost:9999
      2020-03-16 19:14:24.870 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 >> Connection: Keep-Alive
      2020-03-16 19:14:24.870 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.6 (Java/1.8.0_181)
      2020-03-16 19:14:24.870 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 >> Accept-Encoding: gzip,deflate
      2020-03-16 19:14:24.872 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 >> "POST /rest/users/ HTTP/1.1[\r][\n]"
      2020-03-16 19:14:24.872 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 >> "breadcrumbId: ID-adongre-pnq-csb-1584366259201-0-1[\r][\n]"
      2020-03-16 19:14:24.872 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 >> "firedTime: Mon Mar 16 19:14:24 IST 2020[\r][\n]"
      2020-03-16 19:14:24.872 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 >> "header1: [0x18][\r][\n]"
      2020-03-16 19:14:24.872 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 >> "Content-Length: 47[\r][\n]"
      2020-03-16 19:14:24.872 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 >> "Content-Type: text/plain[\r][\n]"
      2020-03-16 19:14:24.872 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 >> "Host: localhost:9999[\r][\n]"
      2020-03-16 19:14:24.880 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
      2020-03-16 19:14:24.880 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.6 (Java/1.8.0_181)[\r][\n]"
      2020-03-16 19:14:24.880 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
      2020-03-16 19:14:24.880 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 >> "[\r][\n]"
      2020-03-16 19:14:24.880 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 >> "{"phoneNumber": "3432432","message": "ewrwrwr"}"
      2020-03-16 19:14:24.953 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 << "HTTP/1.1 400 Illegal character CNTL=0x18[\r][\n]"
      2020-03-16 19:14:24.953 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 << "Content-Type: text/html;charset=iso-8859-1[\r][\n]"
      2020-03-16 19:14:24.953 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 << "Content-Length: 70[\r][\n]"
      2020-03-16 19:14:24.953 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 << "Connection: close[\r][\n]"
      2020-03-16 19:14:24.953 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 << "Server: Jetty(9.4.12.v20180830)[\r][\n]"
      2020-03-16 19:14:24.953 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 << "[\r][\n]"
      2020-03-16 19:14:24.953 DEBUG 19321 --- [- timer://timer] org.apache.http.wire                     : http-outgoing-0 << "<h1>Bad Message 400</h1><pre>reason: Illegal character CNTL=0x18</pre>"
      2020-03-16 19:14:24.956 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 << HTTP/1.1 400 Illegal character CNTL=0x18
      2020-03-16 19:14:24.956 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 << Content-Type: text/html;charset=iso-8859-1
      2020-03-16 19:14:24.957 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 << Content-Length: 70
      2020-03-16 19:14:24.957 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 << Connection: close
      2020-03-16 19:14:24.957 DEBUG 19321 --- [- timer://timer] org.apache.http.headers                  : http-outgoing-0 << Server: Jetty(9.4.12.v20180830)
      2020-03-16 19:14:24.964 DEBUG 19321 --- [- timer://timer] h.i.c.DefaultManagedHttpClientConnection : http-outgoing-0: Close connection
      2020-03-16 19:14:24.964 DEBUG 19321 --- [- timer://timer] o.a.http.impl.execchain.MainClientExec   : Connection discarded
      2020-03-16 19:14:24.964 DEBUG 19321 --- [- timer://timer] h.i.c.PoolingHttpClientConnectionManager : Connection released: [id: 0][route: {}->http://localhost:9999][total kept alive: 0; route allocated: 0 of 20; total allocated: 0 of 200]
      2020-03-16 19:14:24.970 ERROR 19321 --- [- timer://timer] o.a.camel.processor.DefaultErrorHandler  : Failed delivery for (MessageId: ID-adongre-pnq-csb-1584366259201-0-2 on ExchangeId: ID-adongre-pnq-csb-1584366259201-0-1). Exhausted after delivery attempt: 1 caught: org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking http://localhost:9999/rest/users/ with statusCode: 400
      
      Message History
      ---------------------------------------------------------------------------------------------------------------------------------------
      RouteId              ProcessorId          Processor                                                                        Elapsed (ms)
      [route2            ] [route2            ] [timer://timer?delay=2000&period=10000&repeatCount=1                           ] [       243]
      [route2            ] [setBody1          ] [setBody[constant{{"phoneNumber": "3432432","message": "ewrwrwr"}}]            ] [        12]
      [route2            ] [setHeader1        ] [setHeader[header1]                                                            ] [         0]
      [route2            ] [setHeader2        ] [setHeader[CamelHttpMethod]                                                    ] [         0]
      [route2            ] [to1               ] [http4://localhost:9999/rest/users/                                            ] [       224]
      
      Stacktrace
      ---------------------------------------------------------------------------------------------------------------------------------------
      
      org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking http://localhost:9999/rest/users/ with statusCode: 400
      	at org.apache.camel.component.http4.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:313) ~[camel-http4-2.21.0.fuse-740039-redhat-00001.jar:2.21.0.fuse-740039-redhat-00001]
      	at org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:208) ~[camel-http4-2.21.0.fuse-740039-redhat-00001.jar:2.21.0.fuse-740039-redhat-00001]
      	at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) ~[camel-core-2.21.0.fuse-740039-redhat-00001.jar:2.21.0.fuse-740039-redhat-00001]
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148) ~[camel-core-2.21.0.fuse-740039-redhat-00001.jar:2.21.0.fuse-740039-redhat-00001]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) ~[camel-core-2.21.0.fuse-740039-redhat-00001.jar:2.21.0.fuse-740039-redhat-00001]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.21.0.fuse-740039-redhat-00001.jar:2.21.0.fuse-740039-redhat-00001]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) [camel-core-2.21.0.fuse-740039-redhat-00001.jar:2.21.0.fuse-740039-redhat-00001]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) [camel-core-2.21.0.fuse-740039-redhat-00001.jar:2.21.0.fuse-740039-redhat-00001]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.21.0.fuse-740039-redhat-00001.jar:2.21.0.fuse-740039-redhat-00001]
      	at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197) [camel-core-2.21.0.fuse-740039-redhat-00001.jar:2.21.0.fuse-740039-redhat-00001]
      	at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79) [camel-core-2.21.0.fuse-740039-redhat-00001.jar:2.21.0.fuse-740039-redhat-00001]
      	at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_181]
      	at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_181]
      
      

      This works fine with netty-http

              ldemasi Luigi De Masi
              rhn-support-adongre Avinash Dongre
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: