summaryrefslogtreecommitdiff
path: root/gnu/java/net/protocol/http
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/java/net/protocol/http')
-rw-r--r--gnu/java/net/protocol/http/Authenticator.java5
-rw-r--r--gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java5
-rw-r--r--gnu/java/net/protocol/http/ChunkedInputStream.java27
-rw-r--r--gnu/java/net/protocol/http/Cookie.java5
-rw-r--r--gnu/java/net/protocol/http/CookieManager.java4
-rw-r--r--gnu/java/net/protocol/http/Credentials.java5
-rw-r--r--gnu/java/net/protocol/http/HTTPConnection.java21
-rw-r--r--gnu/java/net/protocol/http/HTTPDateFormat.java19
-rw-r--r--gnu/java/net/protocol/http/HTTPURLConnection.java209
-rw-r--r--gnu/java/net/protocol/http/Handler.java3
-rw-r--r--gnu/java/net/protocol/http/Headers.java54
-rw-r--r--gnu/java/net/protocol/http/Request.java39
-rw-r--r--gnu/java/net/protocol/http/RequestBodyWriter.java5
-rw-r--r--gnu/java/net/protocol/http/Response.java15
-rw-r--r--gnu/java/net/protocol/http/ResponseHeaderHandler.java5
-rw-r--r--gnu/java/net/protocol/http/SimpleCookieManager.java5
16 files changed, 206 insertions, 220 deletions
diff --git a/gnu/java/net/protocol/http/Authenticator.java b/gnu/java/net/protocol/http/Authenticator.java
index 0d7c98819..b4ee41e11 100644
--- a/gnu/java/net/protocol/http/Authenticator.java
+++ b/gnu/java/net/protocol/http/Authenticator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -54,6 +54,5 @@ public interface Authenticator
* unsuccessful attempt
*/
Credentials getCredentials(String realm, int attempt);
-
-}
+}
diff --git a/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java b/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java
index 35ad2bccf..22a33ccd3 100644
--- a/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java
+++ b/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -102,6 +102,5 @@ public class ByteArrayRequestBodyWriter
}
return len;
}
-
-}
+}
diff --git a/gnu/java/net/protocol/http/ChunkedInputStream.java b/gnu/java/net/protocol/http/ChunkedInputStream.java
index 8a30e51db..33df0df95 100644
--- a/gnu/java/net/protocol/http/ChunkedInputStream.java
+++ b/gnu/java/net/protocol/http/ChunkedInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -158,15 +158,15 @@ public class ChunkedInputStream
}
else
{
- int canRead = Math.min(size - count, length);
- int len = in.read(buffer, offset, canRead);
- if (len == -1)
- {
- // This is an error condition but it isn't clear what we
- // should do with it.
- eof = true;
- return -1;
- }
+ int canRead = Math.min(size - count, length);
+ int len = in.read(buffer, offset, canRead);
+ if (len == -1)
+ {
+ // This is an error condition but it isn't clear what we
+ // should do with it.
+ eof = true;
+ return -1;
+ }
count += len;
if (count == size)
{
@@ -205,20 +205,19 @@ public class ChunkedInputStream
{
if (meta)
return 0;
-
+
return Math.min(in.available(), size - count);
}
/**
* This method closes the ChunkedInputStream by closing the underlying
* InputStream.
- *
+ *
* @exception IOException If an error occurs
*/
public void close() throws IOException
{
in.close();
}
-
-}
+}
diff --git a/gnu/java/net/protocol/http/Cookie.java b/gnu/java/net/protocol/http/Cookie.java
index 4482a121e..122a23f79 100644
--- a/gnu/java/net/protocol/http/Cookie.java
+++ b/gnu/java/net/protocol/http/Cookie.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -138,7 +138,7 @@ public class Cookie
{
return toString(true, true);
}
-
+
public String toString(boolean showPath, boolean showDomain)
{
CPStringBuilder buf = new CPStringBuilder();
@@ -159,4 +159,3 @@ public class Cookie
}
}
-
diff --git a/gnu/java/net/protocol/http/CookieManager.java b/gnu/java/net/protocol/http/CookieManager.java
index cc1225c49..da3686689 100644
--- a/gnu/java/net/protocol/http/CookieManager.java
+++ b/gnu/java/net/protocol/http/CookieManager.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -61,5 +61,5 @@ public interface CookieManager
* @param path the path to access
*/
Cookie[] getCookies(String host, boolean secure, String path);
-
+
}
diff --git a/gnu/java/net/protocol/http/Credentials.java b/gnu/java/net/protocol/http/Credentials.java
index 9e5fcd172..f95b4b53c 100644
--- a/gnu/java/net/protocol/http/Credentials.java
+++ b/gnu/java/net/protocol/http/Credentials.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -83,6 +83,5 @@ public class Credentials
{
return password;
}
-
-}
+}
diff --git a/gnu/java/net/protocol/http/HTTPConnection.java b/gnu/java/net/protocol/http/HTTPConnection.java
index 44b1a608a..b96bf4c54 100644
--- a/gnu/java/net/protocol/http/HTTPConnection.java
+++ b/gnu/java/net/protocol/http/HTTPConnection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -201,7 +201,7 @@ public class HTTPConnection
this(hostname, secure ? HTTPS_PORT : HTTP_PORT, secure,
connectionTimeout, timeout);
}
-
+
/**
* Creates a new HTTP connection on the specified port.
* @param hostname the name of the host to connect to
@@ -222,7 +222,7 @@ public class HTTPConnection
{
this(hostname, port, secure, 0, 0);
}
-
+
/**
* Creates a new HTTP or HTTPS connection on the specified port.
* @param hostname the name of the host to connect to
@@ -239,7 +239,7 @@ public class HTTPConnection
{
if (connectionTimeout < 0 || timeout < 0)
throw new IllegalArgumentException();
-
+
this.hostname = hostname;
this.port = port;
this.secure = secure;
@@ -477,8 +477,8 @@ public class HTTPConnection
*/
synchronized HTTPConnection get(String host,
int port,
- boolean secure,
- int connectionTimeout, int timeout)
+ boolean secure,
+ int connectionTimeout, int timeout)
{
String ttl =
SystemProperties.getProperty("classpath.net.http.keepAliveTTL");
@@ -510,7 +510,7 @@ public class HTTPConnection
}
HTTPConnection c = null;
-
+
ListIterator it = connectionPool.listIterator(0);
while (it.hasNext())
{
@@ -584,7 +584,7 @@ public class HTTPConnection
}
}
}
-
+
/**
* The number of times this HTTPConnection has be used via keep-alive.
*/
@@ -618,7 +618,7 @@ public class HTTPConnection
{
useCount++;
pool.put(this);
-
+
}
else
{
@@ -878,7 +878,7 @@ public class HTTPConnection
}
// -- Events --
-
+
void addHandshakeCompletedListener(HandshakeCompletedListener l)
{
synchronized (handshakeCompletedListeners)
@@ -895,4 +895,3 @@ public class HTTPConnection
}
}
-
diff --git a/gnu/java/net/protocol/http/HTTPDateFormat.java b/gnu/java/net/protocol/http/HTTPDateFormat.java
index 2f59e4318..743f8e8e2 100644
--- a/gnu/java/net/protocol/http/HTTPDateFormat.java
+++ b/gnu/java/net/protocol/http/HTTPDateFormat.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -145,7 +145,7 @@ public class HTTPDateFormat
// Get time offset in minutes
int zoneOffset =(calendar.get(Calendar.ZONE_OFFSET) +
calendar.get(Calendar.DST_OFFSET)) / 60000;
-
+
// Apply + or - appropriately
if (zoneOffset < 0)
{
@@ -156,7 +156,7 @@ public class HTTPDateFormat
{
buf.append('+');
}
-
+
// Set the 2 2-char fields as specified above
int tzhours = zoneOffset / 60;
buf.append(Character.forDigit(tzhours / 10, 10));
@@ -340,14 +340,14 @@ public class HTTPDateFormat
}
second = Integer.parseInt(text.substring(start, end));
}
-
+
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.DAY_OF_MONTH, date);
calendar.set(Calendar.HOUR, hour);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, second);
-
+
if (end != len)
{
// Timezone
@@ -380,7 +380,7 @@ public class HTTPDateFormat
}
}
pos.setIndex(end);
-
+
return calendar.getTime();
}
catch (NumberFormatException e)
@@ -400,7 +400,7 @@ public class HTTPDateFormat
{
pos++;
}
- return pos;
+ return pos;
}
private int skipNonWhitespace(String text, int pos)
@@ -409,7 +409,7 @@ public class HTTPDateFormat
{
pos++;
}
- return pos;
+ return pos;
}
private int skipTo(String text, int pos, char c)
@@ -418,7 +418,7 @@ public class HTTPDateFormat
{
pos++;
}
- return pos;
+ return pos;
}
/**
@@ -438,4 +438,3 @@ public class HTTPDateFormat
}
}
-
diff --git a/gnu/java/net/protocol/http/HTTPURLConnection.java b/gnu/java/net/protocol/http/HTTPURLConnection.java
index b31f42669..9ba5c4793 100644
--- a/gnu/java/net/protocol/http/HTTPURLConnection.java
+++ b/gnu/java/net/protocol/http/HTTPURLConnection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -151,7 +151,7 @@ public class HTTPURLConnection
}
final Credentials creds = (username == null) ? null :
new Credentials (username, password);
-
+
if ("POST".equals(method))
{
String contentType = requestHeaders.getValue("Content-Type");
@@ -241,113 +241,113 @@ public class HTTPURLConnection
throw ioe;
}
}
-
+
if (response.isRedirect() && getInstanceFollowRedirects())
{
- // Read the response body, if there is one. If the
- // redirect points us back at the same server, we will use
- // the cached connection, so we must make sure there is no
- // pending data in it.
+ // Read the response body, if there is one. If the
+ // redirect points us back at the same server, we will use
+ // the cached connection, so we must make sure there is no
+ // pending data in it.
InputStream body = response.getBody();
- if (body != null)
- {
- byte[] ignore = new byte[1024];
- while (true)
- {
- int n = body.read(ignore, 0, ignore.length);
- if (n == -1)
- break;
- }
- }
+ if (body != null)
+ {
+ byte[] ignore = new byte[1024];
+ while (true)
+ {
+ int n = body.read(ignore, 0, ignore.length);
+ if (n == -1)
+ break;
+ }
+ }
// Follow redirect
String location = response.getHeader("Location");
- if (location != null)
- {
- String connectionUri = connection.getURI();
- int start = connectionUri.length();
- if (location.startsWith(connectionUri) &&
- location.charAt(start) == '/')
- {
- file = location.substring(start);
- retry = true;
- }
- else if (location.startsWith("http:"))
- {
- connection.close();
- connection = null;
- secure = false;
- start = 7;
- int end = location.indexOf('/', start);
+ if (location != null)
+ {
+ String connectionUri = connection.getURI();
+ int start = connectionUri.length();
+ if (location.startsWith(connectionUri) &&
+ location.charAt(start) == '/')
+ {
+ file = location.substring(start);
+ retry = true;
+ }
+ else if (location.startsWith("http:"))
+ {
+ connection.close();
+ connection = null;
+ secure = false;
+ start = 7;
+ int end = location.indexOf('/', start);
if (end == -1)
end = location.length();
- host = location.substring(start, end);
- int ci = host.lastIndexOf(':');
- if (ci != -1)
- {
- port = Integer.parseInt(host.substring (ci + 1));
- host = host.substring(0, ci);
- }
- else
- {
- port = HTTPConnection.HTTP_PORT;
- }
- file = location.substring(end);
- retry = true;
- }
- else if (location.startsWith("https:"))
- {
- connection.close();
- connection = null;
- secure = true;
- start = 8;
- int end = location.indexOf('/', start);
+ host = location.substring(start, end);
+ int ci = host.lastIndexOf(':');
+ if (ci != -1)
+ {
+ port = Integer.parseInt(host.substring (ci + 1));
+ host = host.substring(0, ci);
+ }
+ else
+ {
+ port = HTTPConnection.HTTP_PORT;
+ }
+ file = location.substring(end);
+ retry = true;
+ }
+ else if (location.startsWith("https:"))
+ {
+ connection.close();
+ connection = null;
+ secure = true;
+ start = 8;
+ int end = location.indexOf('/', start);
if (end == -1)
end = location.length();
- host = location.substring(start, end);
- int ci = host.lastIndexOf(':');
- if (ci != -1)
- {
- port = Integer.parseInt(host.substring (ci + 1));
- host = host.substring(0, ci);
- }
- else
- {
- port = HTTPConnection.HTTPS_PORT;
- }
- file = location.substring(end);
- retry = true;
- }
- else if (location.length() > 0)
- {
- // Malformed absolute URI, treat as file part of URI
- if (location.charAt(0) == '/')
- {
- // Absolute path
- file = location;
- }
- else
- {
- // Relative path
- int lsi = file.lastIndexOf('/');
- file = (lsi == -1) ? "/" : file.substring(0, lsi + 1);
- file += location;
- }
- retry = true;
- }
- }
+ host = location.substring(start, end);
+ int ci = host.lastIndexOf(':');
+ if (ci != -1)
+ {
+ port = Integer.parseInt(host.substring (ci + 1));
+ host = host.substring(0, ci);
+ }
+ else
+ {
+ port = HTTPConnection.HTTPS_PORT;
+ }
+ file = location.substring(end);
+ retry = true;
+ }
+ else if (location.length() > 0)
+ {
+ // Malformed absolute URI, treat as file part of URI
+ if (location.charAt(0) == '/')
+ {
+ // Absolute path
+ file = location;
+ }
+ else
+ {
+ // Relative path
+ int lsi = file.lastIndexOf('/');
+ file = (lsi == -1) ? "/" : file.substring(0, lsi + 1);
+ file += location;
+ }
+ retry = true;
+ }
+ }
}
else
{
responseSink = response.getBody();
-
+
if (response.isError())
- errorSink = responseSink;
+ errorSink = responseSink;
}
}
while (retry);
connected = true;
- }
+ }
/**
* Returns a connection, from the pool if necessary.
@@ -425,7 +425,7 @@ public class HTTPURLConnection
}
public String getRequestProperty(String key)
- {
+ {
return requestHeaders.getValue(key);
}
@@ -433,7 +433,7 @@ public class HTTPURLConnection
{
if (connected)
throw new IllegalStateException("Already connected");
-
+
Map<String, List<String>> m = requestHeaders.getAsMap();
return Collections.unmodifiableMap(m);
}
@@ -441,7 +441,7 @@ public class HTTPURLConnection
public void setRequestProperty(String key, String value)
{
super.setRequestProperty(key, value);
-
+
requestHeaders.put(key, value);
}
@@ -477,9 +477,9 @@ public class HTTPURLConnection
}
return requestSink;
}
-
+
// -- Response --
-
+
public InputStream getInputStream()
throws IOException
{
@@ -491,17 +491,17 @@ public class HTTPURLConnection
{
throw new ProtocolException("doInput is false");
}
-
+
if (response.isError())
{
int code = response.getCode();
if (code == 404 || code == 410)
throw new FileNotFoundException(url.toString());
-
+
throw new IOException("Server returned HTTP response code " + code
+ " for URL " + url.toString());
}
-
+
return responseSink;
}
@@ -535,7 +535,7 @@ public class HTTPURLConnection
" " + response.getCode() +
" " + response.getMessage();
}
-
+
public String getHeaderField(int index)
{
if (!connected)
@@ -641,7 +641,7 @@ public class HTTPURLConnection
}
return handshakeEvent.getCipherSuite();
}
-
+
public Certificate[] getLocalCertificates()
{
if (!connected)
@@ -681,14 +681,13 @@ public class HTTPURLConnection
super.setReadTimeout(timeout);
if (connection == null)
return;
- try
+ try
{
- connection.getSocket().setSoTimeout(timeout);
- }
+ connection.getSocket().setSoTimeout(timeout);
+ }
catch (IOException se)
{
- // Ignore socket exceptions.
+ // Ignore socket exceptions.
}
}
}
-
diff --git a/gnu/java/net/protocol/http/Handler.java b/gnu/java/net/protocol/http/Handler.java
index 640542513..30810321d 100644
--- a/gnu/java/net/protocol/http/Handler.java
+++ b/gnu/java/net/protocol/http/Handler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -70,4 +70,3 @@ public class Handler
}
}
-
diff --git a/gnu/java/net/protocol/http/Headers.java b/gnu/java/net/protocol/http/Headers.java
index 690a0c65b..faf5eb195 100644
--- a/gnu/java/net/protocol/http/Headers.java
+++ b/gnu/java/net/protocol/http/Headers.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -71,7 +71,7 @@ class Headers implements Iterable<Headers.HeaderElement>
*/
private final ArrayList<HeaderElement> headers
= new ArrayList<HeaderElement>();
-
+
/**
* The HTTP dateformat used to parse date header fields.
*/
@@ -111,11 +111,11 @@ class Headers implements Iterable<Headers.HeaderElement>
{
return headers.iterator();
}
-
+
/**
* Returns the value of the specified header as a string. If
* multiple values are present, the last one is returned.
- *
+ *
* @param header the header name (case insensitive search)
* @return The header value or <code>null</code> if not found.
*/
@@ -135,7 +135,7 @@ class Headers implements Iterable<Headers.HeaderElement>
/**
* Returns the value of the specified header as an integer. If
* multiple values are present, the last one is returned.
- *
+ *
* @param header the header name (case insensitive search)
* @return The header value or <code>-1</code> if not present or
* not an integer value.
@@ -161,7 +161,7 @@ class Headers implements Iterable<Headers.HeaderElement>
/**
* Returns the value of the specified header as a long. If
* multiple values are present, the last one is returned.
- *
+ *
* @param header the header name (case insensitive search)
* @return The header value or <code>-1</code> if not present or
* not a long value.
@@ -187,7 +187,7 @@ class Headers implements Iterable<Headers.HeaderElement>
/**
* Returns the value of the specified header as a date. If
* multiple values are present, the last one is returned.
- *
+ *
* @param header the header name (case insensitive search)
* @return The header value or <code>null</code> if not present or
* not a date value.
@@ -212,7 +212,7 @@ class Headers implements Iterable<Headers.HeaderElement>
/**
* Add a header to this set of headers. If there is an existing
* header with the same name it's value is replaced with the new value.
- * If multiple headers of the same name exist only the last one's value
+ * If multiple headers of the same name exist only the last one's value
* is replaced.
*
* @param name the header name
@@ -221,7 +221,7 @@ class Headers implements Iterable<Headers.HeaderElement>
* @see #addValue(String, String)
*/
public void put(String name, String value)
- {
+ {
for (int i = headers.size() - 1; i >= 0; i--)
{
HeaderElement e = headers.get(i);
@@ -231,14 +231,14 @@ class Headers implements Iterable<Headers.HeaderElement>
return;
}
}
-
+
// nothing was replaced so add it as new HeaderElement
addValue(name, value);
}
-
+
/**
- * Add all headers from a set of headers to this set. Any existing header
- * with the same (case insensitive) name as one of the new headers will
+ * Add all headers from a set of headers to this set. Any existing header
+ * with the same (case insensitive) name as one of the new headers will
* be overridden.
*
* @param o the headers to be added
@@ -280,7 +280,7 @@ class Headers implements Iterable<Headers.HeaderElement>
{
LineInputStream lin = (in instanceof LineInputStream) ?
(LineInputStream) in : new LineInputStream(in);
-
+
String name = null;
CPStringBuilder value = new CPStringBuilder();
while (true)
@@ -307,9 +307,9 @@ class Headers implements Iterable<Headers.HeaderElement>
if (c1 == ' ' || c1 == '\t')
{
// Continuation
- int last = len - 1;
- if (line.charAt(last) != '\r')
- ++last;
+ int last = len - 1;
+ if (line.charAt(last) != '\r')
+ ++last;
value.append(line.substring(0, last));
}
else
@@ -318,7 +318,7 @@ class Headers implements Iterable<Headers.HeaderElement>
{
addValue(name, value.toString());
}
-
+
int di = line.indexOf(':');
name = line.substring(0, di);
value.setLength(0);
@@ -327,14 +327,14 @@ class Headers implements Iterable<Headers.HeaderElement>
di++;
}
while (di < len && line.charAt(di) == ' ');
- int last = len - 1;
- if (line.charAt(last) != '\r')
- ++last;
+ int last = len - 1;
+ if (line.charAt(last) != '\r')
+ ++last;
value.append(line.substring(di, last));
}
}
}
-
+
/**
* Add a header to this set of headers. If there is an existing
@@ -352,12 +352,12 @@ class Headers implements Iterable<Headers.HeaderElement>
/**
* Get a new Map containing all the headers. The keys of the Map
- * are Strings (the header names). The headers will be included
+ * are Strings (the header names). The headers will be included
* case-sensitive in the map so that querying must be done with the
* correct case of the needed header name. The values of the Map are
* unmodifiable Lists containing Strings (the header values).
*
- * <p>
+ * <p>
* The returned map is modifiable. Changing it will not effect this
* collection of Headers in any way.</p>
*
@@ -387,7 +387,7 @@ class Headers implements Iterable<Headers.HeaderElement>
}
return m;
}
-
+
/**
* Get the name of the Nth header.
*
@@ -401,7 +401,7 @@ class Headers implements Iterable<Headers.HeaderElement>
{
if (i >= headers.size() || i < 0)
return null;
-
+
return headers.get(i).name;
}
@@ -418,7 +418,7 @@ class Headers implements Iterable<Headers.HeaderElement>
{
if (i >= headers.size() || i < 0)
return null;
-
+
return headers.get(i).value;
}
}
diff --git a/gnu/java/net/protocol/http/Request.java b/gnu/java/net/protocol/http/Request.java
index 88e2fd077..534213eed 100644
--- a/gnu/java/net/protocol/http/Request.java
+++ b/gnu/java/net/protocol/http/Request.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -280,14 +280,14 @@ public class Request
setHeader("Content-Length", Integer.toString(contentLength));
}
}
-
+
try
{
// Loop while authentication fails or continue
do
{
retry = false;
-
+
// Get socket output and input streams
OutputStream out = connection.getOutputStream();
@@ -314,7 +314,7 @@ public class Request
byte[] buffer = new byte[4096];
int len;
int count = 0;
-
+
requestBodyWriter.reset();
do
{
@@ -372,13 +372,13 @@ public class Request
}
return response;
}
-
+
Response readResponse(InputStream in)
throws IOException
{
String line;
int len;
-
+
// Read response status line
LineInputStream lis = new LineInputStream(in);
@@ -414,7 +414,7 @@ public class Request
responseHeaders.parse(lis);
notifyHeaderHandlers(responseHeaders);
InputStream body = null;
-
+
switch (code)
{
case 100:
@@ -459,7 +459,7 @@ public class Request
throws IOException
{
long contentLength = -1;
-
+
// Persistent connections are the default in HTTP/1.1
boolean doClose = "close".equalsIgnoreCase(getHeader("Connection")) ||
"close".equalsIgnoreCase(responseHeaders.getValue("Connection")) ||
@@ -475,9 +475,9 @@ public class Request
else if ("chunked".equalsIgnoreCase(transferCoding))
{
in = new LimitedLengthInputStream(in, -1, false, connection, doClose);
-
+
in = new ChunkedInputStream(in, responseHeaders);
- }
+ }
else
{
contentLength = responseHeaders.getLongValue("Content-Length");
@@ -505,9 +505,9 @@ public class Request
throw new ProtocolException("Unsupported Content-Encoding: " +
contentCoding);
}
- // Remove the Content-Encoding header because the content is
- // no longer compressed.
- responseHeaders.remove("Content-Encoding");
+ // Remove the Content-Encoding header because the content is
+ // no longer compressed.
+ responseHeaders.remove("Content-Encoding");
}
return in;
}
@@ -551,7 +551,7 @@ public class Request
{
MessageDigest md5 = MessageDigest.getInstance("MD5");
final byte[] COLON = { 0x3a };
-
+
// Calculate H(A1)
md5.reset();
md5.update(username.getBytes("US-ASCII"));
@@ -572,7 +572,7 @@ public class Request
ha1 = md5.digest();
}
String ha1Hex = toHexString(ha1);
-
+
// Calculate H(A2)
md5.reset();
md5.update(method.getBytes("US-ASCII"));
@@ -586,7 +586,7 @@ public class Request
}
byte[] ha2 = md5.digest();
String ha2Hex = toHexString(ha2);
-
+
// Calculate response
md5.reset();
md5.update(ha1Hex.getBytes("US-ASCII"));
@@ -606,8 +606,8 @@ public class Request
md5.update(COLON);
md5.update(ha2Hex.getBytes("US-ASCII"));
String digestResponse = toHexString(md5.digest());
-
- String authorization = scheme +
+
+ String authorization = scheme +
" username=\"" + username + "\"" +
" realm=\"" + realm + "\"" +
" nonce=\"" + nonce + "\"" +
@@ -652,7 +652,7 @@ public class Request
buf.setLength(0);
}
else if (c != ',' || (i <(len - 1) && text.charAt(i + 1) != ' '))
- {
+ {
buf.append(c);
}
}
@@ -855,4 +855,3 @@ public class Request
}
}
-
diff --git a/gnu/java/net/protocol/http/RequestBodyWriter.java b/gnu/java/net/protocol/http/RequestBodyWriter.java
index 05d98ebb8..aa5b78a54 100644
--- a/gnu/java/net/protocol/http/RequestBodyWriter.java
+++ b/gnu/java/net/protocol/http/RequestBodyWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -64,6 +64,5 @@ public interface RequestBodyWriter
* @return the number of bytes written
*/
int write(byte[] buffer);
-
-}
+}
diff --git a/gnu/java/net/protocol/http/Response.java b/gnu/java/net/protocol/http/Response.java
index 76fac9344..084cf75fa 100644
--- a/gnu/java/net/protocol/http/Response.java
+++ b/gnu/java/net/protocol/http/Response.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -61,7 +61,7 @@ public class Response
/**
* The HTTP status code of the response.
- */
+ */
protected final int code;
/**
@@ -114,7 +114,7 @@ public class Response
/**
* Returns the HTTP status code of the response.
* @see #code
- */
+ */
public int getCode()
{
return code;
@@ -188,22 +188,22 @@ public class Response
{
return headers.getDateValue(name);
}
-
+
/**
* Tests whether this response indicates a redirection.
- *
+ *
* @return <code>true</code> if, <code>false</code> otherwise.
*/
public boolean isRedirect()
{
return (code != 304 && getCodeClass() == 3);
}
-
+
/**
* Tests whether this response indicates an error.
* Errors are the response codes <code>4xx</code> - Client error and
* <code>5xx</code> - Server error.
- *
+ *
* @return <code>true</code> if, <code>false</code> otherwise.
*/
public boolean isError()
@@ -221,4 +221,3 @@ public class Response
return body;
}
}
-
diff --git a/gnu/java/net/protocol/http/ResponseHeaderHandler.java b/gnu/java/net/protocol/http/ResponseHeaderHandler.java
index 4c5261da1..ca863440e 100644
--- a/gnu/java/net/protocol/http/ResponseHeaderHandler.java
+++ b/gnu/java/net/protocol/http/ResponseHeaderHandler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -52,6 +52,5 @@ public interface ResponseHeaderHandler
* Sets the value for the header associated with this handler.
*/
void setValue(String value);
-
-}
+}
diff --git a/gnu/java/net/protocol/http/SimpleCookieManager.java b/gnu/java/net/protocol/http/SimpleCookieManager.java
index fe05ba09e..f08204769 100644
--- a/gnu/java/net/protocol/http/SimpleCookieManager.java
+++ b/gnu/java/net/protocol/http/SimpleCookieManager.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -133,6 +133,5 @@ public class SimpleCookieManager
}
}
}
-
-}
+}