Removed IgnoreConnectMethod private class, which is no longer needed; updated User-Agent string

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@712727 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2008-11-10 19:38:43 +00:00
parent 997d0e0694
commit b891c25b6f
1 changed files with 3 additions and 30 deletions

View File

@ -31,12 +31,7 @@
package org.apache.http.impl.client;
import java.io.IOException;
import org.apache.http.ConnectionReuseStrategy;
import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.HttpVersion;
import org.apache.http.auth.AuthSchemeRegistry;
import org.apache.http.client.AuthenticationHandler;
@ -145,7 +140,7 @@ public class DefaultHttpClient extends AbstractHttpClient {
final String release = (vi != null) ?
vi.getRelease() : VersionInfo.UNAVAILABLE;
HttpProtocolParams.setUserAgent(params,
"Apache-HttpClient/" + release + " (java 1.4)");
"Apache-HttpClient/" + release + " (java 1.5)");
return params;
}
@ -271,9 +266,9 @@ public class DefaultHttpClient extends AbstractHttpClient {
httpproc.addInterceptor(new RequestDefaultHeaders());
// Required protocol interceptors
httpproc.addInterceptor(new RequestContent());
httpproc.addInterceptor(new IgnoreConnectMethod(new RequestTargetHost()));
httpproc.addInterceptor(new RequestTargetHost());
// Recommended protocol interceptors
httpproc.addInterceptor(new IgnoreConnectMethod(new RequestConnControl()));
httpproc.addInterceptor(new RequestConnControl());
httpproc.addInterceptor(new RequestUserAgent());
httpproc.addInterceptor(new RequestExpectContinue());
// HTTP state management interceptors
@ -334,26 +329,4 @@ public class DefaultHttpClient extends AbstractHttpClient {
return new DefaultUserTokenHandler();
}
// FIXME: remove this class when protocol interceptors in HttpCore
// are updated to ignore CONNECT methods
static class IgnoreConnectMethod implements HttpRequestInterceptor {
private final HttpRequestInterceptor interceptor;
public IgnoreConnectMethod(final HttpRequestInterceptor interceptor) {
super();
this.interceptor = interceptor;
}
public void process(
final HttpRequest request,
final HttpContext context) throws HttpException, IOException {
String method = request.getRequestLine().getMethod();
if (!method.equalsIgnoreCase("CONNECT")) {
this.interceptor.process(request, context);
}
}
}
} // class DefaultHttpClient