Skip to content

httpClientContext should not be reused between non-consecutive requests #57

@MosheElisha

Description

@MosheElisha

Hi,

Currently the HttpClientContext is stored in HttpClientRestClient#httpClientContext and reused in the various requests.

According to the org.apache.http.protocol.HttpContext docs can be reused but when there are several consecutive messages (for example, redirects) and not when using concurrently in multiple threads.

This issue was raised after I tried to get OpenTracing TracingHttpClientBuilder to work but noticed strange behavior.

The OpenTracing mechanism uses the context to temporarily store the OpenTracing span for cases like redirects.

Using the same context aggregated all the requests under the same trace (which shouldn't have happened).

I suggest to move the logic that creates the HttpClientContext into a method and call it on every submitXxxRequest so a new context will be created for every request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions