User7723337
User7723337

Reputation: 12018

Modifying HTTP Request line in the HTTP request

I have a HTTP proxy running as android service where i want to change the request URL from the header, But i am unable to find how to do it.

Suppose i have a HTTP request coming to my proxy like below:
GET /index.html HTTP/1.1

Then i want to change this request to:
GET /index2.html HTTP/1.1

I Have a android HttpRequestHandler class where i get all HTTP requests.
in the handle function of HttpRequestHandler class i get 'HttpRequest' class object where i need to modify the request line but this class does not provide any functions/API to do so. I can see the requested URL by calling function getRequestLine() of HttpRequest class which returns RequestLine class object.

So anyone know how to change the request line of the request.

Upvotes: 0

Views: 369

Answers (1)

18446744073709551615
18446744073709551615

Reputation: 16832

The doc reads abstract RequestLine getRequestLine() -- this means that you get some derived class (you may print it into the debug log if you wish). I think you are supposed to create a new instance of a class derived from HttpRequest and pass on that request rather than the original one.

Upvotes: 1

Related Questions