hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1735164 [2/4] - in /httpcomponents/httpcore/trunk: httpcore5-ab/src/main/java/org/apache/hc/core5/http/benchmark/ httpcore5-ab/src/test/java/org/apache/hc/core5/http/benchmark/ httpcore5/src/examples/org/apache/hc/core5/http/examples/ http...
Date Tue, 15 Mar 2016 20:35:36 GMT
Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseParser.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseParser.java Tue Mar 15 20:35:34 2016
@@ -33,11 +33,11 @@ import org.apache.hc.core5.http.HttpResp
 import org.apache.hc.core5.http.HttpResponseFactory;
 import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.StatusLine;
 import org.apache.hc.core5.http.UnsupportedHttpVersionException;
 import org.apache.hc.core5.http.config.MessageConstraints;
 import org.apache.hc.core5.http.impl.DefaultHttpResponseFactory;
 import org.apache.hc.core5.http.message.LineParser;
+import org.apache.hc.core5.http.message.StatusLine;
 import org.apache.hc.core5.util.CharArrayBuffer;
 
 /**
@@ -89,11 +89,11 @@ public class DefaultHttpResponseParser e
     @Override
     protected HttpResponse createMessage(final CharArrayBuffer buffer) throws HttpException {
         final StatusLine statusLine = getLineParser().parseStatusLine(buffer);
-        final ProtocolVersion version = statusLine.getProtocolVersion();
-        if (version.greaterEquals(HttpVersion.HTTP_2)) {
-            throw new UnsupportedHttpVersionException("Unsupported version: " + version);
+        final ProtocolVersion transportVersion = statusLine.getProtocolVersion();
+        if (transportVersion.greaterEquals(HttpVersion.HTTP_2)) {
+            throw new UnsupportedHttpVersionException("Unsupported version: " + transportVersion);
         }
-        return this.responseFactory.newHttpResponse(statusLine, null);
+        return this.responseFactory.newHttpResponse(transportVersion, statusLine.getStatusCode(), statusLine.getReasonPhrase());
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseWriter.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseWriter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseWriter.java Tue Mar 15 20:35:34 2016
@@ -31,7 +31,10 @@ import java.io.IOException;
 
 import org.apache.hc.core5.annotation.NotThreadSafe;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.HttpVersion;
+import org.apache.hc.core5.http.ProtocolVersion;
 import org.apache.hc.core5.http.message.LineFormatter;
+import org.apache.hc.core5.http.message.StatusLine;
 import org.apache.hc.core5.util.CharArrayBuffer;
 
 /**
@@ -65,7 +68,12 @@ public class DefaultHttpResponseWriter e
     @Override
     protected void writeHeadLine(final HttpResponse message, final CharArrayBuffer lineBuf) throws IOException {
         lineBuf.clear();
-        getLineFormatter().formatStatusLine(lineBuf, message.getStatusLine());
+        ProtocolVersion transportVersion = message.getVersion();
+        if (transportVersion == null || transportVersion.greaterEquals(HttpVersion.HTTP_2_0)) {
+            transportVersion = HttpVersion.HTTP_1_1;
+        }
+        getLineFormatter().formatStatusLine(lineBuf,
+                new StatusLine(transportVersion, message.getCode(), message.getReasonPhrase()));
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpClientConnection.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpClientConnection.java Tue Mar 15 20:35:34 2016
@@ -191,6 +191,7 @@ public class DefaultNHttpClientConnectio
                         this.connMetrics.incrementResponseCount();
                     }
                     this.hasBufferedInput = this.inbuf.hasData();
+                    this.version = this.response.getVersion();
                     onResponseReceived(this.response);
                     handler.responseReceived(this);
                     if (this.contentDecoder == null) {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpServerConnection.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpServerConnection.java Tue Mar 15 20:35:34 2016
@@ -190,6 +190,7 @@ public class DefaultNHttpServerConnectio
                     }
                     this.connMetrics.incrementRequestCount();
                     this.hasBufferedInput = this.inbuf.hasData();
+                    this.version = this.request.getVersion();
                     onRequestReceived(this.request);
                     handler.requestReceived(this);
                     if (this.contentDecoder == null) {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java Tue Mar 15 20:35:34 2016
@@ -197,7 +197,7 @@ public class HttpAsyncRequestExecutor im
         if (request == null) {
             return;
         }
-        final ProtocolVersion version = request.getRequestLine().getProtocolVersion();
+        final ProtocolVersion version = context.getProtocolVersion();
         if (pipelined && version.lessEquals(HttpVersion.HTTP_1_0)) {
             throw new ProtocolException(version + " cannot be used with request pipelining");
         }
@@ -300,8 +300,7 @@ public class HttpAsyncRequestExecutor im
         if (statusCode < HttpStatus.SC_OK) {
             // 1xx intermediate response
             if (statusCode != HttpStatus.SC_CONTINUE) {
-                throw new ProtocolException(
-                        "Unexpected response: " + response.getStatusLine());
+                throw new ProtocolException("Unexpected response " + response.getCode());
             }
             if (state.getRequestState() == MessageState.ACK_EXPECTED) {
                 final int timeout = state.getTimeout();
@@ -518,7 +517,7 @@ public class HttpAsyncRequestExecutor im
 
     private boolean canResponseHaveBody(final HttpRequest request, final HttpResponse response) {
 
-        final String method = request.getRequestLine().getMethod();
+        final String method = request.getMethod();
         final int status = response.getCode();
 
         if (method.equalsIgnoreCase("HEAD")) {
@@ -621,13 +620,15 @@ public class HttpAsyncRequestExecutor im
             buf.append(this.requestState);
             if (this.request != null) {
                 buf.append(" ");
-                buf.append(this.request.getRequestLine());
+                buf.append(this.request.getMethod());
+                buf.append(" ");
+                buf.append(this.request.getUri());
             }
             buf.append("; incoming ");
             buf.append(this.responseState);
             if (this.response != null) {
                 buf.append(" ");
-                buf.append(this.response.getStatusLine());
+                buf.append(this.response.getCode());
             }
             if (this.earlyResponse) {
                 buf.append(" (early response)");

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java Tue Mar 15 20:35:34 2016
@@ -49,6 +49,7 @@ import org.apache.hc.core5.http.HttpStat
 import org.apache.hc.core5.http.MethodNotSupportedException;
 import org.apache.hc.core5.http.NotImplementedException;
 import org.apache.hc.core5.http.ProtocolException;
+import org.apache.hc.core5.http.ProtocolVersion;
 import org.apache.hc.core5.http.UnsupportedHttpVersionException;
 import org.apache.hc.core5.http.entity.ContentType;
 import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
@@ -281,6 +282,10 @@ public class HttpAsyncService implements
 
         context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
         context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
+        final ProtocolVersion transportVersion = request.getVersion();
+        if (transportVersion != null) {
+            context.setProtocolVersion(transportVersion);
+        }
         this.httpProcessor.process(request, context);
 
         final HttpAsyncRequestHandler<Object> requestHandler = getRequestHandler(request, context);
@@ -300,7 +305,7 @@ public class HttpAsyncService implements
                         && state.getRequestQueue().isEmpty()
                         && !conn.isDataAvailable()) {
 
-                final HttpResponse ack = this.responseFactory.newHttpResponse(HttpStatus.SC_CONTINUE, context);
+                final HttpResponse ack = this.responseFactory.newHttpResponse(HttpStatus.SC_CONTINUE);
                 if (this.expectationVerifier != null) {
                     final HttpAsyncExchange httpAsyncExchange = new HttpAsyncExchangeImpl(
                             incoming, request, ack, state, conn, context);
@@ -382,7 +387,7 @@ public class HttpAsyncService implements
             state.setResponseState(MessageState.INIT);
             if (requestResult != null) {
                 final HttpAsyncRequestHandler<Object> handler = pipelineEntry.getHandler();
-                final HttpResponse response = this.responseFactory.newHttpResponse(HttpStatus.SC_OK, context);
+                final HttpResponse response = this.responseFactory.newHttpResponse(HttpStatus.SC_OK);
                 final HttpAsyncExchangeImpl httpExchange = new HttpAsyncExchangeImpl(
                         null, request, response, state, conn, context);
                 conn.suspendOutput();
@@ -566,7 +571,7 @@ public class HttpAsyncService implements
         if (message == null) {
             message = ex.toString();
         }
-        final HttpResponse response = this.responseFactory.newHttpResponse(code, context);
+        final HttpResponse response = this.responseFactory.newHttpResponse(code);
         return new ErrorResponseProducer(response,
                 new NStringEntity(message, ContentType.DEFAULT_TEXT), false);
     }
@@ -600,7 +605,7 @@ public class HttpAsyncService implements
     }
 
     private boolean canResponseHaveBody(final HttpRequest request, final HttpResponse response) {
-        if (request != null && "HEAD".equalsIgnoreCase(request.getRequestLine().getMethod())) {
+        if (request != null && "HEAD".equalsIgnoreCase(request.getMethod())) {
             return false;
         }
         final int status = response.getCode();
@@ -885,13 +890,15 @@ public class HttpAsyncService implements
             buf.append(this.requestState);
             if (this.incoming != null) {
                 buf.append(" ");
-                buf.append(this.incoming.getRequest().getRequestLine());
+                buf.append(this.incoming.getRequest().getMethod());
+                buf.append(" ");
+                buf.append(this.incoming.getRequest().getUri());
             }
             buf.append("; outgoing ");
             buf.append(this.responseState);
             if (this.outgoing != null) {
                 buf.append(" ");
-                buf.append(this.outgoing.getResponse().getStatusLine());
+                buf.append(this.outgoing.getResponse().getCode());
             }
             buf.append("]");
             return buf.toString();

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/NHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/NHttpConnectionBase.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/NHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/NHttpConnectionBase.java Tue Mar 15 20:35:34 2016
@@ -43,6 +43,7 @@ import org.apache.hc.core5.http.HttpHead
 import org.apache.hc.core5.http.HttpMessage;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.ProtocolVersion;
 import org.apache.hc.core5.http.TrailerSupplier;
 import org.apache.hc.core5.http.config.MessageConstraints;
 import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
@@ -83,6 +84,7 @@ class NHttpConnectionBase implements NHt
     volatile HttpResponse response;
 
     volatile int status;
+    volatile ProtocolVersion version;
 
     NHttpConnectionBase(
             final IOSession session,
@@ -147,6 +149,14 @@ class NHttpConnectionBase implements NHt
         return this.context;
     }
 
+    /**
+     * @since 5.0
+     */
+    @Override
+    public ProtocolVersion getProtocolVersion() {
+        return this.version;
+    }
+
     @Override
     public HttpRequest getHttpRequest() {
         return this.request;

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/NullRequestHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/NullRequestHandler.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/NullRequestHandler.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/NullRequestHandler.java Tue Mar 15 20:35:34 2016
@@ -55,7 +55,7 @@ class NullRequestHandler implements Http
             final HttpAsyncExchange httpexchange,
             final HttpContext context) {
         final HttpResponse response = httpexchange.getResponse();
-        response.setStatusCode(HttpStatus.SC_NOT_IMPLEMENTED);
+        response.setCode(HttpStatus.SC_NOT_IMPLEMENTED);
         httpexchange.submitResponse(new ErrorResponseProducer(
                 response, new NStringEntity("Service not implemented", ContentType.TEXT_PLAIN), true));
     }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/PipeliningClientExchangeHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/PipeliningClientExchangeHandler.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/PipeliningClientExchangeHandler.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/PipeliningClientExchangeHandler.java Tue Mar 15 20:35:34 2016
@@ -43,6 +43,7 @@ import org.apache.hc.core5.http.Connecti
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.ProtocolVersion;
 import org.apache.hc.core5.http.nio.ContentDecoder;
 import org.apache.hc.core5.http.nio.ContentEncoder;
 import org.apache.hc.core5.http.nio.HttpAsyncClientExchangeHandler;
@@ -216,6 +217,10 @@ public class PipeliningClientExchangeHan
 
         this.localContext.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
         this.localContext.setAttribute(HttpCoreContext.HTTP_RESPONSE, response);
+        final ProtocolVersion transportVersion = response.getVersion();
+        if (transportVersion != null) {
+            this.localContext.setProtocolVersion(transportVersion);
+        }
         this.httppocessor.process(response, this.localContext);
 
         responseConsumer.responseReceived(response);

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionHttpContext.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionHttpContext.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionHttpContext.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SessionHttpContext.java Tue Mar 15 20:35:34 2016
@@ -27,6 +27,8 @@
 
 package org.apache.hc.core5.http.impl.nio;
 
+import org.apache.hc.core5.http.HttpVersion;
+import org.apache.hc.core5.http.ProtocolVersion;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.reactor.IOSession;
 
@@ -40,6 +42,15 @@ class SessionHttpContext implements Http
     }
 
     @Override
+    public ProtocolVersion getProtocolVersion() {
+        return HttpVersion.DEFAULT;
+    }
+
+    @Override
+    public void setProtocolVersion(final ProtocolVersion version) {
+    }
+
+    @Override
     public Object getAttribute(final String id) {
         return this.iosession.getAttribute(id);
     }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/UriHttpAsyncRequestHandlerMapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/UriHttpAsyncRequestHandlerMapper.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/UriHttpAsyncRequestHandlerMapper.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/UriHttpAsyncRequestHandlerMapper.java Tue Mar 15 20:35:34 2016
