简体   繁体   中英

Run http server proxy in android?

is it possible to create a mini HTTP server that acts as a proxy where i can recieve any requests from a webview and it will pass that request to my http proxy server running inside the app that can then view the raw contents of that request(http headers, bodies etc) and handle it from my own proxy?

I can see that the apahce libraries only contain objects that allow you to create requests and handle responses but not how i can create a mini http server.

Thanks

I don't understand the question fully so here's the question I am going to be answering.

Is it possible to create a HTTP server that allows me to view the source code of a web page.

The answer is: yes.

Since I don't really develop for Android phones, I'm only going to list out what you should do.


So first of all you want to accept a connection from a client. Then you might want to send it back a HTML page containing a form with a website URL field. If you set the method to POST, you will be able to make the URL of any length. Now your server needs to know how to receive the HTTP POST request. I don't really know the HTTP well enough to tell you how the request-response is encoded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM