Well this isn’t really for a game, but I’m trying to write a proxy in java.
It works well and all, but I just don’t know how to get it to work with SSL connections.
It reads headers from the client (my browser) and just sends them directly to the remote address being accessed, only the first line of the headers is modified as so:
byte[] headerAsBytes = (tokens[0] + " " + tokens[1] + " HTTP/1.0\r\n").getBytes();
tokens[0] is the request method (which is “CONNECT” for https) and tokens[1] is the (local address, example if you are accessing example.com/cool, tokens[1] would be “/cool”).
I send the rest of the headers directly after reading:
int totalHeader = 0;
int len;
while ((len = in.read(buf)) != -1) {
out.write(buf, 0, len);
println("Wrote " + len + " header bytes.");
out.flush();
totalHeader += len;
if (in.available() == 0)
break;
}
now how do I go about making this work with secure connections :\