hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pbkwee <...@git.apache.org>
Subject [GitHub] httpcore pull request: The HttpHost InetAddress constructor will u...
Date Wed, 06 Aug 2014 05:09:55 GMT
GitHub user pbkwee opened a pull request:

    https://github.com/apache/httpcore/pull/1

    The HttpHost InetAddress constructor will use the InetAddress#getHostNam...

    ...e (rather than InetAddress#getHostAddress) when provided with an InetAddress.
    
    System.out.println(new HttpHost(InetAddress.getByAddress("127.0.0.1", new byte[] {127,0,0,1}),
80, "http"));
    System.out.println(new HttpHost(InetAddress.getByAddress(new byte[] {127,0,0,1}), 80,
"http"));
    System.out.println(new HttpHost(InetAddress.getByAddress("somehost", new byte[] {127,0,0,1}),
80, "http"));
    
    Produces:
    http://127.0.0.1:80
    http://localhost:80
    http://somehost:80
    
    This ensures that HttpHost#getHostName reflects the name wish to use (rather than the
IP address).  Which can be important, for example with Cookie domains and HTTP Host: headers.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pbkwee/httpcore 4.3.x

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/httpcore/pull/1.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1
    
----
commit 696baadb8b03428f9e12f24225ecd0ae45118788
Author: peter@rimuhosting.com <peter@rimuhosting.com>
Date:   2014-08-06T04:55:59Z

    The HttpHost InetAddress constructor will use the InetAddress#getHostName (rather than
InetAddress#getHostAddress) when provided with an InetAddress.
    
    System.out.println(new HttpHost(InetAddress.getByAddress("127.0.0.1", new byte[] {127,0,0,1}),
80, "http"));
    System.out.println(new HttpHost(InetAddress.getByAddress(new byte[] {127,0,0,1}), 80,
"http"));
    System.out.println(new HttpHost(InetAddress.getByAddress("somehost", new byte[] {127,0,0,1}),
80, "http"));
    
    Produces:
    http://127.0.0.1:80
    http://localhost:80
    http://somehost:80
    
    This ensures that HttpHost#getHostName reflects the name wish to use (rather than the
IP address).  Which can be important, for example with Cookie domains and HTTP Host: headers.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message