@@ -89,7 +89,7 @@ public class UriHttpAsyncRequestHandlerM
      * Extracts request path from the given {@link HttpRequest}
      */
     protected String getRequestPath(final HttpRequest request) {
-        String uriPath = request.getRequestLine().getUri();
+        String uriPath = request.getUri();
         int index = uriPath.indexOf("?");
         if (index != -1) {
             uriPath = uriPath.substring(0, index);

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/UriHttpRequestHandlerMapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/UriHttpRequestHandlerMapper.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/UriHttpRequestHandlerMapper.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/UriHttpRequestHandlerMapper.java Tue Mar 15 20:35:34 2016
@@ -90,7 +90,7 @@ public class UriHttpRequestHandlerMapper
      * Extracts request path from the given {@link HttpRequest}
      */
     protected String getRequestPath(final HttpRequest request) {
-        String uriPath = request.getRequestLine().getUri();
+        String uriPath = request.getUri();
         int index = uriPath.indexOf("?");
         if (index != -1) {
             uriPath = uriPath.substring(0, index);

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHttpRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHttpRequest.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHttpRequest.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHttpRequest.java Tue Mar 15 20:35:34 2016
@@ -29,9 +29,7 @@ package org.apache.hc.core5.http.message
 
 import org.apache.hc.core5.annotation.NotThreadSafe;
 import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.RequestLine;
 import org.apache.hc.core5.util.Args;
 
 /**
@@ -43,10 +41,10 @@ import org.apache.hc.core5.util.Args;
 public class BasicHttpRequest extends AbstractHttpMessage implements HttpRequest {
 
     private static final long serialVersionUID = 1L;
-    private final String method;
-    private final String uri;
 
-    private RequestLine requestline;
+    private final String method;
+    private String uri;
+    private ProtocolVersion version;
 
     /**
      * Creates an instance of this class using the given request method
@@ -59,54 +57,26 @@ public class BasicHttpRequest extends Ab
         super();
         this.method = Args.notNull(method, "Method name");
         this.uri = Args.notNull(uri, "Request URI");
-        this.requestline = null;
     }
 
-    /**
-     * Creates an instance of this class using the given request method, URI
-     * and the HTTP protocol version.
-     *
-     * @param method request method.
-     * @param uri request URI.
-     * @param ver HTTP protocol version.
-     */
-    public BasicHttpRequest(final String method, final String uri, final ProtocolVersion ver) {
-        this(new BasicRequestLine(method, uri, ver));
+    @Override
+    public void setVersion(final ProtocolVersion version) {
+        this.version = version;
     }
 
-    /**
-     * Creates an instance of this class using the given request line.
-     *
-     * @param requestline request line.
-     */
-    public BasicHttpRequest(final RequestLine requestline) {
-        super();
-        this.requestline = Args.notNull(requestline, "Request line");
-        this.method = requestline.getMethod();
-        this.uri = requestline.getUri();
+    @Override
+    public ProtocolVersion getVersion() {
+        return this.version;
     }
 
-    /**
-     * Returns the HTTP protocol version to be used for this request.
-     *
-     * @see #BasicHttpRequest(String, String)
-     */
     @Override
-    public ProtocolVersion getProtocolVersion() {
-        return getRequestLine().getProtocolVersion();
+    public String getMethod() {
+        return this.method;
     }
 
-    /**
-     * Returns the request line of this request.
-     *
-     * @see #BasicHttpRequest(String, String)
-     */
     @Override
-    public RequestLine getRequestLine() {
-        if (this.requestline == null) {
-            this.requestline = new BasicRequestLine(this.method, this.uri, HttpVersion.HTTP_1_1);
-        }
-        return this.requestline;
+    public String getUri() {
+        return this.uri;
     }
 
     @Override

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHttpResponse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHttpResponse.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHttpResponse.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHttpResponse.java Tue Mar 15 20:35:34 2016
@@ -31,10 +31,9 @@ import java.util.Locale;
 
 import org.apache.hc.core5.annotation.NotThreadSafe;
 import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.ProtocolVersion;
 import org.apache.hc.core5.http.ReasonPhraseCatalog;
-import org.apache.hc.core5.http.StatusLine;
+import org.apache.hc.core5.http.impl.EnglishReasonPhraseCatalog;
 import org.apache.hc.core5.util.Args;
 
 /**
@@ -48,111 +47,70 @@ import org.apache.hc.core5.util.Args;
 public class BasicHttpResponse extends AbstractHttpMessage implements HttpResponse {
 
     private static final long serialVersionUID = 1L;
-    private StatusLine          statusline;
-    private ProtocolVersion     ver;
-    private int                 code;
-    private String              reasonPhrase;
+
     private final ReasonPhraseCatalog reasonCatalog;
-    private Locale              locale;
+
+    private ProtocolVersion version;
+    private Locale locale;
+    private int code;
+    private String reasonPhrase;
 
     /**
      * Creates a new response.
-     * This is the constructor to which all others map.
      *
-     * @param statusline        the status line
+     * @param code              the status code
      * @param catalog           the reason phrase catalog, or
      *                          {@code null} to disable automatic
      *                          reason phrase lookup
      * @param locale            the locale for looking up reason phrases, or
      *                          {@code null} for the system locale
      */
-    public BasicHttpResponse(final StatusLine statusline,
-                             final ReasonPhraseCatalog catalog,
-                             final Locale locale) {
+    public BasicHttpResponse(
+            final int code,
+            final ReasonPhraseCatalog catalog,
+            final Locale locale) {
         super();
-        this.statusline = Args.notNull(statusline, "Status line");
-        this.ver = statusline.getProtocolVersion();
-        this.code = statusline.getStatusCode();
-        this.reasonPhrase = statusline.getReasonPhrase();
-        this.reasonCatalog = catalog;
+        this.code = Args.positive(code, "Status code");
+        this.reasonCatalog = catalog != null ? catalog : EnglishReasonPhraseCatalog.INSTANCE;
         this.locale = locale;
     }
 
     /**
-     * Creates a response from a status line.
-     * The response will not have a reason phrase catalog and
-     * use the system default locale.
-     *
-     * @param statusline        the status line
-     */
-    public BasicHttpResponse(final StatusLine statusline) {
-        super();
-        this.statusline = Args.notNull(statusline, "Status line");
-        this.ver = statusline.getProtocolVersion();
-        this.code = statusline.getStatusCode();
-        this.reasonPhrase = statusline.getReasonPhrase();
-        this.reasonCatalog = null;
-        this.locale = null;
-    }
-
-    /**
-     * Creates a response from elements of a status line.
-     * The response will not have a reason phrase catalog and
-     * use the system default locale.
+     * Creates a new response.
      *
-     * @param ver       the protocol version of the response
-     * @param code      the status code of the response
-     * @param reason    the reason phrase to the status code, or
-     *                  {@code null}
+     * @param code          the status code of the response
+     * @param reasonPhrase  the reason phrase to the status code, or {@code null}
      */
-    public BasicHttpResponse(final ProtocolVersion ver,
-                             final int code,
-                             final String reason) {
-        super();
-        Args.notNegative(code, "Status code");
-        this.statusline = null;
-        this.ver = ver;
-        this.code = code;
-        this.reasonPhrase = reason;
-        this.reasonCatalog = null;
-        this.locale = null;
+    public BasicHttpResponse(final int code, final String reasonPhrase) {
+        this.code = Args.positive(code, "Status code");
+        this.reasonPhrase = reasonPhrase;
+        this.reasonCatalog = EnglishReasonPhraseCatalog.INSTANCE;
     }
 
     /**
-     * Creates a response from elements of a status line.
-     * The response will not have a reason phrase catalog and
-     * use the system default locale.
+     * Creates a new response.
      *
-     * @param code      the status code of the response
-     * @param reason    the reason phrase to the status code, or
-     *                  {@code null}
+     * @param code          the status code of the response
      */
-    public BasicHttpResponse(final int code, final String reason) {
-        this(HttpVersion.HTTP_1_1, code, reason);
+    public BasicHttpResponse(final int code) {
+        this.code = Args.positive(code, "Status code");
+        this.reasonPhrase = null;
+        this.reasonCatalog = EnglishReasonPhraseCatalog.INSTANCE;
     }
 
-    // non-javadoc, see interface HttpMessage
     @Override
-    public ProtocolVersion getProtocolVersion() {
-        return this.ver;
+    public void setVersion(final ProtocolVersion version) {
+        this.version = version;
     }
 
-    // non-javadoc, see interface HttpResponse
     @Override
-    public int getCode() {
-        return getStatusLine().getStatusCode();
+    public ProtocolVersion getVersion() {
+        return this.version;
     }
 
-    // non-javadoc, see interface HttpResponse
     @Override
-    public StatusLine getStatusLine() {
-        if (this.statusline == null) {
-            this.statusline = new BasicStatusLine(
-                    this.ver != null ? this.ver : HttpVersion.HTTP_1_1,
-                    this.code,
-                    this.reasonPhrase != null ? this.reasonPhrase : getReason(this.code));
-        }
-        return this.statusline;
+    public int getCode() {
+        return this.code;
     }
 
     @Override
@@ -160,56 +118,26 @@ public class BasicHttpResponse extends A
         return this.locale;
     }
 
-    // non-javadoc, see interface HttpResponse
     @Override
-    public void setStatusLine(final StatusLine statusline) {
-        this.statusline = Args.notNull(statusline, "Status line");
-        this.ver = statusline.getProtocolVersion();
-        this.code = statusline.getStatusCode();
-        this.reasonPhrase = statusline.getReasonPhrase();
-    }
-
-    // non-javadoc, see interface HttpResponse
-    @Override
-    public void setStatusLine(final ProtocolVersion ver, final int code) {
-        Args.notNegative(code, "Status code");
-        this.statusline = null;
-        this.ver = ver;
+    public void setCode(final int code) {
+        Args.positive(code, "Status code");
         this.code = code;
         this.reasonPhrase = null;
     }
 
-    // non-javadoc, see interface HttpResponse
     @Override
-    public void setStatusLine(
-            final ProtocolVersion ver, final int code, final String reason) {
-        Args.notNegative(code, "Status code");
-        this.statusline = null;
-        this.ver = ver;
-        this.code = code;
-        this.reasonPhrase = reason;
-    }
-
-    // non-javadoc, see interface HttpResponse
-    @Override
-    public void setStatusCode(final int code) {
-        Args.notNegative(code, "Status code");
-        this.statusline = null;
-        this.code = code;
-        this.reasonPhrase = null;
+    public String getReasonPhrase() {
+        return this.reasonPhrase != null ? this.reasonPhrase : getReason(this.code);
     }
 
-    // non-javadoc, see interface HttpResponse
     @Override
     public void setReasonPhrase(final String reason) {
-        this.statusline = null;
         this.reasonPhrase = reason;
     }
 
     @Override
     public void setLocale(final Locale locale) {
         this.locale = Args.notNull(locale, "Locale");
-        this.statusline = null;
     }
 
     /**

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicLineFormatter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicLineFormatter.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicLineFormatter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicLineFormatter.java Tue Mar 15 20:35:34 2016
@@ -30,8 +30,6 @@ package org.apache.hc.core5.http.message
 import org.apache.hc.core5.annotation.Immutable;
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.RequestLine;
-import org.apache.hc.core5.http.StatusLine;
 import org.apache.hc.core5.util.Args;
 import org.apache.hc.core5.util.CharArrayBuffer;
 

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicLineParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicLineParser.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicLineParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicLineParser.java Tue Mar 15 20:35:34 2016
@@ -34,8 +34,6 @@ import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.ParseException;
 import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.RequestLine;
-import org.apache.hc.core5.http.StatusLine;
 import org.apache.hc.core5.util.Args;
 import org.apache.hc.core5.util.CharArrayBuffer;
 import org.apache.hc.core5.util.TextUtils;
@@ -161,7 +159,7 @@ public class BasicLineParser implements
         if (!cursor.atEnd()) {
             throw new ParseException("Invalid request line: " + buffer.toString());
         }
-        return new BasicRequestLine(method, uri, ver);
+        return new RequestLine(method, uri, ver);
     }
 
     @Override
@@ -185,7 +183,7 @@ public class BasicLineParser implements
             throw new ParseException("Status line contains invalid status code: " + buffer.toString());
         }
         final String text = buffer.substringTrimmed(cursor.getPos(), cursor.getUpperBound());
-        return new BasicStatusLine(ver, statusCode, text);
+        return new StatusLine(ver, statusCode, text);
     }
 
     @Override

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/LineFormatter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/LineFormatter.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/LineFormatter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/LineFormatter.java Tue Mar 15 20:35:34 2016
@@ -28,8 +28,6 @@
 package org.apache.hc.core5.http.message;
 
 import org.apache.hc.core5.http.Header;
-import org.apache.hc.core5.http.RequestLine;
-import org.apache.hc.core5.http.StatusLine;
 import org.apache.hc.core5.util.CharArrayBuffer;
 
 /**

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/LineParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/LineParser.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/LineParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/LineParser.java Tue Mar 15 20:35:34 2016
@@ -29,8 +29,6 @@ package org.apache.hc.core5.http.message
 
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.ParseException;
-import org.apache.hc.core5.http.RequestLine;
-import org.apache.hc.core5.http.StatusLine;
 import org.apache.hc.core5.util.CharArrayBuffer;
 
 /**

Copied: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/RequestLine.java (from r1734704, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicRequestLine.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/RequestLine.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/RequestLine.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicRequestLine.java&r1=1734704&r2=1735164&rev=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicRequestLine.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/RequestLine.java Tue Mar 15 20:35:34 2016
@@ -31,16 +31,15 @@ import java.io.Serializable;
 
 import org.apache.hc.core5.annotation.Immutable;
 import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.RequestLine;
 import org.apache.hc.core5.util.Args;
 
 /**
- * Basic implementation of {@link RequestLine}.
+ * HTTP/1.1 request line.
  *
  * @since 4.0
  */
 @Immutable
-public class BasicRequestLine implements RequestLine, Serializable {
+public final class RequestLine implements Serializable {
 
     private static final long serialVersionUID = 2810581718468737193L;
 
@@ -48,26 +47,23 @@ public class BasicRequestLine implements
     private final String method;
     private final String uri;
 
-    public BasicRequestLine(final String method,
-                            final String uri,
-                            final ProtocolVersion version) {
+    public RequestLine(final String method,
+                       final String uri,
+                       final ProtocolVersion version) {
         super();
         this.method = Args.notNull(method, "Method");
         this.uri = Args.notNull(uri, "URI");
         this.protoversion = Args.notNull(version, "Version");
     }
 
-    @Override
     public String getMethod() {
         return this.method;
     }
 
-    @Override
     public ProtocolVersion getProtocolVersion() {
         return this.protoversion;
     }
 
-    @Override
     public String getUri() {
         return this.uri;
     }

Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/RequestLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/RequestLine.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/RequestLine.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/StatusLine.java (from r1734704, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicStatusLine.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/StatusLine.java?p2=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/StatusLine.java&p1=httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicStatusLine.java&r1=1734704&r2=1735164&rev=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicStatusLine.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/StatusLine.java Tue Mar 15 20:35:34 2016
@@ -31,21 +31,18 @@ import java.io.Serializable;
 
 import org.apache.hc.core5.annotation.Immutable;
 import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.StatusLine;
 import org.apache.hc.core5.util.Args;
 
 /**
- * Basic implementation of {@link StatusLine}
+ * HTTP/1.1 status line.
  *
  * @since 4.0
  */
 @Immutable
-public class BasicStatusLine implements StatusLine, Serializable {
+public final class StatusLine implements Serializable {
 
     private static final long serialVersionUID = -2443303766890459269L;
 
-    // ----------------------------------------------------- Instance Variables
-
     /** The protocol version. */
     private final ProtocolVersion protoVersion;
 
@@ -55,7 +52,6 @@ public class BasicStatusLine implements
     /** The reason phrase. */
     private final String reasonPhrase;
 
-    // ----------------------------------------------------------- Constructors
     /**
      * Creates a new status line with the given version, status, and reason.
      *
@@ -64,27 +60,22 @@ public class BasicStatusLine implements
      * @param reasonPhrase      the reason phrase to the status code, or
      *                          {@code null}
      */
-    public BasicStatusLine(final ProtocolVersion version, final int statusCode,
-                           final String reasonPhrase) {
+    public StatusLine(final ProtocolVersion version, final int statusCode,
+                      final String reasonPhrase) {
         super();
         this.protoVersion = Args.notNull(version, "Version");
         this.statusCode = Args.notNegative(statusCode, "Status code");
         this.reasonPhrase = reasonPhrase;
     }
 
-    // --------------------------------------------------------- Public Methods
-
-    @Override
     public int getStatusCode() {
         return this.statusCode;
     }
 
-    @Override
     public ProtocolVersion getProtocolVersion() {
         return this.protoVersion;
     }
 
-    @Override
     public String getReasonPhrase() {
         return this.reasonPhrase;
     }

Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/StatusLine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/StatusLine.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/StatusLine.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/BasicHttpContext.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/BasicHttpContext.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/BasicHttpContext.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/BasicHttpContext.java Tue Mar 15 20:35:34 2016
@@ -31,6 +31,8 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.hc.core5.annotation.ThreadSafe;
+import org.apache.hc.core5.http.HttpVersion;
+import org.apache.hc.core5.http.ProtocolVersion;
 import org.apache.hc.core5.util.Args;
 
 /**
@@ -47,6 +49,8 @@ public class BasicHttpContext implements
     private final HttpContext parentContext;
     private final Map<String, Object> map;
 
+    private ProtocolVersion version;
+
     public BasicHttpContext() {
         this(null);
     }
@@ -84,6 +88,21 @@ public class BasicHttpContext implements
     }
 
     /**
+     * @since 5.0
+     */
+    @Override
+    public ProtocolVersion getProtocolVersion() {
+        return this.version != null ? this.version : HttpVersion.DEFAULT;
+    }
+
+    /**
+     * @since 5.0
+     */
+    public void setProtocolVersion(final ProtocolVersion version) {
+        this.version = version;
+    }
+
+    /**
      * @since 4.2
      */
     public void clear() {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpContext.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpContext.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpContext.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpContext.java Tue Mar 15 20:35:34 2016
@@ -27,6 +27,8 @@
 
 package org.apache.hc.core5.http.protocol;
 
+import org.apache.hc.core5.http.ProtocolVersion;
+
 /**
  * HttpContext represents execution state of an HTTP process. It is a structure
  * that can be used to map an attribute name to an attribute value.
@@ -49,6 +51,20 @@ public interface HttpContext {
     public static final String RESERVED_PREFIX  = "http.";
 
     /**
+     * Returns protocol version used in this context.
+     *
+     * @since 5.0
+     */
+    ProtocolVersion getProtocolVersion();
+
+    /**
+     * Sets protocol version used in this context.
+     *
+     * @since 5.0
+     */
+    void setProtocolVersion(ProtocolVersion version);
+
+    /**
      * Obtains attribute with the given name.
      *
      * @param id the attribute name.

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpCoreContext.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpCoreContext.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpCoreContext.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpCoreContext.java Tue Mar 15 20:35:34 2016
@@ -32,6 +32,7 @@ import org.apache.hc.core5.http.HttpConn
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.ProtocolVersion;
 import org.apache.hc.core5.util.Args;
 
 /**
@@ -47,19 +48,19 @@ public class HttpCoreContext implements
      * Attribute name of a {@link org.apache.hc.core5.http.HttpConnection} object that
      * represents the actual HTTP connection.
      */
-    public static final String HTTP_CONNECTION  = "http.connection";
+    public static final String HTTP_CONNECTION  = HttpContext.RESERVED_PREFIX + "connection";
 
     /**
      * Attribute name of a {@link org.apache.hc.core5.http.HttpRequest} object that
      * represents the actual HTTP request.
      */
-    public static final String HTTP_REQUEST     = "http.request";
+    public static final String HTTP_REQUEST     = HttpContext.RESERVED_PREFIX + "request";
 
     /**
      * Attribute name of a {@link org.apache.hc.core5.http.HttpResponse} object that
      * represents the actual HTTP response.
      */
-    public static final String HTTP_RESPONSE    = "http.response";
+    public static final String HTTP_RESPONSE    = HttpContext.RESERVED_PREFIX + "response";
 
     /**
      * Attribute name of a {@link org.apache.hc.core5.http.HttpHost} object that
@@ -91,6 +92,22 @@ public class HttpCoreContext implements
         this.context = new BasicHttpContext();
     }
 
+    /**
+     * @since 5.0
+     */
+    @Override
+    public ProtocolVersion getProtocolVersion() {
+        return this.context.getProtocolVersion();
+    }
+
+    /**
+     * @since 5.0
+     */
+    @Override
+    public void setProtocolVersion(final ProtocolVersion version) {
+        this.context.setProtocolVersion(version);
+    }
+
     @Override
     public Object getAttribute(final String id) {
         return context.getAttribute(id);

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestConnControl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestConnControl.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestConnControl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestConnControl.java Tue Mar 15 20:35:34 2016
@@ -57,7 +57,7 @@ public class RequestConnControl implemen
             throws HttpException, IOException {
         Args.notNull(request, "HTTP request");
 
-        final String method = request.getRequestLine().getMethod();
+        final String method = request.getMethod();
         if (method.equalsIgnoreCase("CONNECT")) {
             return;
         }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestContent.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestContent.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestContent.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestContent.java Tue Mar 15 20:35:34 2016
@@ -100,7 +100,7 @@ public class RequestContent implements H
         }
         final HttpEntity entity = request.getEntity();
         if (entity != null) {
-            final ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
+            final ProtocolVersion ver = context.getProtocolVersion();
             // Must specify a transfer encoding or a content length
             if (entity.isChunked() || entity.getContentLength() < 0) {
                 if (ver.lessEquals(HttpVersion.HTTP_1_0)) {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestExpectContinue.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestExpectContinue.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestExpectContinue.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestExpectContinue.java Tue Mar 15 20:35:34 2016
@@ -62,7 +62,7 @@ public class RequestExpectContinue imple
         if (!request.containsHeader(HttpHeaders.EXPECT)) {
             final HttpEntity entity = request.getEntity();
             if (entity != null) {
-                final ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
+                final ProtocolVersion ver = context.getProtocolVersion();
                 // Do not send the expect header if request body is known to be empty
                 if (entity.getContentLength() != 0 && !ver.lessEquals(HttpVersion.HTTP_1_0)) {
                     request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestTargetHost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestTargetHost.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestTargetHost.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestTargetHost.java Tue Mar 15 20:35:34 2016
@@ -62,8 +62,8 @@ public class RequestTargetHost implement
 
         final HttpCoreContext coreContext = HttpCoreContext.adapt(context);
 
-        final ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
-        final String method = request.getRequestLine().getMethod();
+        final ProtocolVersion ver = coreContext.getProtocolVersion();
+        final String method = request.getMethod();
         if (method.equalsIgnoreCase("CONNECT") && ver.lessEquals(HttpVersion.HTTP_1_0)) {
             extracted();
             return;

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestValidateHost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestValidateHost.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestValidateHost.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestValidateHost.java Tue Mar 15 20:35:34 2016
@@ -56,7 +56,7 @@ public class RequestValidateHost impleme
     public void process(final HttpRequest request, final HttpContext context)
             throws HttpException, IOException {
         Args.notNull(request, "HTTP request");
-        final ProtocolVersion version = request.getProtocolVersion();
+        final ProtocolVersion version = request.getVersion() != null ? request.getVersion() : HttpVersion.HTTP_1_1;
         if (version.greaterEquals(HttpVersion.HTTP_1_1)) {
             final int n = request.containsHeaders(HttpHeaders.HOST);
             if (n == 0) {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseConnControl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseConnControl.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseConnControl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseConnControl.java Tue Mar 15 20:35:34 2016
@@ -85,8 +85,8 @@ public class ResponseConnControl impleme
         // Always drop connection for HTTP/1.0 responses and below
         // if the content body cannot be correctly delimited
         final HttpEntity entity = response.getEntity();
+        final ProtocolVersion ver = context.getProtocolVersion();
         if (entity != null) {
-            final ProtocolVersion ver = response.getStatusLine().getProtocolVersion();
             if (entity.getContentLength() < 0 &&
                     (!entity.isChunked() || ver.lessEquals(HttpVersion.HTTP_1_0))) {
                 response.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
@@ -99,7 +99,7 @@ public class ResponseConnControl impleme
             final Header header = request.getFirstHeader(HttpHeaders.CONNECTION);
             if (header != null) {
                 response.setHeader(HttpHeaders.CONNECTION, header.getValue());
-            } else if (request.getProtocolVersion().lessEquals(HttpVersion.HTTP_1_0)) {
+            } else if (ver.lessEquals(HttpVersion.HTTP_1_0)) {
                 response.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
             }
         }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseContent.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseContent.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseContent.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseContent.java Tue Mar 15 20:35:34 2016
@@ -106,7 +106,7 @@ public class ResponseContent implements
                 throw new ProtocolException("Content-Length header already present");
             }
         }
-        final ProtocolVersion ver = response.getStatusLine().getProtocolVersion();
+        final ProtocolVersion ver = context.getProtocolVersion();
         final HttpEntity entity = response.getEntity();
         if (entity != null) {
             final long len = entity.getContentLength();

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestBasicRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestBasicRequest.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestBasicRequest.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestBasicRequest.java Tue Mar 15 20:35:34 2016
@@ -28,7 +28,6 @@
 package org.apache.hc.core5.http.impl;
 
 import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.message.BasicHttpRequest;
 import org.junit.Assert;
 import org.junit.Test;
@@ -38,7 +37,7 @@ public class TestBasicRequest {
     @Test
     public void testConstructor() throws Exception {
         new BasicHttpRequest("GET", "/stuff");
-        new BasicHttpRequest("GET", "/stuff", HttpVersion.HTTP_1_1);
+        new BasicHttpRequest("GET", "/stuff");
         try {
             new BasicHttpRequest(null, "/stuff");
             Assert.fail("IllegalArgumentException should have been thrown");
@@ -54,11 +53,10 @@ public class TestBasicRequest {
     }
 
     @Test
-    public void testRequestLine() throws Exception {
-        final HttpRequest request = new BasicHttpRequest("GET", "/stuff", HttpVersion.HTTP_1_0);
-        Assert.assertEquals("GET", request.getRequestLine().getMethod());
-        Assert.assertEquals("/stuff", request.getRequestLine().getUri());
-        Assert.assertEquals(HttpVersion.HTTP_1_0, request.getRequestLine().getProtocolVersion());
+    public void testBasics() throws Exception {
+        final HttpRequest request = new BasicHttpRequest("GET", "/stuff");
+        Assert.assertEquals("GET", request.getMethod());
+        Assert.assertEquals("/stuff", request.getUri());
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestDefaultConnectionReuseStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestDefaultConnectionReuseStrategy.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestDefaultConnectionReuseStrategy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestDefaultConnectionReuseStrategy.java Tue Mar 15 20:35:34 2016
@@ -61,26 +61,28 @@ public class TestDefaultConnectionReuseS
 
     @Test
     public void testNoContentLengthResponseHttp1_0() throws Exception {
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_0, 200, "OK");
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         Assert.assertFalse(reuseStrategy.keepAlive(null, response, context));
     }
 
     @Test
     public void testNoContentLengthResponseHttp1_1() throws Exception {
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         Assert.assertFalse(reuseStrategy.keepAlive(null, response, context));
     }
 
     @Test
     public void testChunkedContent() throws Exception {
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Transfer-Encoding", "chunked");
         Assert.assertTrue(reuseStrategy.keepAlive(null, response, context));
     }
 
     @Test
     public void testIgnoreInvalidKeepAlive() throws Exception {
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_0, 200, "OK");
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Connection", "keep-alive");
         Assert.assertFalse(reuseStrategy.keepAlive(null, response, context));
     }
@@ -88,7 +90,7 @@ public class TestDefaultConnectionReuseS
     @Test
     public void testExplicitClose() throws Exception {
         // Use HTTP 1.1
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Transfer-Encoding", "chunked");
         response.addHeader("Connection", "close");
         Assert.assertFalse(reuseStrategy.keepAlive(null, response, context));
@@ -97,7 +99,8 @@ public class TestDefaultConnectionReuseS
     @Test
     public void testExplicitKeepAlive() throws Exception {
         // Use HTTP 1.0
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_0, 200, "OK");
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Content-Length", "10");
         response.addHeader("Connection", "keep-alive");
 
@@ -106,21 +109,15 @@ public class TestDefaultConnectionReuseS
 
     @Test
     public void testHTTP10Default() throws Exception {
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_0, 200, "OK");
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Content-Length", "10");
         Assert.assertFalse(reuseStrategy.keepAlive(null, response, context));
     }
 
     @Test
     public void testHTTP11Default() throws Exception {
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        response.addHeader("Content-Length", "10");
-        Assert.assertTrue(reuseStrategy.keepAlive(null, response, context));
-    }
-
-    @Test
-    public void testFutureHTTP() throws Exception {
-        final HttpResponse response = new BasicHttpResponse(new HttpVersion(3, 45), 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Content-Length", "10");
         Assert.assertTrue(reuseStrategy.keepAlive(null, response, context));
     }
@@ -128,7 +125,8 @@ public class TestDefaultConnectionReuseS
     @Test
     public void testBrokenConnectionDirective1() throws Exception {
         // Use HTTP 1.0
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_0, 200, "OK");
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Content-Length", "10");
         response.addHeader("Connection", "keep--alive");
         Assert.assertFalse(reuseStrategy.keepAlive(null, response, context));
@@ -137,7 +135,8 @@ public class TestDefaultConnectionReuseS
     @Test
     public void testBrokenConnectionDirective2() throws Exception {
         // Use HTTP 1.0
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_0, 200, "OK");
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Content-Length", "10");
         response.addHeader("Connection", null);
         Assert.assertFalse(reuseStrategy.keepAlive(null, response, context));
@@ -146,7 +145,7 @@ public class TestDefaultConnectionReuseS
     @Test
     public void testConnectionTokens1() throws Exception {
         // Use HTTP 1.1
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Transfer-Encoding", "chunked");
         response.addHeader("Connection", "yadda, cLOSe, dumdy");
         Assert.assertFalse(reuseStrategy.keepAlive(null, response, context));
@@ -155,7 +154,7 @@ public class TestDefaultConnectionReuseS
     @Test
     public void testConnectionTokens2() throws Exception {
         // Use HTTP 1.1
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Transfer-Encoding", "chunked");
         response.addHeader("Connection", "yadda, kEEP-alive, dumdy");
         Assert.assertTrue(reuseStrategy.keepAlive(null, response, context));
@@ -164,7 +163,7 @@ public class TestDefaultConnectionReuseS
     @Test
     public void testConnectionTokens3() throws Exception {
         // Use HTTP 1.1
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Transfer-Encoding", "chunked");
         response.addHeader("Connection", "yadda, keep-alive, close, dumdy");
         Assert.assertFalse(reuseStrategy.keepAlive(null, response, context));
@@ -173,7 +172,7 @@ public class TestDefaultConnectionReuseS
     @Test
     public void testConnectionTokens4() throws Exception {
         // Use HTTP 1.1
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Transfer-Encoding", "chunked");
         response.addHeader("Connection", "yadda, close, dumdy");
         response.addHeader("Proxy-Connection", "keep-alive");
@@ -184,7 +183,7 @@ public class TestDefaultConnectionReuseS
     @Test
     public void testConnectionTokens5() throws Exception {
         // Use HTTP 1.1
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Transfer-Encoding", "chunked");
         response.addHeader("Connection", "yadda, dumdy");
         response.addHeader("Proxy-Connection", "close");
@@ -197,7 +196,7 @@ public class TestDefaultConnectionReuseS
     @Test
     public void testConnectionTokens6() throws Exception {
         // Use HTTP 1.1
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Transfer-Encoding", "chunked");
         response.addHeader("Connection", "");
         response.addHeader("Proxy-Connection", "close");
@@ -209,7 +208,7 @@ public class TestDefaultConnectionReuseS
     @Test
     public void testMultipleContentLength() throws Exception {
         // Use HTTP 1.1
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Content-Length", "10");
         response.addHeader("Content-Length", "11");
         Assert.assertFalse(reuseStrategy.keepAlive(null, response, context));
@@ -218,16 +217,15 @@ public class TestDefaultConnectionReuseS
     @Test
     public void testNoContentResponse() throws Exception {
         // Use HTTP 1.1
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_NO_CONTENT, "No Content");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_NO_CONTENT, "No Content");
         Assert.assertTrue(reuseStrategy.keepAlive(null, response, context));
     }
 
     @Test
     public void testNoContentResponseHttp10() throws Exception {
         // Use HTTP 1.0
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_0,
-                HttpStatus.SC_NO_CONTENT, "No Content");
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_NO_CONTENT, "No Content");
         Assert.assertFalse(reuseStrategy.keepAlive(null, response, context));
     }
 
@@ -236,7 +234,7 @@ public class TestDefaultConnectionReuseS
         final HttpRequest request = new BasicHttpRequest("GET", "/");
         request.addHeader("Connection", "close");
 
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Transfer-Encoding", "chunked");
         response.addHeader("Connection", "keep-alive");
         Assert.assertFalse(reuseStrategy.keepAlive(request, response, context));
@@ -247,7 +245,7 @@ public class TestDefaultConnectionReuseS
         final HttpRequest request = new BasicHttpRequest("GET", "/");
         request.addHeader("Connection", "blah, blah, blah");
 
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Transfer-Encoding", "chunked");
         response.addHeader("Connection", "keep-alive");
         Assert.assertTrue(reuseStrategy.keepAlive(request, response, context));
@@ -260,7 +258,7 @@ public class TestDefaultConnectionReuseS
         request.addHeader("Connection", "keep-alive");
         request.addHeader("Connection", "close");
 
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.addHeader("Transfer-Encoding", "chunked");
         response.addHeader("Connection", "keep-alive");
         Assert.assertFalse(reuseStrategy.keepAlive(request, response, context));

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestDefaultContentLengthStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestDefaultContentLengthStrategy.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestDefaultContentLengthStrategy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestDefaultContentLengthStrategy.java Tue Mar 15 20:35:34 2016
@@ -29,7 +29,6 @@ package org.apache.hc.core5.http.impl;
 
 import org.apache.hc.core5.http.ContentLengthStrategy;
 import org.apache.hc.core5.http.HttpMessage;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.NotImplementedException;
 import org.apache.hc.core5.http.ProtocolException;
 import org.apache.hc.core5.http.ProtocolVersion;
@@ -44,8 +43,12 @@ public class TestDefaultContentLengthStr
         private static final long serialVersionUID = 1L;
 
         @Override
-        public ProtocolVersion getProtocolVersion() {
-            return HttpVersion.HTTP_1_1;
+        public ProtocolVersion getVersion() {
+            return null;
+        }
+
+        @Override
+        public void setVersion(final ProtocolVersion version) {
         }
 
     }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java Tue Mar 15 20:35:34 2016
@@ -38,7 +38,6 @@ import java.net.SocketTimeoutException;
 import org.apache.hc.core5.http.ContentLengthStrategy;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.config.MessageConstraints;
 import org.apache.hc.core5.http.message.BasicHttpResponse;
 import org.junit.Assert;
@@ -157,7 +156,7 @@ public class TestBHttpConnectionBase {
     @Test
     public void testCreateEntityLengthDelimited() throws Exception {
         final InputStream instream = Mockito.mock(InputStream.class);
-        final HttpResponse message = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse message = new BasicHttpResponse(200, "OK");
         message.addHeader("Content-Length", "10");
         message.addHeader("Content-Type", "stuff");
         message.addHeader("Content-Encoding", "chunked");
@@ -175,7 +174,7 @@ public class TestBHttpConnectionBase {
     @Test
     public void testCreateEntityInputChunked() throws Exception {
         final InputStream instream = Mockito.mock(InputStream.class);
-        final HttpResponse message = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse message = new BasicHttpResponse(200, "OK");
         final HttpEntity entity = conn.createIncomingEntity(message, conn.inbuffer, instream, ContentLengthStrategy.CHUNKED);
         Assert.assertNotNull(entity);
         Assert.assertTrue(entity.isChunked());
@@ -188,7 +187,7 @@ public class TestBHttpConnectionBase {
     @Test
     public void testCreateEntityInputUndefined() throws Exception {
         final InputStream instream = Mockito.mock(InputStream.class);
-        final HttpResponse message = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse message = new BasicHttpResponse(200, "OK");
         final HttpEntity entity = conn.createIncomingEntity(message, conn.inbuffer, instream, ContentLengthStrategy.UNDEFINED);
         Assert.assertNotNull(entity);
         Assert.assertFalse(entity.isChunked());

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java Tue Mar 15 20:35:34 2016
@@ -35,7 +35,6 @@ import java.nio.charset.StandardCharsets
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.LengthRequiredException;
 import org.apache.hc.core5.http.NotImplementedException;
 import org.apache.hc.core5.http.config.MessageConstraints;
@@ -88,7 +87,6 @@ public class TestDefaultBHttpClientConne
 
         final HttpResponse response = conn.receiveResponseHeader();
         Assert.assertNotNull(response);
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getProtocolVersion());
         Assert.assertEquals(200, response.getCode());
         Assert.assertTrue(response.containsHeader("User-Agent"));
         Assert.assertEquals(1, conn.getMetrics().getResponseCount());
@@ -107,7 +105,6 @@ public class TestDefaultBHttpClientConne
         final HttpResponse response = conn.receiveResponseHeader();
 
         Assert.assertNotNull(response);
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getProtocolVersion());
         Assert.assertEquals(200, response.getCode());
         Assert.assertTrue(response.containsHeader("Server"));
         Assert.assertEquals(1, conn.getMetrics().getResponseCount());
@@ -137,7 +134,6 @@ public class TestDefaultBHttpClientConne
         final HttpResponse response = conn.receiveResponseHeader();
 
         Assert.assertNotNull(response);
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getProtocolVersion());
         Assert.assertEquals(200, response.getCode());
         Assert.assertTrue(response.containsHeader("Server"));
         Assert.assertEquals(1, conn.getMetrics().getResponseCount());
@@ -167,7 +163,6 @@ public class TestDefaultBHttpClientConne
         final HttpResponse response = conn.receiveResponseHeader();
 
         Assert.assertNotNull(response);
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getProtocolVersion());
         Assert.assertEquals(200, response.getCode());
         Assert.assertTrue(response.containsHeader("Server"));
         Assert.assertEquals(1, conn.getMetrics().getResponseCount());
@@ -188,7 +183,6 @@ public class TestDefaultBHttpClientConne
         final HttpResponse response = conn.receiveResponseHeader();
 
         Assert.assertNotNull(response);
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getProtocolVersion());
         Assert.assertEquals(200, response.getCode());
         Assert.assertTrue(response.containsHeader("Server"));
         Assert.assertEquals(1, conn.getMetrics().getResponseCount());
@@ -208,7 +202,7 @@ public class TestDefaultBHttpClientConne
 
         Assert.assertEquals(0, conn.getMetrics().getRequestCount());
 
-        final HttpRequest request = new BasicHttpRequest("GET", "/stuff", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("GET", "/stuff");
         request.addHeader("User-Agent", "test");
 
         conn.sendRequestHeader(request);
@@ -228,7 +222,7 @@ public class TestDefaultBHttpClientConne
 
         Assert.assertEquals(0, conn.getMetrics().getRequestCount());
 
-        final HttpRequest request = new BasicHttpRequest("POST", "/stuff", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("POST", "/stuff");
         request.addHeader("User-Agent", "test");
         request.addHeader("Content-Length", "3");
         request.setEntity(new StringEntity("123", ContentType.TEXT_PLAIN));
@@ -251,7 +245,7 @@ public class TestDefaultBHttpClientConne
 
         Assert.assertEquals(0, conn.getMetrics().getRequestCount());
 
-        final HttpRequest request = new BasicHttpRequest("POST", "/stuff", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("POST", "/stuff");
         request.addHeader("User-Agent", "test");
         request.addHeader("Transfer-Encoding", "chunked");
         request.setEntity(new StringEntity("123", ContentType.TEXT_PLAIN));
@@ -275,7 +269,7 @@ public class TestDefaultBHttpClientConne
 
         Assert.assertEquals(0, conn.getMetrics().getRequestCount());
 
-        final HttpRequest request = new BasicHttpRequest("POST", "/stuff", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("POST", "/stuff");
         request.addHeader("User-Agent", "test");
         request.setEntity(new StringEntity("123", ContentType.TEXT_PLAIN));
 
@@ -292,7 +286,7 @@ public class TestDefaultBHttpClientConne
 
         Assert.assertEquals(0, conn.getMetrics().getRequestCount());
 
-        final HttpRequest request = new BasicHttpRequest("POST", "/stuff", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("POST", "/stuff");
         request.addHeader("User-Agent", "test");
 
         conn.sendRequestHeader(request);
@@ -313,7 +307,7 @@ public class TestDefaultBHttpClientConne
 
         Assert.assertEquals(0, conn.getMetrics().getRequestCount());
 
-        final HttpRequest request = new BasicHttpRequest("POST", "/stuff", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("POST", "/stuff");
         request.addHeader("User-Agent", "test");
         request.addHeader("Transfer-Encoding", "chunked");
         final StringEntity entity = new StringEntity("123", ContentType.TEXT_PLAIN);
@@ -340,7 +334,7 @@ public class TestDefaultBHttpClientConne
 
         Assert.assertEquals(0, conn.getMetrics().getRequestCount());
 
-        final HttpRequest request = new BasicHttpRequest("POST", "/stuff", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("POST", "/stuff");
         request.addHeader("User-Agent", "test");
         request.addHeader("Content-Length", "3");
         final StringEntity entity = new StringEntity("123", ContentType.TEXT_PLAIN);
@@ -367,7 +361,7 @@ public class TestDefaultBHttpClientConne
 
         Assert.assertEquals(0, conn.getMetrics().getRequestCount());
 
-        final HttpRequest request = new BasicHttpRequest("POST", "/stuff", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("POST", "/stuff");
         request.addHeader("User-Agent", "test");
         request.addHeader("Content-Length", "3000");
         final ByteArrayEntity entity = new ByteArrayEntity(new byte[3000], ContentType.TEXT_PLAIN);



Mime
View raw message