/** the socket's inputstream */
InputStream in = null;
- /** the socket's outputstream */
- PrintWriter out = null;
-
/** the username and password portions of the URL */
String userInfo = null;
// Everything Else ////////////////////////////////////////////////////////////////////////////
private synchronized void connect() throws IOException {
- if (sock != null && !"".equals(originalUrl)) {
+ if (sock != null) {
if (in == null) in = new BufferedInputStream(sock.getInputStream());
return;
}
// grab the userinfo; gcj doesn't have java.net.URL.getUserInfo()
String url = originalUrl;
-
- if ("".equals(url)) {
- userInfo = "";
- this.url = null;
- port = 80;
- path = "/RPC2";
- host = "";
- in = System.in;
- out = new PrintWriter(System.out);
- return;
- }
-
userInfo = url.substring(url.indexOf("://") + 3);
userInfo = userInfo.indexOf('/') == -1 ? userInfo : userInfo.substring(0, userInfo.indexOf('/'));
if (userInfo.indexOf('@') != -1) {
} else {
userInfo = null;
}
-
+
if (url.startsWith("https:")) {
this.url = new URL("http" + url.substring(5));
ssl = true;
} else {
this.url = new URL(url);
}
-
if (!skipResolveCheck) resolveAndCheckIfFirewalled(this.url.getHost());
port = this.url.getPort();
path = this.url.getFile();
if (sock == null) sock = attemptDirect();
if (sock == null) throw new HTTPException("unable to contact host " + host);
if (in == null) in = new BufferedInputStream(sock.getInputStream());
- if (out == null) out = new PrintWriter(new OutputStreamWriter(sock.getOutputStream()));
}
public void sendRequest(String contentType, String content) throws IOException {
- PrintWriter pw = out;
+ PrintWriter pw = new PrintWriter(new OutputStreamWriter(sock.getOutputStream()));
if (content != null) {
pw.print("POST " + path + " HTTP/1.1\r\n");
int contentLength = content.substring(0, 2).equals("\r\n") ?