hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1737929 [2/2] - in /httpcomponents/httpcore/trunk: httpcore5-ab/src/main/java/org/apache/hc/core5/http/benchmark/ httpcore5-h2/src/main/java/org/apache/hc/core5/http2/ httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/ httpcore5-h...
Date Wed, 06 Apr 2016 07:21:14 GMT
Added: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseParser.java?rev=1737929&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseParser.java (added)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseParser.java Wed Apr  6 07:21:14 2016
@@ -0,0 +1,183 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.http2.impl.io;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+
+import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.HttpException;
+import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.message.BasicHeader;
+import org.apache.hc.core5.http2.hpack.HPackEncoder;
+import org.apache.hc.core5.util.ByteArrayBuffer;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public class TestHttp2ResponseParser {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    @Test
+    public void testBasicParse() throws Exception {
+
+        final ByteArrayBuffer buf = new ByteArrayBuffer(128);
+        final HPackEncoder encoder = new HPackEncoder(StandardCharsets.US_ASCII);
+        encoder.encodeHeaders(buf, Arrays.<Header>asList(
+                new BasicHeader(":status", "200"),
+                new BasicHeader("location", "http://www.example.com/"),
+                new BasicHeader("custom123", "value")));
+        final ByteBuffer src = ByteBuffer.wrap(buf.buffer(), 0, buf.length());
+
+        final Http2ResponseParser parser = new Http2ResponseParser(StandardCharsets.US_ASCII);
+        final HttpResponse response = parser.parse(src);
+        Assert.assertNotNull(response );
+        Assert.assertEquals(200, response .getCode());
+        final Header[] allHeaders = response.getAllHeaders();
+        Assert.assertEquals(2, allHeaders.length);
+        Assert.assertEquals("location", allHeaders[0].getName());
+        Assert.assertEquals("http://www.example.com/", allHeaders[0].getValue());
+        Assert.assertEquals("custom123", allHeaders[1].getName());
+        Assert.assertEquals("value", allHeaders[1].getValue());
+    }
+
+    @Test
+    public void testParseUpperCaseHeaderName() throws Exception {
+
+        thrown.expect(HttpException.class);
+        thrown.expectMessage("Header name ':Status' is invalid (header name contains uppercase characters)");
+
+        final ByteArrayBuffer buf = new ByteArrayBuffer(128);
+        final HPackEncoder encoder = new HPackEncoder(StandardCharsets.US_ASCII);
+        encoder.encodeHeaders(buf, Arrays.<Header>asList(
+                new BasicHeader(":Status", "200"),
+                new BasicHeader("location", "http://www.example.com/"),
+                new BasicHeader("custom123", "value")));
+        final ByteBuffer src = ByteBuffer.wrap(buf.buffer(), 0, buf.length());
+
+        final Http2ResponseParser parser = new Http2ResponseParser(StandardCharsets.US_ASCII);
+        parser.parse(src);
+    }
+
+    @Test
+    public void testParseInvalidStatusCode() throws Exception {
+
+        thrown.expect(HttpException.class);
+        thrown.expectMessage("Invalid response status: boom");
+
+        final ByteArrayBuffer buf = new ByteArrayBuffer(128);
+        final HPackEncoder encoder = new HPackEncoder(StandardCharsets.US_ASCII);
+        encoder.encodeHeaders(buf, Arrays.<Header>asList(
+                new BasicHeader(":status", "boom"),
+                new BasicHeader("location", "http://www.example.com/"),
+                new BasicHeader("custom123", "value")));
+        final ByteBuffer src = ByteBuffer.wrap(buf.buffer(), 0, buf.length());
+
+        final Http2ResponseParser parser = new Http2ResponseParser(StandardCharsets.US_ASCII);
+        parser.parse(src);
+    }
+
+    @Test
+    public void testParseConnectionHeader() throws Exception {
+
+        thrown.expect(HttpException.class);
+        thrown.expectMessage("Header 'connection: keep-alive' is illegal for HTTP/2 messages");
+
+        final ByteArrayBuffer buf = new ByteArrayBuffer(128);
+        final HPackEncoder encoder = new HPackEncoder(StandardCharsets.US_ASCII);
+        encoder.encodeHeaders(buf, Arrays.<Header>asList(
+                new BasicHeader(":status", "200"),
+                new BasicHeader("location", "http://www.example.com/"),
+                new BasicHeader("connection", "keep-alive")));
+        final ByteBuffer src = ByteBuffer.wrap(buf.buffer(), 0, buf.length());
+
+        final Http2ResponseParser parser = new Http2ResponseParser(StandardCharsets.US_ASCII);
+        parser.parse(src);
+    }
+
+    @Test
+    public void testParseMissingStatus() throws Exception {
+
+        thrown.expect(HttpException.class);
+        thrown.expectMessage("Mandatory response header ':status' not found");
+
+        final ByteArrayBuffer buf = new ByteArrayBuffer(128);
+        final HPackEncoder encoder = new HPackEncoder(StandardCharsets.US_ASCII);
+        encoder.encodeHeaders(buf, Arrays.<Header>asList(
+                new BasicHeader("location", "http://www.example.com/"),
+                new BasicHeader("custom", "value")));
+        final ByteBuffer src = ByteBuffer.wrap(buf.buffer(), 0, buf.length());
+
+        final Http2ResponseParser parser = new Http2ResponseParser(StandardCharsets.US_ASCII);
+        parser.parse(src);
+    }
+
+    @Test
+    public void testParseUnknownPseudoHeader() throws Exception {
+
+        thrown.expect(HttpException.class);
+        thrown.expectMessage("Unsupported response header ':custom'");
+
+        final ByteArrayBuffer buf = new ByteArrayBuffer(128);
+        final HPackEncoder encoder = new HPackEncoder(StandardCharsets.US_ASCII);
+        encoder.encodeHeaders(buf, Arrays.<Header>asList(
+                new BasicHeader(":status", "200"),
+                new BasicHeader(":custom", "200"),
+                new BasicHeader("location", "http://www.example.com/"),
+                new BasicHeader("custom1", "value")));
+        final ByteBuffer src = ByteBuffer.wrap(buf.buffer(), 0, buf.length());
+
+        final Http2ResponseParser parser = new Http2ResponseParser(StandardCharsets.US_ASCII);
+        parser.parse(src);
+    }
+
+    @Test
+    public void testParseMultipleStatus() throws Exception {
+
+        thrown.expect(HttpException.class);
+        thrown.expectMessage("Multiple ':status' response headers are illegal");
+
+        final ByteArrayBuffer buf = new ByteArrayBuffer(128);
+        final HPackEncoder encoder = new HPackEncoder(StandardCharsets.US_ASCII);
+        encoder.encodeHeaders(buf, Arrays.<Header>asList(
+                new BasicHeader(":status", "200"),
+                new BasicHeader(":status", "200"),
+                new BasicHeader("location", "http://www.example.com/"),
+                new BasicHeader("custom1", "value")));
+        final ByteBuffer src = ByteBuffer.wrap(buf.buffer(), 0, buf.length());
+
+        final Http2ResponseParser parser = new Http2ResponseParser(StandardCharsets.US_ASCII);
+        parser.parse(src);
+    }
+
+}
+

Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseParser.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseParser.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseWriter.java?rev=1737929&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseWriter.java (added)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseWriter.java Wed Apr  6 07:21:14 2016
@@ -0,0 +1,121 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.http2.impl.io;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
+import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.HttpException;
+import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.message.BasicHttpResponse;
+import org.apache.hc.core5.http2.hpack.HPackDecoder;
+import org.apache.hc.core5.util.ByteArrayBuffer;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public class TestHttp2ResponseWriter {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    @Test
+    public void testBasicWrite() throws Exception {
+
+        final ByteArrayBuffer buf = new ByteArrayBuffer(128);
+
+        final HttpResponse response = new BasicHttpResponse(200);
+        response.addHeader("Custom123", "Value");
+
+        final Http2ResponseWriter writer = new Http2ResponseWriter(StandardCharsets.US_ASCII);
+        writer.write(response, buf);
+
+        final ByteBuffer src = ByteBuffer.wrap(buf.buffer(), 0, buf.length());
+        final HPackDecoder decoder = new HPackDecoder(StandardCharsets.US_ASCII);
+        final List<Header> headers = decoder.decodeHeaders(src);
+
+        Assert.assertNotNull(headers);
+        Assert.assertEquals(2, headers.size());
+        final Header header1 = headers.get(0);
+        Assert.assertEquals(":status", header1.getName());
+        Assert.assertEquals("200", header1.getValue());
+        final Header header2 = headers.get(1);
+        Assert.assertEquals("custom123", header2.getName());
+        Assert.assertEquals("Value", header2.getValue());
+    }
+
+    @Test
+    public void testWriteInvalidStatus() throws Exception {
+
+        thrown.expect(HttpException.class);
+        thrown.expectMessage("Response status 99 is invalid");
+
+        final ByteArrayBuffer buf = new ByteArrayBuffer(128);
+
+        final HttpResponse response = new BasicHttpResponse(99);
+        response.addHeader("Custom123", "Value");
+
+        final Http2ResponseWriter writer = new Http2ResponseWriter(StandardCharsets.US_ASCII);
+        writer.write(response, buf);
+    }
+
+    @Test
+    public void testWriteConnectionHeader() throws Exception {
+
+        thrown.expect(HttpException.class);
+        thrown.expectMessage("Header 'Connection: Keep-Alive' is illegal for HTTP/2 messages");
+
+        final ByteArrayBuffer buf = new ByteArrayBuffer(128);
+
+        final HttpResponse response = new BasicHttpResponse(200);
+        response.addHeader("Connection", "Keep-Alive");
+
+        final Http2ResponseWriter writer = new Http2ResponseWriter(StandardCharsets.US_ASCII);
+        writer.write(response, buf);
+    }
+
+    @Test
+    public void testWriteInvalidHeader() throws Exception {
+
+        thrown.expect(HttpException.class);
+        thrown.expectMessage("Header name ':custom' is invalid");
+
+        final ByteArrayBuffer buf = new ByteArrayBuffer(128);
+
+        final HttpResponse response = new BasicHttpResponse(200);
+        response.addHeader(":custom", "stuff");
+
+        final Http2ResponseWriter writer = new Http2ResponseWriter(StandardCharsets.US_ASCII);
+        writer.write(response, buf);
+    }
+
+}
+

Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseWriter.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/io/TestHttp2ResponseWriter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/HttpRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/HttpRequest.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/HttpRequest.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/HttpRequest.java Wed Apr  6 07:21:14 2016
@@ -37,33 +37,56 @@ package org.apache.hc.core5.http;
 public interface HttpRequest extends HttpMessage<HttpEntity> {
 
     /**
-     * Obtains the method of this request message.
+     * Returns method of this request message.
      *
      * @return  the request method.
      */
     String getMethod();
 
     /**
-     * Obtains the URI of this request message.
+     * Returns URI path of this request message or {@code null} if not set.
      *
-     * @return  the request URI.
+     * @return  the request URI or {@code null}.
      */
-    String getUri();
+    String getPath();
 
     /**
-     * Obtains target host of this request message if available.
+     * Sets URI path of this request message.
      *
-     * @return  the target host or {@code null}.
+     * @since 5.0
+     */
+    void setPath(String path);
+
+    /**
+     * Returns scheme of this request message.
+     *
+     * @return  the scheme or {@code null}.
+     *
+     * @since 5.0
+     */
+    String getScheme();
+
+    /**
+     * Sets scheme of this request message.
+     *
+     * @since 5.0
+     */
+    void setScheme(String scheme);
+
+    /**
+     * Returns authority of this request message.
+     *
+     * @return  the authority or {@code null}.
      *
      * @since 5.0
      */
-    HttpHost getHost();
+    String getAuthority();
 
     /**
-     * Sets target host of this request message.
+     * Sets authority of this request message.
      *
      * @since 5.0
      */
-    void setHost(HttpHost host);
+    void setAuthority(String authority);
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/MessageHead.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/MessageHead.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/MessageHead.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/MessageHead.java Wed Apr  6 07:21:14 2016
@@ -64,6 +64,17 @@ public interface MessageHead {
     Header[] getHeaders(String name);
 
     /**
+     * Gets single first header with the given name.
+     *
+     * <p>Header name comparison is case insensitive.
+     *
+     * @param name the name of the header to get
+     * @return the first header or {@code null}
+     * @throws ProtocolException in case multiple headers with the given name are found.
+     */
+    Header getSingleHeader(String name) throws ProtocolException;
+
+    /**
      * Returns the first header with a specified name of this message. Header
      * values are ignored. If there is more than one matching header in the
      * message the first element of {@link #getHeaders(String)} is returned.

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultHttpRequestWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultHttpRequestWriter.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultHttpRequestWriter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultHttpRequestWriter.java Wed Apr  6 07:21:14 2016
@@ -69,7 +69,7 @@ public class DefaultHttpRequestWriter ex
             transportVersion = HttpVersion.HTTP_1_1;
         }
         getLineFormatter().formatRequestLine(lineBuf,
-                new RequestLine(message.getMethod(), message.getUri(), transportVersion));
+                new RequestLine(message.getMethod(), message.getPath(), transportVersion));
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpRequestWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpRequestWriter.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpRequestWriter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpRequestWriter.java Wed Apr  6 07:21:14 2016
@@ -73,7 +73,7 @@ public class DefaultHttpRequestWriter ex
             transportVersion = HttpVersion.HTTP_1_1;
         }
         getLineFormatter().formatRequestLine(lineBuf,
-                new RequestLine(message.getMethod(), message.getUri(), transportVersion));
+                new RequestLine(message.getMethod(), message.getPath(), transportVersion));
     }
 
 }

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=1737929&r1=1737928&r2=1737929&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 Wed Apr  6 07:21:14 2016
@@ -622,7 +622,7 @@ public class HttpAsyncRequestExecutor im
                 buf.append(" ");
                 buf.append(this.request.getMethod());
                 buf.append(" ");
-                buf.append(this.request.getUri());
+                buf.append(this.request.getPath());
             }
             buf.append("; incoming ");
             buf.append(this.responseState);

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=1737929&r1=1737928&r2=1737929&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 Wed Apr  6 07:21:14 2016
@@ -892,7 +892,7 @@ public class HttpAsyncService implements
                 buf.append(" ");
                 buf.append(this.incoming.getRequest().getMethod());
                 buf.append(" ");
-                buf.append(this.incoming.getRequest().getUri());
+                buf.append(this.incoming.getRequest().getPath());
             }
             buf.append("; outgoing ");
             buf.append(this.responseState);

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=1737929&r1=1737928&r2=1737929&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 Wed Apr  6 07:21:14 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.getUri();
+        String uriPath = request.getPath();
         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/HttpMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageParser.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageParser.java Wed Apr  6 07:21:14 2016
@@ -31,24 +31,24 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.hc.core5.http.HttpException;
-import org.apache.hc.core5.http.HttpMessage;
+import org.apache.hc.core5.http.MessageHead;
 
 /**
- * Abstract message parser intended to build HTTP messages from an arbitrary data source.
+ * Message parser intended to build HTTP message head from an input stream..
  *
  * @param <T>
- *            {@link HttpMessage} or a subclass
+ *            {@link MessageHead} or a subclass
  *
  * @since 4.0
  */
-public interface HttpMessageParser<T extends HttpMessage> {
+public interface HttpMessageParser<T extends MessageHead> {
 
     /**
-     * Generates an instance of {@link HttpMessage} from an input buffer.
+     * Generates an instance of {@link MessageHead} from the given input stream..
      *
      * @param buffer Session input buffer
      * @param inputStream Input stream
-     * @return HTTP message
+     * @return HTTP message head
      * @throws IOException in case of an I/O error
      * @throws HttpException in case of HTTP protocol violation
      */

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageParserFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageParserFactory.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageParserFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageParserFactory.java Wed Apr  6 07:21:14 2016
@@ -27,7 +27,7 @@
 
 package org.apache.hc.core5.http.io;
 
-import org.apache.hc.core5.http.HttpMessage;
+import org.apache.hc.core5.http.MessageHead;
 import org.apache.hc.core5.http.config.MessageConstraints;
 
 /**
@@ -35,7 +35,7 @@ import org.apache.hc.core5.http.config.M
  *
  * @since 4.3
  */
-public interface HttpMessageParserFactory<T extends HttpMessage> {
+public interface HttpMessageParserFactory<T extends MessageHead> {
 
     HttpMessageParser<T> create(MessageConstraints constraints);
 

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageWriter.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageWriter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageWriter.java Wed Apr  6 07:21:14 2016
@@ -31,20 +31,19 @@ import java.io.IOException;
 import java.io.OutputStream;
 
 import org.apache.hc.core5.http.HttpException;
-import org.apache.hc.core5.http.HttpMessage;
+import org.apache.hc.core5.http.MessageHead;
 
 /**
- * Abstract message writer intended to serialize HTTP messages to an arbitrary
- * data sink.
+ * Message writer intended to serialize HTTP message head to an output stream.
  *
  * @since 4.0
  */
-public interface HttpMessageWriter<T extends HttpMessage> {
+public interface HttpMessageWriter<T extends MessageHead> {
 
     /**
-     * Serializes an instance of {@link HttpMessage} to an output buffer.
+     * Serializes an instance of {@link MessageHead} to the given output stream.
      *
-     * @param message HTTP message
+     * @param message HTTP message head
      * @param buffer session output buffer
      * @throws IOException in case of an I/O error
      * @throws HttpException in case of HTTP protocol violation

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageWriterFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageWriterFactory.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageWriterFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpMessageWriterFactory.java Wed Apr  6 07:21:14 2016
@@ -27,14 +27,14 @@
 
 package org.apache.hc.core5.http.io;
 
-import org.apache.hc.core5.http.HttpMessage;
+import org.apache.hc.core5.http.MessageHead;
 
 /**
  * Factory for {@link HttpMessageWriter} instances.
  *
  * @since 4.3
  */
-public interface HttpMessageWriterFactory<T extends HttpMessage> {
+public interface HttpMessageWriterFactory<T extends MessageHead> {
 
     HttpMessageWriter<T> create();
 

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=1737929&r1=1737928&r2=1737929&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 Wed Apr  6 07:21:14 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.getUri();
+        String uriPath = request.getPath();
         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=1737929&r1=1737928&r2=1737929&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 Wed Apr  6 07:21:14 2016
@@ -47,34 +47,36 @@ public class BasicHttpRequest extends Ab
     private static final long serialVersionUID = 1L;
 
     private final String method;
-    private HttpHost host;
-    private String requestUri;
+    private String path;
+    private String scheme;
+    private String authority;
     private ProtocolVersion version;
 
     /**
-     * Creates request message with the given method and request URI.
+     * Creates request message with the given method and request path.
      *
      * @param method request method.
-     * @param requestUri request URI.
+     * @param path request path.
      */
-    public BasicHttpRequest(final String method, final String requestUri) {
-        this(method, null, requestUri);
+    public BasicHttpRequest(final String method, final String path) {
+        this(method, null, path);
     }
 
     /**
-     * Creates request message with the given method, host and request URI.
+     * Creates request message with the given method, host and request path.
      *
      * @param method request method.
      * @param host request host.
-     * @param requestUri request URI.
+     * @param path request path.
      *
      * @since 5.0
      */
-    public BasicHttpRequest(final String method, final HttpHost host, final String requestUri) {
+    public BasicHttpRequest(final String method, final HttpHost host, final String path) {
         super();
         this.method = Args.notNull(method, "Method name");
-        this.host = host;
-        this.requestUri = Args.notNull(requestUri, "Request URI");
+        this.scheme = host != null ? host.getSchemeName() : null;
+        this.authority = host != null ? host.toHostString() : null;
+        this.path = path;
     }
 
     /**
@@ -89,11 +91,8 @@ public class BasicHttpRequest extends Ab
         super();
         this.method = Args.notNull(method, "Method name");
         Args.notNull(requestUri, "Request URI");
-        if (requestUri.isAbsolute()) {
-            this.host = new HttpHost(requestUri.getHost(), requestUri.getPort(), requestUri.getScheme());
-        } else {
-            this.host = null;
-        }
+        this.scheme = requestUri.getScheme();
+        this.authority = requestUri.getAuthority();
         final StringBuilder buf = new StringBuilder();
         final String path = requestUri.getRawPath();
         if (!TextUtils.isBlank(path)) {
@@ -105,7 +104,7 @@ public class BasicHttpRequest extends Ab
         if (query != null) {
             buf.append('?').append(query);
         }
-        this.requestUri = buf.toString();
+        this.path = buf.toString();
     }
 
     @Override
@@ -123,31 +122,40 @@ public class BasicHttpRequest extends Ab
         return this.method;
     }
 
-    /**
-     * @since 5.0
-     */
     @Override
-    public HttpHost getHost() {
-        return this.host;
+    public String getPath() {
+        return this.path;
+    }
+
+    @Override
+    public void setPath(final String requestUri) {
+        this.path = requestUri;
+    }
+
+    @Override
+    public String getScheme() {
+        return this.scheme;
+    }
+
+    @Override
+    public void setScheme(final String scheme) {
+        this.scheme = scheme;
     }
 
-    /**
-     * @since 5.0
-     */
     @Override
-    public void setHost(final HttpHost host) {
-        this.host = host;
+    public String getAuthority() {
+        return this.authority;
     }
 
     @Override
-    public String getUri() {
-        return this.requestUri;
+    public void setAuthority(final String authority) {
+        this.authority = authority;
     }
 
     @Override
     public String toString() {
         final StringBuilder sb = new StringBuilder();
-        sb.append(this.method).append(" ").append(this.host).append(" ").append(this.requestUri).append(" ")
+        sb.append(this.method).append(" ").append(this.scheme).append("://").append(this.authority).append("/").append(this.path).append(" ")
                 .append(super.toString());
         return sb.toString();
     }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/HeaderGroup.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/HeaderGroup.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/HeaderGroup.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/HeaderGroup.java Wed Apr  6 07:21:14 2016
@@ -36,6 +36,7 @@ import java.util.Locale;
 
 import org.apache.hc.core5.annotation.NotThreadSafe;
 import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.ProtocolException;
 import org.apache.hc.core5.util.CharArrayBuffer;
 
 /**
@@ -49,6 +50,10 @@ import org.apache.hc.core5.util.CharArra
 @NotThreadSafe
 public class HeaderGroup implements Serializable {
 
+
+    // HTTPCORE-361 : we don't use the for-each syntax, when iterating headers
+    // as that creates an Iterator that needs to be garbage-collected
+
     private static final long serialVersionUID = 2608834160639271617L;
 
     private final Header[] EMPTY = new Header[] {};
@@ -108,9 +113,6 @@ public class HeaderGroup implements Seri
         if (header == null) {
             return;
         }
-        // HTTPCORE-361 : we don't use the for-each syntax, i.e.
-        //     for (Header header : headers)
-        // as that creates an Iterator that needs to be garbage-collected
         for (int i = 0; i < this.headers.size(); i++) {
             final Header current = this.headers.get(i);
             if (current.getName().equalsIgnoreCase(header.getName())) {
@@ -178,9 +180,6 @@ public class HeaderGroup implements Seri
      */
     public Header[] getHeaders(final String name) {
         List<Header> headersFound = null;
-        // HTTPCORE-361 : we don't use the for-each syntax, i.e.
-        //     for (Header header : headers)
-        // as that creates an Iterator that needs to be garbage-collected
         for (int i = 0; i < this.headers.size(); i++) {
             final Header header = this.headers.get(i);
             if (header.getName().equalsIgnoreCase(name)) {
@@ -202,9 +201,6 @@ public class HeaderGroup implements Seri
      * @return the first header or {@code null}
      */
     public Header getFirstHeader(final String name) {
-        // HTTPCORE-361 : we don't use the for-each syntax, i.e.
-        //     for (Header header : headers)
-        // as that creates an Iterator that needs to be garbage-collected
         for (int i = 0; i < this.headers.size(); i++) {
             final Header header = this.headers.get(i);
             if (header.getName().equalsIgnoreCase(name)) {
@@ -215,6 +211,31 @@ public class HeaderGroup implements Seri
     }
 
     /**
+     * Gets single first header with the given name.
+     *
+     * <p>Header name comparison is case insensitive.
+     *
+     * @param name the name of the header to get
+     * @return the first header or {@code null}
+     * @throws ProtocolException in case multiple headers with the given name are found.
+     */
+    public Header getSingleHeader(final String name) throws ProtocolException {
+        int count = 0;
+        Header singleHeader = null;
+        for (int i = 0; i < this.headers.size(); i++) {
+            final Header header = this.headers.get(i);
+            if (header.getName().equalsIgnoreCase(name)) {
+                singleHeader = header;
+                count++;
+            }
+        }
+        if (count > 1) {
+            throw new ProtocolException("Multiple headers '" + name + "' found");
+        }
+        return singleHeader;
+    }
+
+    /**
      * Gets the last header with the given name.
      *
      * <p>Header name comparison is case insensitive.

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageParser.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageParser.java Wed Apr  6 07:21:14 2016
@@ -30,14 +30,14 @@ package org.apache.hc.core5.http.nio;
 import java.io.IOException;
 
 import org.apache.hc.core5.http.HttpException;
-import org.apache.hc.core5.http.HttpMessage;
+import org.apache.hc.core5.http.MessageHead;
 
 /**
- * Abstract HTTP message parser for non-blocking connections.
+ * Message parser intended to build HTTP message head from a session input buffer..
  *
  * @since 4.0
  */
-public interface NHttpMessageParser<T extends HttpMessage> {
+public interface NHttpMessageParser<T extends MessageHead> {
 
     /**
      * Resets the parser. The parser will be ready to start parsing another

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageParserFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageParserFactory.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageParserFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageParserFactory.java Wed Apr  6 07:21:14 2016
@@ -27,7 +27,7 @@
 
 package org.apache.hc.core5.http.nio;
 
-import org.apache.hc.core5.http.HttpMessage;
+import org.apache.hc.core5.http.MessageHead;
 import org.apache.hc.core5.http.config.MessageConstraints;
 
 /**
@@ -35,7 +35,7 @@ import org.apache.hc.core5.http.config.M
  *
  * @since 4.3
  */
-public interface NHttpMessageParserFactory<T extends HttpMessage> {
+public interface NHttpMessageParserFactory<T extends MessageHead> {
 
     NHttpMessageParser<T> create(MessageConstraints constraints);
 

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageWriter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageWriter.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageWriter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageWriter.java Wed Apr  6 07:21:14 2016
@@ -30,14 +30,14 @@ package org.apache.hc.core5.http.nio;
 import java.io.IOException;
 
 import org.apache.hc.core5.http.HttpException;
-import org.apache.hc.core5.http.HttpMessage;
+import org.apache.hc.core5.http.MessageHead;
 
 /**
- * Abstract HTTP message writer for non-blocking connections.
+ * Message writer intended to serialize HTTP message head to a session buffer.
  *
  * @since 4.0
  */
-public interface NHttpMessageWriter<T extends HttpMessage> {
+public interface NHttpMessageWriter<T extends MessageHead> {
 
     /**
      * Resets the writer. The writer will be ready to start serializing another
@@ -46,7 +46,7 @@ public interface NHttpMessageWriter<T ex
     void reset();
 
     /**
-     * Serializes out the HTTP message head.
+     * Writes out the HTTP message head.
      *
      * @param message HTTP message.
      * @param buffer session output buffer.

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageWriterFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageWriterFactory.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageWriterFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpMessageWriterFactory.java Wed Apr  6 07:21:14 2016
@@ -27,14 +27,14 @@
 
 package org.apache.hc.core5.http.nio;
 
-import org.apache.hc.core5.http.HttpMessage;
+import org.apache.hc.core5.http.MessageHead;
 
 /**
  * Factory for {@link org.apache.hc.core5.http.nio.NHttpMessageWriter} instances.
  *
  * @since 4.3
  */
-public interface NHttpMessageWriterFactory<T extends HttpMessage> {
+public interface NHttpMessageWriterFactory<T extends MessageHead> {
 
     NHttpMessageWriter<T> create();
 

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=1737929&r1=1737928&r2=1737929&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 Wed Apr  6 07:21:14 2016
@@ -34,7 +34,6 @@ import org.apache.hc.core5.annotation.Im
 import org.apache.hc.core5.http.HttpConnection;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHeaders;
-import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpRequestInterceptor;
 import org.apache.hc.core5.http.HttpVersion;
@@ -68,8 +67,8 @@ public class RequestTargetHost implement
         }
 
         if (!request.containsHeader(HttpHeaders.HOST)) {
-            HttpHost targethost = request.getHost();
-            if (targethost == null) {
+            String authority = request.getAuthority();
+            if (authority == null) {
                 // Populate the context with a default HTTP host based on the
                 // inet address of the target host
                 final HttpCoreContext coreContext = HttpCoreContext.adapt(context);
@@ -77,17 +76,17 @@ public class RequestTargetHost implement
                 if (conn != null) {
                     final InetSocketAddress remoteAddress = (InetSocketAddress) conn.getRemoteAddress();
                     if (remoteAddress != null) {
-                        targethost = new HttpHost(remoteAddress.getHostName(), remoteAddress.getPort());
+                        authority = remoteAddress.getHostName() + ":" +  remoteAddress.getPort();
                     }
                 }
-                if (targethost == null) {
+                if (authority == null) {
                     if (ver.lessEquals(HttpVersion.HTTP_1_0)) {
                         return;
                     }
                     throw new ProtocolException("Target host is unknown");
                 }
             }
-            request.addHeader(HttpHeaders.HOST, targethost.toHostString());
+            request.addHeader(HttpHeaders.HOST, authority);
         }
     }
 

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=1737929&r1=1737928&r2=1737929&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 Wed Apr  6 07:21:14 2016
@@ -33,7 +33,6 @@ import org.apache.hc.core5.annotation.Im
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHeaders;
-import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpRequestInterceptor;
 import org.apache.hc.core5.http.HttpVersion;
@@ -44,7 +43,7 @@ import org.apache.hc.core5.util.TextUtil
 
 /**
  * RequestTargetHost is responsible for copying {@code Host} header value to
- * {@link HttpRequest#setHost(HttpHost)} of the incoming message.
+ * {@link HttpRequest#setAuthority(String)} of the incoming message.
  * This interceptor is required for server side protocol processors.
  *
  * @since 5.0
@@ -61,32 +60,17 @@ public class RequestValidateHost impleme
             throws HttpException, IOException {
         Args.notNull(request, "HTTP request");
 
-        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) {
-                throw new ProtocolException("Host header is absent");
-            } else if (n > 1) {
-                throw new ProtocolException("Multiple Host headers found");
-            }
-        }
-        final Header header = request.getFirstHeader(HttpHeaders.HOST);
+        final Header header = request.getSingleHeader(HttpHeaders.HOST);
         if (header != null) {
-            String text = header.getValue();
-            if (TextUtils.isBlank(text)) {
-                throw new ProtocolException("Empty host header");
+            final String authority = header.getValue();
+            if (!TextUtils.isBlank(authority)) {
+                request.setAuthority(authority);
             }
-            int port = -1;
-            final int portIdx = text.lastIndexOf(":");
-            if (portIdx > 0) {
-                try {
-                    port = Integer.parseInt(text.substring(portIdx + 1));
-                } catch (final NumberFormatException ex) {
-                    throw new ProtocolException("Invalid HTTP host: " + text);
-                }
-                text = text.substring(0, portIdx);
+        } else {
+            final ProtocolVersion version = request.getVersion() != null ? request.getVersion() : HttpVersion.HTTP_1_1;
+            if (version.greaterEquals(HttpVersion.HTTP_1_1)) {
+                throw new ProtocolException("Host header is absent");
             }
-            request.setHost(new HttpHost(text, port, null));
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java Wed Apr  6 07:21:14 2016
@@ -86,7 +86,7 @@ public class TestDefaultBHttpServerConne
 
         final HttpRequest request = conn.receiveRequestHeader();
         Assert.assertNotNull(request);
-        Assert.assertEquals("/", request.getUri());
+        Assert.assertEquals("/", request.getPath());
         Assert.assertEquals("GET", request.getMethod());
         Assert.assertTrue(request.containsHeader("User-Agent"));
         Assert.assertEquals(1, conn.getMetrics().getRequestCount());
@@ -105,7 +105,7 @@ public class TestDefaultBHttpServerConne
         final HttpRequest request = conn.receiveRequestHeader();
 
         Assert.assertNotNull(request);
-        Assert.assertEquals("/", request.getUri());
+        Assert.assertEquals("/", request.getPath());
         Assert.assertEquals("POST", request.getMethod());
         Assert.assertTrue(request.containsHeader("User-Agent"));
         Assert.assertNull(request.getEntity());
@@ -136,7 +136,7 @@ public class TestDefaultBHttpServerConne
         final HttpRequest request = conn.receiveRequestHeader();
 
         Assert.assertNotNull(request);
-        Assert.assertEquals("/stuff", request.getUri());
+        Assert.assertEquals("/stuff", request.getPath());
         Assert.assertEquals("POST", request.getMethod());
         Assert.assertTrue(request.containsHeader("User-Agent"));
         Assert.assertNull(request.getEntity());
@@ -168,7 +168,7 @@ public class TestDefaultBHttpServerConne
         final HttpRequest request = conn.receiveRequestHeader();
 
         Assert.assertNotNull(request);
-        Assert.assertEquals("/stuff", request.getUri());
+        Assert.assertEquals("/stuff", request.getPath());
         Assert.assertEquals("POST", request.getMethod());
         Assert.assertTrue(request.containsHeader("User-Agent"));
         Assert.assertNull(request.getEntity());
@@ -190,7 +190,7 @@ public class TestDefaultBHttpServerConne
         final HttpRequest request = conn.receiveRequestHeader();
 
         Assert.assertNotNull(request);
-        Assert.assertEquals("/stuff", request.getUri());
+        Assert.assertEquals("/stuff", request.getPath());
         Assert.assertEquals("POST", request.getMethod());
         Assert.assertTrue(request.containsHeader("User-Agent"));
         Assert.assertNull(request.getEntity());

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestRequestParser.java Wed Apr  6 07:21:14 2016
@@ -60,7 +60,7 @@ public class TestRequestParser {
         final HttpRequest httprequest = parser.parse(inbuffer, inputStream);
 
         Assert.assertEquals("GET", httprequest.getMethod());
-        Assert.assertEquals("/", httprequest.getUri());
+        Assert.assertEquals("/", httprequest.getPath());
         final Header[] headers = httprequest.getAllHeaders();
         Assert.assertEquals(3, headers.length);
     }
@@ -90,7 +90,7 @@ public class TestRequestParser {
         final HttpRequest httprequest = parser.parse(inbuffer, inputStream);
 
         Assert.assertEquals("GET", httprequest.getMethod());
-        Assert.assertEquals("/", httprequest.getUri());
+        Assert.assertEquals("/", httprequest.getPath());
         final Header[] headers = httprequest.getAllHeaders();
         Assert.assertEquals(1, headers.length);
     }
@@ -141,7 +141,7 @@ public class TestRequestParser {
         Assert.assertEquals(5, timeoutCount);
 
         Assert.assertEquals("GET", httprequest.getMethod());
-        Assert.assertEquals("/", httprequest.getUri());
+        Assert.assertEquals("/", httprequest.getPath());
         final Header[] headers = httprequest.getAllHeaders();
         Assert.assertEquals(3, headers.length);
     }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestDefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestDefaultNHttpServerConnection.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestDefaultNHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestDefaultNHttpServerConnection.java Wed Apr  6 07:21:14 2016
@@ -480,7 +480,7 @@ public class TestDefaultNHttpServerConne
         final HttpRequest request = requests.getFirst();
         Assert.assertNotNull(request);
         Assert.assertEquals("POST", request.getMethod());
-        Assert.assertEquals("/", request.getUri());
+        Assert.assertEquals("/", request.getPath());
         Assert.assertTrue(request instanceof HttpRequest);
         final HttpEntity entity = request.getEntity();
         Assert.assertNotNull(entity);
@@ -525,7 +525,7 @@ public class TestDefaultNHttpServerConne
         final HttpRequest request = requests.getFirst();
         Assert.assertNotNull(request);
         Assert.assertEquals("POST", request.getMethod());
-        Assert.assertEquals("/", request.getUri());
+        Assert.assertEquals("/", request.getPath());
         Assert.assertTrue(request instanceof HttpRequest);
         final HttpEntity entity = request.getEntity();
         Assert.assertNotNull(entity);
@@ -573,7 +573,7 @@ public class TestDefaultNHttpServerConne
         final HttpRequest request = requests.getFirst();
         Assert.assertNotNull(request);
         Assert.assertEquals("GET", request.getMethod());
-        Assert.assertEquals("/", request.getUri());
+        Assert.assertEquals("/", request.getPath());
     }
 
     @Test

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestHttpMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestHttpMessageParser.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestHttpMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestHttpMessageParser.java Wed Apr  6 07:21:14 2016
@@ -68,7 +68,7 @@ public class TestHttpMessageParser {
         inbuf.fill(newChannel("GET /whatever HTTP/1.1\r\nSome header: stuff\r\n\r\n"));
         final HttpRequest request = requestParser.parse(inbuf, false);
         Assert.assertNotNull(request);
-        Assert.assertEquals("/whatever", request.getUri());
+        Assert.assertEquals("/whatever", request.getPath());
         Assert.assertEquals(1, request.getAllHeaders().length);
     }
 
@@ -87,7 +87,7 @@ public class TestHttpMessageParser {
         request = requestParser.parse(inbuf, false);
 
         Assert.assertNotNull(request);
-        Assert.assertEquals("/whatever", request.getUri());
+        Assert.assertEquals("/whatever", request.getPath());
         Assert.assertEquals(1, request.getAllHeaders().length);
 
     }
@@ -116,7 +116,7 @@ public class TestHttpMessageParser {
         request = requestParser.parse(inbuf, false);
 
         Assert.assertNotNull(request);
-        Assert.assertEquals("/whatever", request.getUri());
+        Assert.assertEquals("/whatever", request.getPath());
         Assert.assertEquals(1, request.getAllHeaders().length);
         Assert.assertEquals("stuff more stuff", request.getFirstHeader("Some header").getValue());
     }
@@ -142,7 +142,7 @@ public class TestHttpMessageParser {
         request = requestParser.parse(inbuf, false);
 
         Assert.assertNotNull(request);
-        Assert.assertEquals("/whatever", request.getUri());
+        Assert.assertEquals("/whatever", request.getPath());
         Assert.assertEquals(1, request.getAllHeaders().length);
         Assert.assertEquals("stuff more stuff", request.getFirstHeader("Some header").getValue());
     }
@@ -171,7 +171,7 @@ public class TestHttpMessageParser {
         request = requestParser.parse(inbuf, false);
 
         Assert.assertNotNull(request);
-        Assert.assertEquals("/whatever", request.getUri());
+        Assert.assertEquals("/whatever", request.getPath());
         Assert.assertEquals(1, request.getAllHeaders().length);
         Assert.assertEquals("stuff  more stuff", request.getFirstHeader("Some header").getValue());
     }
@@ -314,7 +314,7 @@ public class TestHttpMessageParser {
         inbuf.fill(newChannel("\r\n\r\nGET /whatever HTTP/1.1\r\nSome header: stuff\r\n\r\n"));
         final HttpRequest request = requestParser.parse(inbuf, false);
         Assert.assertNotNull(request);
-        Assert.assertEquals("/whatever", request.getUri());
+        Assert.assertEquals("/whatever", request.getPath());
         Assert.assertEquals(1, request.getAllHeaders().length);
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/integration/SimpleRequestHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/integration/SimpleRequestHandler.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/integration/SimpleRequestHandler.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/integration/SimpleRequestHandler.java Wed Apr  6 07:21:14 2016
@@ -58,7 +58,7 @@ final class SimpleRequestHandler impleme
             final HttpResponse response,
             final HttpContext context) throws HttpException, IOException {
 
-        final String s = request.getUri();
+        final String s = request.getPath();
         final int idx = s.indexOf('x');
         if (idx == -1) {
             throw new HttpException("Unexpected request-URI format");

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/integration/TestHttpAsyncHandlers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/integration/TestHttpAsyncHandlers.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/integration/TestHttpAsyncHandlers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/integration/TestHttpAsyncHandlers.java Wed Apr  6 07:21:14 2016
@@ -444,7 +444,7 @@ public class TestHttpAsyncHandlers exten
                     final HttpAsyncExchange httpexchange,
                     final HttpContext context) throws HttpException {
                 final HttpRequest request = httpexchange.getRequest();
-                final String s = request.getUri();
+                final String s = request.getPath();
                 if (!s.equals("AAAAAx10")) {
                     final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_EXPECTATION_FAILED, "Expectation failed");
                     response.setEntity(new NStringEntity("Expectation failed", ContentType.TEXT_PLAIN));
@@ -576,7 +576,7 @@ public class TestHttpAsyncHandlers exten
                         }
                         // Set the entity after delaying...
                         final HttpRequest request = httpexchange.getRequest();
-                        final String s = request.getUri();
+                        final String s = request.getPath();
                         if (!s.equals("AAAAAx10")) {
                             final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_EXPECTATION_FAILED, "Expectation failed");
                             response.setEntity(new NStringEntity("Expectation failed", ContentType.TEXT_PLAIN));
@@ -636,7 +636,7 @@ public class TestHttpAsyncHandlers exten
                     @Override
                     public void run() {
                         final HttpRequest request = httpexchange.getRequest();
-                        final String s = request.getUri();
+                        final String s = request.getPath();
                         if (!s.equals("AAAAAx10")) {
                             final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_EXPECTATION_FAILED, "Expectation failed");
                             response.setEntity(new NStringEntity("Expectation failed", ContentType.TEXT_PLAIN));
@@ -688,7 +688,7 @@ public class TestHttpAsyncHandlers exten
                     @Override
                     public void run() {
                         final HttpRequest request = httpexchange.getRequest();
-                        final String s = request.getUri();
+                        final String s = request.getPath();
                         if (!s.equals("AAAAAx10")) {
                             final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_EXPECTATION_FAILED, "Expectation failed");
                             response.setEntity(new NStringEntity("Expectation failed", ContentType.TEXT_PLAIN));
@@ -742,7 +742,7 @@ public class TestHttpAsyncHandlers exten
                     @Override
                     public void run() {
                         final HttpRequest request = httpexchange.getRequest();
-                        final String s = request.getUri();
+                        final String s = request.getPath();
                         if (!s.equals("AAAAAx10")) {
                             final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_EXPECTATION_FAILED, "Expectation failed");
                             response.setEntity(new NStringEntity("Expectation failed", ContentType.TEXT_PLAIN));

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/integration/TestSyncHttp.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/integration/TestSyncHttp.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/integration/TestSyncHttp.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/integration/TestSyncHttp.java Wed Apr  6 07:21:14 2016
@@ -124,7 +124,7 @@ public class TestSyncHttp {
                     final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
 
-                String s = request.getUri();
+                String s = request.getPath();
                 if (s.startsWith("/?")) {
                     s = s.substring(2);
                 }
@@ -677,7 +677,7 @@ public class TestSyncHttp {
 
                 if (request instanceof HttpRequest) {
                     int n = 1;
-                    String s = request.getUri();
+                    String s = request.getPath();
                     if (s.startsWith("/?n=")) {
                         s = s.substring(4);
                         try {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java Wed Apr  6 07:21:14 2016
@@ -30,7 +30,6 @@ package org.apache.hc.core5.http.message
 import java.net.URI;
 
 import org.apache.hc.core5.http.HttpEntity;
-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.HttpStatus;
@@ -90,19 +89,13 @@ public class TestBasicMessages {
     public void testDefaultRequestConstructors() {
         HttpRequest request = new BasicHttpRequest("WHATEVER", "/");
         Assert.assertEquals("WHATEVER", request.getMethod());
-        Assert.assertEquals("/", request.getUri());
+        Assert.assertEquals("/", request.getPath());
 
         request = new BasicHttpRequest("GET", "/");
         Assert.assertEquals("GET", request.getMethod());
-        Assert.assertEquals("/", request.getUri());
+        Assert.assertEquals("/", request.getPath());
 
         try {
-            new BasicHttpRequest("GET", (String) null);
-            Assert.fail("IllegalArgumentException should have been thrown");
-        } catch (final IllegalArgumentException ex) {
-            // expected
-        }
-        try {
             new BasicHttpRequest("GET", (URI) null);
             Assert.fail("IllegalArgumentException should have been thrown");
         } catch (final IllegalArgumentException ex) {
@@ -114,32 +107,34 @@ public class TestBasicMessages {
     public void testRequestBasics() throws Exception {
         final HttpRequest request = new BasicHttpRequest("GET", "/stuff");
         Assert.assertEquals("GET", request.getMethod());
-        Assert.assertEquals("/stuff", request.getUri());
-        Assert.assertEquals(null, request.getHost());
+        Assert.assertEquals("/stuff", request.getPath());
+        Assert.assertEquals(null, request.getAuthority());
     }
 
     @Test
     public void testRequestWithRelativeURI() throws Exception {
         final HttpRequest request = new BasicHttpRequest("GET", new URI("/stuff"));
         Assert.assertEquals("GET", request.getMethod());
-        Assert.assertEquals("/stuff", request.getUri());
-        Assert.assertEquals(null, request.getHost());
+        Assert.assertEquals("/stuff", request.getPath());
+        Assert.assertEquals(null, request.getAuthority());
     }
 
     @Test
     public void testRequestWithAbsoluteURI() throws Exception {
         final HttpRequest request = new BasicHttpRequest("GET", new URI("https://host:9443/stuff?param=value"));
         Assert.assertEquals("GET", request.getMethod());
-        Assert.assertEquals("/stuff?param=value", request.getUri());
-        Assert.assertEquals(new HttpHost("host", 9443, "https"), request.getHost());
+        Assert.assertEquals("/stuff?param=value", request.getPath());
+        Assert.assertEquals("host:9443", request.getAuthority());
+        Assert.assertEquals("https", request.getScheme());
     }
 
     @Test
     public void testRequestWithNoPath() throws Exception {
         final HttpRequest request = new BasicHttpRequest("GET", new URI("http://host"));
         Assert.assertEquals("GET", request.getMethod());
-        Assert.assertEquals("/", request.getUri());
-        Assert.assertEquals(new HttpHost("host", -1, "http"), request.getHost());
+        Assert.assertEquals("/", request.getPath());
+        Assert.assertEquals("host", request.getAuthority());
+        Assert.assertEquals("http", request.getScheme());
     }
 
     @Test

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestStandardInterceptors.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestStandardInterceptors.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestStandardInterceptors.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestStandardInterceptors.java Wed Apr  6 07:21:14 2016
@@ -385,7 +385,7 @@ public class TestStandardInterceptors {
         final HttpContext context = new BasicHttpContext(null);
         final HttpHost host = new HttpHost("somehost", 8080, "http");
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.setHost(host);
+        request.setAuthority(host.toHostString());
         final RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
         final Header header = request.getFirstHeader(HttpHeaders.HOST);
@@ -425,7 +425,7 @@ public class TestStandardInterceptors {
         final HttpContext context = new BasicHttpContext(null);
         final HttpHost host = new HttpHost("somehost", 8080, "http");
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
-        request.setHost(host);
+        request.setAuthority(host.toHostString());
         request.addHeader(new BasicHeader(HttpHeaders.HOST, "whatever"));
         final RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
@@ -480,7 +480,7 @@ public class TestStandardInterceptors {
         final HttpContext context = new BasicHttpContext(null);
         final HttpHost host = new HttpHost("somehost", 8080, "http");
         final BasicHttpRequest request = new BasicHttpRequest("CONNECT", "/");
-        request.setHost(host);
+        request.setAuthority(host.toHostString());
         final RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
         final Header header = request.getFirstHeader(HttpHeaders.HOST);
@@ -494,7 +494,7 @@ public class TestStandardInterceptors {
         context.setProtocolVersion(HttpVersion.HTTP_1_0);
         final HttpHost host = new HttpHost("somehost", 8080, "http");
         final BasicHttpRequest request = new BasicHttpRequest("CONNECT", "/");
-        request.setHost(host);
+        request.setAuthority(host.toHostString());
         final RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
         final Header header = request.getFirstHeader(HttpHeaders.HOST);
@@ -1069,7 +1069,7 @@ public class TestStandardInterceptors {
         request.setHeader(HttpHeaders.HOST, "host:8888");
         final RequestValidateHost interceptor = new RequestValidateHost();
         interceptor.process(request, context);
-        Assert.assertEquals(new HttpHost("host", 8888), request.getHost());
+        Assert.assertEquals("host:8888", request.getAuthority());
     }
 
     @Test
@@ -1080,7 +1080,7 @@ public class TestStandardInterceptors {
         request.setHeader(HttpHeaders.HOST, "host");
         final RequestValidateHost interceptor = new RequestValidateHost();
         interceptor.process(request, context);
-        Assert.assertEquals(new HttpHost("host", -1), request.getHost());
+        Assert.assertEquals("host", request.getAuthority());
     }
 
     @Test

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/HttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/HttpClient.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/HttpClient.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/HttpClient.java Wed Apr  6 07:21:14 2016
@@ -103,8 +103,9 @@ public class HttpClient {
             final HttpRequest request,
             final HttpHost targetHost,
             final HttpClientConnection conn) throws HttpException, IOException {
-        if (request.getHost() == null) {
-            request.setHost(targetHost);
+        if (request.getAuthority() == null) {
+            request.setAuthority(targetHost.toHostString());
+            request.setScheme(targetHost.getSchemeName());
         }
         this.httpexecutor.preProcess(request, this.httpproc, this.context);
         final HttpResponse response = this.httpexecutor.execute(request, conn, this.context);

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpClientConnection.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpClientConnection.java Wed Apr  6 07:21:14 2016
@@ -131,7 +131,7 @@ public class LoggingBHttpClientConnectio
     @Override
     protected void onRequestSubmitted(final HttpRequest request) {
         if (request != null && this.headerlog.isDebugEnabled()) {
-            this.headerlog.debug(id + " >> " + new RequestLine(request.getMethod(), request.getUri(),
+            this.headerlog.debug(id + " >> " + new RequestLine(request.getMethod(), request.getPath(),
                     request.getVersion() != null ? request.getVersion() : HttpVersion.HTTP_1_1));
             final Header[] headers = request.getAllHeaders();
             for (final Header header : headers) {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpServerConnection.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpServerConnection.java Wed Apr  6 07:21:14 2016
@@ -118,7 +118,7 @@ public class LoggingBHttpServerConnectio
     @Override
     protected void onRequestReceived(final HttpRequest request) {
         if (request != null && this.headerlog.isDebugEnabled()) {
-            this.headerlog.debug(id + " >> " + new RequestLine(request.getMethod(), request.getUri(),
+            this.headerlog.debug(id + " >> " + new RequestLine(request.getMethod(), request.getPath(),
                     request.getVersion() != null ? request.getVersion() : HttpVersion.HTTP_1_1));
             final Header[] headers = request.getAllHeaders();
             for (final Header header : headers) {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpClientConnection.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpClientConnection.java Wed Apr  6 07:21:14 2016
@@ -84,7 +84,7 @@ public class LoggingNHttpClientConnectio
     @Override
     public void submitRequest(final HttpRequest request) throws IOException, HttpException {
         if (this.log.isDebugEnabled()) {
-            this.log.debug(this.id + ": "  + request.getMethod() + " " + request.getUri());
+            this.log.debug(this.id + ": "  + request.getMethod() + " " + request.getPath());
         }
         super.submitRequest(request);
     }
@@ -121,7 +121,7 @@ public class LoggingNHttpClientConnectio
     @Override
     protected void onRequestSubmitted(final HttpRequest request) {
         if (request != null && this.headerlog.isDebugEnabled()) {
-            this.headerlog.debug(id + " >> " + new RequestLine(request.getMethod(), request.getUri(),
+            this.headerlog.debug(id + " >> " + new RequestLine(request.getMethod(), request.getPath(),
                     request.getVersion() != null ? request.getVersion() : HttpVersion.HTTP_1_1));
             final Header[] headers = request.getAllHeaders();
             for (final Header header : headers) {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpServerConnection.java?rev=1737929&r1=1737928&r2=1737929&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpServerConnection.java Wed Apr  6 07:21:14 2016
@@ -108,7 +108,7 @@ public class LoggingNHttpServerConnectio
     @Override
     protected void onRequestReceived(final HttpRequest request) {
         if (request != null && this.headerlog.isDebugEnabled()) {
-            this.headerlog.debug(id + " >> " + new RequestLine(request.getMethod(), request.getUri(),
+            this.headerlog.debug(id + " >> " + new RequestLine(request.getMethod(), request.getPath(),
                     request.getVersion() != null ? request.getVersion() : HttpVersion.HTTP_1_1));
             final Header[] headers = request.getAllHeaders();
             for (final Header header : headers) {



Mime
View raw message