A simple proxy - problem returning response data to the client
posted 3 years ago
My programming assignment requires me to create a proxy in between client and server.
My client make a request to server through the proxy, then the proxy forwards it and returns back the response from the server to the client.
Here's the steps I took:
1) get request from client and store the request data into a byte array
2) read from the byte array using buffered reader
3) get the host name from the Host: header field and create a serverSocket with it
4) forward the request data to the serverSocket outputstream
5) retrieve the response data from the serverSocket inputstream into another byte array
6) write contents from the byte array into clientSocket output stream
However, after step 6, the browser is unable to display the response data. Any help?