JPProxy update

This commit is contained in:
Jindra Petk
2011-07-16 12:40:49 +02:00
parent 991b08d8bc
commit 49a8fd03bf
24 changed files with 2419 additions and 1577 deletions

View File

@@ -2,39 +2,38 @@ package com.jpexs.proxy;
import java.io.IOException;
/**
* @author Mark Boyns
*/
class Https extends HttpConnection {
boolean proxy = false;
Https(String host, int port) throws IOException {
super(host, port);
}
boolean proxy = false;
Https(String host, int port, boolean isProxy) throws IOException {
this(host, port);
proxy = isProxy;
}
Https(String host, int port) throws IOException {
super(host, port);
}
public void sendRequest(Request request)
throws IOException, RetryRequestException {
if (proxy) {
super.sendRequest(request);
} else {
/* nothing */
}
}
Https(String host, int port, boolean isProxy) throws IOException {
this(host, port);
proxy = isProxy;
}
public Reply recvReply(Request request)
throws IOException, RetryRequestException {
Reply reply = new Reply(getInputStream());
if (proxy) {
reply.read();
} else {
reply.statusLine = "HTTP/1.0 200 Connection established";
reply.setHeaderField("Proxy-agent", "ASDec");
}
return reply;
}
}
public void sendRequest(Request request)
throws IOException, RetryRequestException {
if (proxy) {
super.sendRequest(request);
} else {
/* nothing */
}
}
public Reply recvReply(Request request)
throws java.io.IOException, RetryRequestException {
Reply reply = new Reply(getInputStream());
if (proxy) {
reply.read();
} else {
reply.statusLine = "HTTP/1.0 200 Connection established";
reply.setHeaderField("Proxy-agent", ProxyConfig.appName);
}
return reply;
}
}