You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Jojy Varghese <jo...@mesosphere.io> on 2015/08/13 02:46:22 UTC

Review Request 37426: MESOS-3251 : Fixing "host" field of request header.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/37426/
-----------------------------------------------------------

Review request for mesos, Anand Mazumdar and Timothy Chen.


Bugs: MESOS-3251
    https://issues.apache.org/jira/browse/MESOS-3251


Repository: mesos


Description
-------

Currently libprocess http API sets the "Host" header field from the peer socket
address (IP:port). The problem is that socket address might not be right HTTP
server and might be just a proxy.
  Changed the logic to look for http server URL's domain first to populate the
"Host" field.


Diffs
-----

  3rdparty/libprocess/src/http.cpp 4dcbd74b894b483c4d166c23fac55ac8dba75166 

Diff: https://reviews.apache.org/r/37426/diff/


Testing
-------

make check.


Thanks,

Jojy Varghese


Re: Review Request 37426: MESOS-3251 : Fixing "host" field of request header.

Posted by Timothy Chen <tn...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/37426/#review95632
-----------------------------------------------------------



3rdparty/libprocess/src/http.cpp (line 798)
<https://reviews.apache.org/r/37426/#comment150741>

    Let's add the port to make sure we're adhering to the HTTP 1.1 standard


- Timothy Chen


On Aug. 13, 2015, 12:46 a.m., Jojy Varghese wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/37426/
> -----------------------------------------------------------
> 
> (Updated Aug. 13, 2015, 12:46 a.m.)
> 
> 
> Review request for mesos, Anand Mazumdar and Timothy Chen.
> 
> 
> Bugs: MESOS-3251
>     https://issues.apache.org/jira/browse/MESOS-3251
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Currently libprocess http API sets the "Host" header field from the peer socket
> address (IP:port). The problem is that socket address might not be right HTTP
> server and might be just a proxy.
>   Changed the logic to look for http server URL's domain first to populate the
> "Host" field.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/http.cpp 4dcbd74b894b483c4d166c23fac55ac8dba75166 
> 
> Diff: https://reviews.apache.org/r/37426/diff/
> 
> 
> Testing
> -------
> 
> make check.
> 
> 
> Thanks,
> 
> Jojy Varghese
> 
>


Re: Review Request 37426: MESOS-3251 : Fixing "host" field of request header.

Posted by Timothy Chen <tn...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/37426/#review95652
-----------------------------------------------------------

Ship it!


Ship It!

- Timothy Chen


On Aug. 17, 2015, 9:56 p.m., Jojy Varghese wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/37426/
> -----------------------------------------------------------
> 
> (Updated Aug. 17, 2015, 9:56 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar and Timothy Chen.
> 
> 
> Bugs: MESOS-3251
>     https://issues.apache.org/jira/browse/MESOS-3251
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Currently libprocess http API sets the "Host" header field from the peer socket
> address (IP:port). The problem is that socket address might not be right HTTP
> server and might be just a proxy.
>   Changed the logic to look for http server URL's domain first to populate the
> "Host" field.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/http.cpp 660950fc9b66e8bca24d0888dda1f20b44d8ff49 
> 
> Diff: https://reviews.apache.org/r/37426/diff/
> 
> 
> Testing
> -------
> 
> make check.
> 
> 
> Thanks,
> 
> Jojy Varghese
> 
>


Re: Review Request 37426: MESOS-3251 : Fixing "host" field of request header.

Posted by Jojy Varghese <jo...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/37426/
-----------------------------------------------------------

(Updated Aug. 17, 2015, 9:56 p.m.)


Review request for mesos, Anand Mazumdar and Timothy Chen.


Changes
-------

Added checks for standard ports.


Bugs: MESOS-3251
    https://issues.apache.org/jira/browse/MESOS-3251


Repository: mesos


Description
-------

Currently libprocess http API sets the "Host" header field from the peer socket
address (IP:port). The problem is that socket address might not be right HTTP
server and might be just a proxy.
  Changed the logic to look for http server URL's domain first to populate the
"Host" field.


Diffs (updated)
-----

  3rdparty/libprocess/src/http.cpp 660950fc9b66e8bca24d0888dda1f20b44d8ff49 

Diff: https://reviews.apache.org/r/37426/diff/


Testing
-------

make check.


Thanks,

Jojy Varghese


Re: Review Request 37426: MESOS-3251 : Fixing "host" field of request header.

Posted by Jojy Varghese <jo...@mesosphere.io>.

> On Aug. 13, 2015, 4:56 p.m., Anand Mazumdar wrote:
> > I wonder if we should add a test for this so that we can assert that the fix works ?
> > 
> > One easy way I can think about it, looking at the tests in process_tests.cpp ( you should be able to use the already existing HttpEndpointProcess there ),  set up a route for a mock handler. Send in a http::Request to this mock route endpoint with URL(http://TEST_URL) , the handler on the server side should check the host header to be TEST_URL in the http::Request ?

We have many HTTP(S)  tests already in place. Those tests validate this change.  Any test that uses URL for a GET request validates this change. There are a few simple HTTPs tests for get and also the new docker provisioner tests validate it.


- Jojy


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/37426/#review95281
-----------------------------------------------------------


On Aug. 13, 2015, 12:46 a.m., Jojy Varghese wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/37426/
> -----------------------------------------------------------
> 
> (Updated Aug. 13, 2015, 12:46 a.m.)
> 
> 
> Review request for mesos, Anand Mazumdar and Timothy Chen.
> 
> 
> Bugs: MESOS-3251
>     https://issues.apache.org/jira/browse/MESOS-3251
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Currently libprocess http API sets the "Host" header field from the peer socket
> address (IP:port). The problem is that socket address might not be right HTTP
> server and might be just a proxy.
>   Changed the logic to look for http server URL's domain first to populate the
> "Host" field.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/http.cpp 4dcbd74b894b483c4d166c23fac55ac8dba75166 
> 
> Diff: https://reviews.apache.org/r/37426/diff/
> 
> 
> Testing
> -------
> 
> make check.
> 
> 
> Thanks,
> 
> Jojy Varghese
> 
>


Re: Review Request 37426: MESOS-3251 : Fixing "host" field of request header.

Posted by Anand Mazumdar <ma...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/37426/#review95281
-----------------------------------------------------------


I wonder if we should add a test for this so that we can assert that the fix works ?

One easy way I can think about it, looking at the tests in process_tests.cpp ( you should be able to use the already existing HttpEndpointProcess there ),  set up a route for a mock handler. Send in a http::Request to this mock route endpoint with URL(http://TEST_URL) , the handler on the server side should check the host header to be TEST_URL in the http::Request ?

- Anand Mazumdar


On Aug. 13, 2015, 12:46 a.m., Jojy Varghese wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/37426/
> -----------------------------------------------------------
> 
> (Updated Aug. 13, 2015, 12:46 a.m.)
> 
> 
> Review request for mesos, Anand Mazumdar and Timothy Chen.
> 
> 
> Bugs: MESOS-3251
>     https://issues.apache.org/jira/browse/MESOS-3251
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Currently libprocess http API sets the "Host" header field from the peer socket
> address (IP:port). The problem is that socket address might not be right HTTP
> server and might be just a proxy.
>   Changed the logic to look for http server URL's domain first to populate the
> "Host" field.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/http.cpp 4dcbd74b894b483c4d166c23fac55ac8dba75166 
> 
> Diff: https://reviews.apache.org/r/37426/diff/
> 
> 
> Testing
> -------
> 
> make check.
> 
> 
> Thanks,
> 
> Jojy Varghese
> 
>