NonRepeatableRequestException when using NTLM or BASIC Authentication with camel-http4

Solution Verified - Updated -

Issue

There is likely a issue if you use http4 producer with basic or ntlm authentication. The message body may be read when sending to the http server, exhausting the stream. Then when the downstream server returns an authentication challenge to the client, the client then attempts to re-submit the request with credentials included. At this point, the message body must be re-sent but due to streaming the body is not re-readable and you can get a NonRepeatableRequestException:

Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity.
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:226) ~[?:?]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) ~[?:?]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[?:?]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) ~[?:?]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[?:?]
... 37 more

This behavior is not observed with the camel-http component.

Environment

Red Hat Fuse 6.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content