Dear apache-hc devlist,

I currently try to update the Eclipse/Californium http2coap cross proxy
to use version 5 of the apache-hc-core library instead of version 4.

I'm struggling to get the http-proxy function working again.

My client sends a http request in proxy manner with the host in the
request-line according wireshark:

--------- wireshark ----------------
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 52604, Dst Port: 8080, Seq: 1,
Ack: 1, Len: 171
Hypertext Transfer Protocol
    GET http://localhost:5685/coap-target/coap: HTTP/1.1\r\n
        [Expert Info (Chat/Sequence): GET
http://localhost:5685/coap-target/coap: HTTP/1.1\r\n]
        Request Method: GET
        Request URI: http://localhost:5685/coap-target/coap:
        Request Version: HTTP/1.1
------------------------------------

I use a setup close to the one in the example in

https://github.com/apache/httpcomponents-core/tree/5.1.x/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncFileServerExample.java

registering handlers with:

.register("http*", new AsyncServerRequestHandler() ... for proxy request)
.register("*", new AsyncServerRequestHandler() ... for default normal
request)

similar as before with version 4.

But with version 5 this seems to not work any longer.
Now all requests are passed to the "*" default normal handler.
Logging the RequestLine(httpRequest) and URI in that handler results in:

[HttpServer]: http-proxy received GET /coap-target/coap: HTTP/1.1
[HttpServer]: URI: http://localhost:5685/coap-target/coap:

So, the URI is as intended, but the RequestLine not. I guess, that this
may also be the root cause for not selecting the "http*" proxy handler.

Is there a way to make this working again?
Or what is the preferred way to register handler for incoming
proxy-request (with the final destination included)?
(I only found an example for an reverse proxy, that uses "*".
But I didn't find some stuff for a forward proxy.)

Best regards
Achim Kraus

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to