You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Isabel Jimenez <co...@isabeljimenez.com> on 2015/08/03 22:19:35 UTC

Re: Review Request 36402: Adding 'Accept' header in request

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

(Updated Aug. 3, 2015, 8:19 p.m.)


Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.


Repository: mesos-incubating


Description
-------

Adding a method for Accept header in request + refactor of Accept-Encoding


Diffs (updated)
-----

  3rdparty/libprocess/include/process/http.hpp b8d9300 
  3rdparty/libprocess/src/http.cpp 4dcbd74 
  3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 

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


Testing
-------

make check


Thanks,

Isabel Jimenez


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.

> On Aug. 3, 2015, 9:38 p.m., Ben Mahler wrote:
> > Is this ready to review? Mind updating the 'issues' accordingly?

Just did, thanks for comments :)


- Isabel


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


On Aug. 4, 2015, 5:42 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 4, 2015, 5:42 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/#review93970
-----------------------------------------------------------


Is this ready to review? Mind updating the 'issues' accordingly?

- Ben Mahler


On Aug. 3, 2015, 8:19 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 3, 2015, 8:19 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.

> On Aug. 10, 2015, 7:03 p.m., Marco Massenzio wrote:
> > 3rdparty/libprocess/src/http.cpp, lines 219-220
> > <https://reviews.apache.org/r/36402/diff/10/?file=1032819#file1032819line219>
> >
> >     I'm not sure I understand why you do this.
> >     Can you please comment or explain?

Here we introduce two other strings we want to make sure we use to validate what the client is sending in its header. 
If the client sends '*/*' and we want to make sure he accepts 'foo/bar', but we only compare 'foo/bar' with '*/*' we will reject a valid header. 
So we introduce what we are expecting the client to send as a valid header so we can compare both and send back true when the client is sending '*/*' and we compare it first with 'foo/bar' then with 'foo/*' then finally with '*/*'. This means the client accepts anything ('foo/bar' included) so we validate the header.


- Isabel


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


On Aug. 5, 2015, 7:11 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 5, 2015, 7:11 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Marco Massenzio <ma...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/#review94781
-----------------------------------------------------------

Ship it!


Maybe the code around checking for acceptable headers would benefit from using a RegEx instead of "parsing by hand" - but apart from that, LGTM.


3rdparty/libprocess/src/http.cpp (lines 213 - 215)
<https://reviews.apache.org/r/36402/#comment149377>

    you can just use `strings.trim()` here



3rdparty/libprocess/src/http.cpp (lines 219 - 220)
<https://reviews.apache.org/r/36402/#comment149381>

    I'm not sure I understand why you do this.
    Can you please comment or explain?


- Marco Massenzio


On Aug. 5, 2015, 7:11 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 5, 2015, 7:11 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/#review94981
-----------------------------------------------------------

Ship it!


Mostly some minor comments, I'll make the adjustments and land this for you!


3rdparty/libprocess/src/http.cpp (lines 220 - 221)
<https://reviews.apache.org/r/36402/#comment149725>

    Should we do this the same way in both acceptsEncoding and acceptsMediaType? Note that trim only strips from the front and back, so we should be stripping after we've tokenized on ';'. Also, strings::pairs will result in keys that contain whitespace as well with this approach.
    
    I'd suggest we keep the whitespace removal the same as acceptsEncoding for now.



3rdparty/libprocess/src/http.cpp (line 226)
<https://reviews.apache.org/r/36402/#comment149727>

    Might be nice to avoid the implicit relyance on tokens being non-empty here as well.



3rdparty/libprocess/src/tests/http_tests.cpp (lines 661 - 669)
<https://reviews.apache.org/r/36402/#comment149718>

    These should all use ; to delimit the q value rather than ,



3rdparty/libprocess/src/tests/http_tests.cpp (line 672)
<https://reviews.apache.org/r/36402/#comment149716>

    Let's put this in the loop where it's used?



3rdparty/libprocess/src/tests/http_tests.cpp (lines 675 - 677)
<https://reviews.apache.org/r/36402/#comment149717>

    How about:
    
    ```
    EXPECT_FALSE(request.acceptsMediaType("test/*"))
        << "Not expecting '" << accept << "' to match 'test/*'";
    ```



3rdparty/libprocess/src/tests/http_tests.cpp (lines 682 - 693)
<https://reviews.apache.org/r/36402/#comment149720>

    Ditto here, q values are delimited by semi colons, it looks like this test treats q values as possible accept types.



3rdparty/libprocess/src/tests/http_tests.cpp (lines 698 - 700)
<https://reviews.apache.org/r/36402/#comment149723>

    How about:
    
    ```
    EXPECT_TRUE(request.acceptsMediaType("text/html"))
        << "Expecting '" << accept << "' to match 'text/html'";
    ```


- Ben Mahler


On Aug. 10, 2015, 9:52 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 10, 2015, 9:52 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/
-----------------------------------------------------------

(Updated Aug. 10, 2015, 9:52 p.m.)


Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.


Repository: mesos-incubating


Description
-------

Adding a method for Accept header in request + refactor of Accept-Encoding


Diffs (updated)
-----

  3rdparty/libprocess/include/process/http.hpp b8d9300 
  3rdparty/libprocess/src/http.cpp 4dcbd74 
  3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 

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


Testing
-------

make check


Thanks,

Isabel Jimenez


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/#review94321
-----------------------------------------------------------


Patch looks great!

Reviews applied: [37097, 36402]

All tests passed.

- Mesos ReviewBot


On Aug. 5, 2015, 7:11 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 5, 2015, 7:11 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/
-----------------------------------------------------------

(Updated Aug. 5, 2015, 7:11 p.m.)


Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.


Repository: mesos-incubating


Description
-------

Adding a method for Accept header in request + refactor of Accept-Encoding


Diffs (updated)
-----

  3rdparty/libprocess/include/process/http.hpp b8d9300 
  3rdparty/libprocess/src/http.cpp 4dcbd74 
  3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 

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


Testing
-------

make check


Thanks,

Isabel Jimenez


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/#review94203
-----------------------------------------------------------


Patch looks great!

Reviews applied: [37097, 36402]

All tests passed.

- Mesos ReviewBot


On Aug. 5, 2015, 12:32 a.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 5, 2015, 12:32 a.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/
-----------------------------------------------------------

(Updated Aug. 5, 2015, 12:32 a.m.)


Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.


Repository: mesos-incubating


Description
-------

Adding a method for Accept header in request + refactor of Accept-Encoding


Diffs (updated)
-----

  3rdparty/libprocess/include/process/http.hpp b8d9300 
  3rdparty/libprocess/src/http.cpp 4dcbd74 
  3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 

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


Testing
-------

make check


Thanks,

Isabel Jimenez


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/
-----------------------------------------------------------

(Updated Aug. 5, 2015, 12:24 a.m.)


Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.


Repository: mesos-incubating


Description
-------

Adding a method for Accept header in request + refactor of Accept-Encoding


Diffs (updated)
-----

  3rdparty/libprocess/include/process/http.hpp b8d9300 
  3rdparty/libprocess/src/http.cpp 4dcbd74 
  3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 

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


Testing
-------

make check


Thanks,

Isabel Jimenez


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/
-----------------------------------------------------------

(Updated Aug. 4, 2015, 11:05 p.m.)


Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.


Repository: mesos-incubating


Description
-------

Adding a method for Accept header in request + refactor of Accept-Encoding


Diffs
-----

  3rdparty/libprocess/include/process/http.hpp b8d9300 
  3rdparty/libprocess/src/http.cpp 4dcbd74 
  3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 

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


Testing
-------

make check


Thanks,

Isabel Jimenez


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/
-----------------------------------------------------------

(Updated Aug. 4, 2015, 11:05 p.m.)


Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.


Repository: mesos-incubating


Description
-------

Adding a method for Accept header in request + refactor of Accept-Encoding


Diffs (updated)
-----

  3rdparty/libprocess/include/process/http.hpp b8d9300 
  3rdparty/libprocess/src/http.cpp 4dcbd74 
  3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 

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


Testing
-------

make check


Thanks,

Isabel Jimenez


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/#review94112
-----------------------------------------------------------



3rdparty/libprocess/src/http.cpp (line 155)
<https://reviews.apache.org/r/36402/#comment148623>

    This will not crash, tokenize will always return a vector of at least one if one of the parameter strings is not empty and in this case the second one is always ";".
    (https://github.com/apache/mesos/blob/master/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp#L208)


- Isabel Jimenez


On Aug. 4, 2015, 5:42 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 4, 2015, 5:42 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.

> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > Looking better! Can you please pull out the fixes to 'acceptsEncoding' into a separate review? Also, would like to see tests for the cases that weren't handled correctly (e.g. "gzipp;q=1.0" should not match "gzip"). Pulling the changes apart helps avoid extra round-trips on reviews (see here: http://mesos.apache.org/documentation/latest/effective-code-reviewing/) :)

Just added the dependency patch in the description of this RR.


> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/src/http.cpp, lines 158-160
> > <https://reviews.apache.org/r/36402/diff/6/?file=1028798#file1028798line158>
> >
> >     We don't need to use pairs anymore, right? Looks like we should just call tokenize again on 'tokens[1]' (if present).

I don't think there's a real difference. Is this change really necessary?


> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/src/http.cpp, lines 220-222
> > <https://reviews.apache.org/r/36402/diff/6/?file=1028798#file1028798line220>
> >
> >     Ditto here, can we tokenize 'tokens[1]' instead of using strings::pairs?

See comment above.


> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/src/http.cpp, line 236
> > <https://reviews.apache.org/r/36402/diff/6/?file=1028798#file1028798line236>
> >
> >     newline here?

Added.


> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/src/tests/http_tests.cpp, line 693
> > <https://reviews.apache.org/r/36402/diff/6/?file=1028799#file1028799line693>
> >
> >     Mind moving this above with the other http tests?

Moved.


> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/src/tests/http_tests.cpp, lines 696-703
> > <https://reviews.apache.org/r/36402/diff/6/?file=1028799#file1028799line696>
> >
> >     We don't generally wrap things this far, can you just do the following?
> >     
> >     ```
> >      vector<string> wrongHeaders = {
> >          "test,q=0.0",
> >          ...
> >      };
> >     ```
> >     
> >     Ditto below.

Changed style.


> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/src/tests/http_tests.cpp, lines 709-710
> > <https://reviews.apache.org/r/36402/diff/6/?file=1028799#file1028799line709>
> >
> >     Ditto here, can you just print 'accept'?

Printing the exact case where it failed may help later to debug in case of failure.


> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/src/tests/http_tests.cpp, line 706
> > <https://reviews.apache.org/r/36402/diff/6/?file=1028799#file1028799line706>
> >
> >     'auto' here isn't buying us much over just 'const string&', we try to use 'auto' where it helps readability
> >     
> >     Also please use foreach for now

I don't see why it will not help with readability.


- Isabel


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


On Aug. 4, 2015, 11:05 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 4, 2015, 11:05 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.

> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/src/http.cpp, line 219
> > <https://reviews.apache.org/r/36402/diff/6/?file=1028798#file1028798line219>
> >
> >     This will crash the program if tokens is empty!
> 
> Isabel Jimenez wrote:
>     This will not crash, tokenize will always return a vector of at least one if one of the parameter strings is not empty and in this case the second one is always ";".
>     (https://github.com/apache/mesos/blob/master/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp#L208)
> 
> Ben Mahler wrote:
>     That is a test of strings::split, here is a tokenize test which returns an empty vector:
>     
>     https://github.com/apache/mesos/blob/master/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp#L163
> 
> Isabel Jimenez wrote:
>     Right, my bad, I'll check that accept.get() does not return an empty string then.

Actually, I'm sorry I got confused by my mistake on the example test. It still won't crash since it will never enter the foreach with an empty content.


- Isabel


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


On Aug. 4, 2015, 5:42 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 4, 2015, 5:42 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.

> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/src/http.cpp, line 156
> > <https://reviews.apache.org/r/36402/diff/6/?file=1028798#file1028798line156>
> >
> >     This will crash the program if tokens is empty!

Please see comment below.


- Isabel


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


On Aug. 4, 2015, 5:42 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 4, 2015, 5:42 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Ben Mahler <be...@gmail.com>.

> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/src/http.cpp, line 219
> > <https://reviews.apache.org/r/36402/diff/6/?file=1028798#file1028798line219>
> >
> >     This will crash the program if tokens is empty!
> 
> Isabel Jimenez wrote:
>     This will not crash, tokenize will always return a vector of at least one if one of the parameter strings is not empty and in this case the second one is always ";".
>     (https://github.com/apache/mesos/blob/master/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp#L208)

That is a test of strings::split, here is a tokenize test which returns an empty vector:

https://github.com/apache/mesos/blob/master/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp#L163


- Ben


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


On Aug. 4, 2015, 5:42 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 4, 2015, 5:42 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.

> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/src/http.cpp, line 219
> > <https://reviews.apache.org/r/36402/diff/6/?file=1028798#file1028798line219>
> >
> >     This will crash the program if tokens is empty!
> 
> Isabel Jimenez wrote:
>     This will not crash, tokenize will always return a vector of at least one if one of the parameter strings is not empty and in this case the second one is always ";".
>     (https://github.com/apache/mesos/blob/master/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp#L208)
> 
> Ben Mahler wrote:
>     That is a test of strings::split, here is a tokenize test which returns an empty vector:
>     
>     https://github.com/apache/mesos/blob/master/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp#L163

Right, my bad, I'll check that accept.get() does not return an empty string then.


- Isabel


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


On Aug. 4, 2015, 5:42 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 4, 2015, 5:42 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.

> On Aug. 4, 2015, 7:25 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/src/http.cpp, line 219
> > <https://reviews.apache.org/r/36402/diff/6/?file=1028798#file1028798line219>
> >
> >     This will crash the program if tokens is empty!

This will not crash, tokenize will always return a vector of at least one if one of the parameter strings is not empty and in this case the second one is always ";".
(https://github.com/apache/mesos/blob/master/3rdparty/libprocess/3rdparty/stout/tests/strings_tests.cpp#L208)


- Isabel


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


On Aug. 4, 2015, 5:42 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 4, 2015, 5:42 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/#review94105
-----------------------------------------------------------


Looking better! Can you please pull out the fixes to 'acceptsEncoding' into a separate review? Also, would like to see tests for the cases that weren't handled correctly (e.g. "gzipp;q=1.0" should not match "gzip"). Pulling the changes apart helps avoid extra round-trips on reviews (see here: http://mesos.apache.org/documentation/latest/effective-code-reviewing/) :)


3rdparty/libprocess/include/process/http.hpp (lines 119 - 126)
<https://reviews.apache.org/r/36402/#comment148611>

    Let's keep the RFC reference for the implementation, mind moving it back?
    
    Also, please remove my TODO for now, we can see how Request evolves over time.



3rdparty/libprocess/src/http.cpp (line 146)
<https://reviews.apache.org/r/36402/#comment148609>

    Why the change here? Should still say 'encoding' right?



3rdparty/libprocess/src/http.cpp (line 155)
<https://reviews.apache.org/r/36402/#comment148607>

    This will crash the program if tokens is empty!



3rdparty/libprocess/src/http.cpp (line 156)
<https://reviews.apache.org/r/36402/#comment148620>

    The style checker doesn't like this



3rdparty/libprocess/src/http.cpp (lines 157 - 159)
<https://reviews.apache.org/r/36402/#comment148610>

    We don't need to use pairs anymore, right? Looks like we should just call tokenize again on 'tokens[1]' (if present).



3rdparty/libprocess/src/http.cpp (line 218)
<https://reviews.apache.org/r/36402/#comment148608>

    This will crash the program if tokens is empty!



3rdparty/libprocess/src/http.cpp (lines 219 - 221)
<https://reviews.apache.org/r/36402/#comment148612>

    Ditto here, can we tokenize 'tokens[1]' instead of using strings::pairs?



3rdparty/libprocess/src/http.cpp (line 235)
<https://reviews.apache.org/r/36402/#comment148619>

    newline here?



3rdparty/libprocess/src/tests/http_tests.cpp (line 693)
<https://reviews.apache.org/r/36402/#comment148613>

    Mind moving this above with the other http tests?



3rdparty/libprocess/src/tests/http_tests.cpp (lines 696 - 703)
<https://reviews.apache.org/r/36402/#comment148614>

    We don't generally wrap things this far, can you just do the following?
    
    ```
     vector<string> wrongHeaders = {
         "test,q=0.0",
         ...
     };
    ```
    
    Ditto below.



3rdparty/libprocess/src/tests/http_tests.cpp (line 706)
<https://reviews.apache.org/r/36402/#comment148615>

    'auto' here isn't buying us much over just 'const string&', we try to use 'auto' where it helps readability
    
    Also please use foreach for now



3rdparty/libprocess/src/tests/http_tests.cpp (lines 709 - 710)
<https://reviews.apache.org/r/36402/#comment148618>

    Ditto here, can you just print 'accept'?



3rdparty/libprocess/src/tests/http_tests.cpp (line 727)
<https://reviews.apache.org/r/36402/#comment148616>

    Ditto here, 'auto' doesn't seem very helpful to readability here.
    
    Also, please use foreach for now.



3rdparty/libprocess/src/tests/http_tests.cpp (lines 729 - 731)
<https://reviews.apache.org/r/36402/#comment148617>

    Can you just print out 'accept' rather than grabbing the header and calling .get()?


- Ben Mahler


On Aug. 4, 2015, 5:42 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 4, 2015, 5:42 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Isabel Jimenez <co...@isabeljimenez.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/
-----------------------------------------------------------

(Updated Aug. 4, 2015, 5:42 p.m.)


Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.


Repository: mesos-incubating


Description
-------

Adding a method for Accept header in request + refactor of Accept-Encoding


Diffs (updated)
-----

  3rdparty/libprocess/include/process/http.hpp b8d9300 
  3rdparty/libprocess/src/http.cpp 4dcbd74 
  3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 

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


Testing
-------

make check


Thanks,

Isabel Jimenez


Re: Review Request 36402: Adding 'Accept' header in request

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36402/#review94019
-----------------------------------------------------------


Patch looks great!

Reviews applied: [36402]

All tests passed.

- Mesos ReviewBot


On Aug. 3, 2015, 8:19 p.m., Isabel Jimenez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36402/
> -----------------------------------------------------------
> 
> (Updated Aug. 3, 2015, 8:19 p.m.)
> 
> 
> Review request for mesos, Anand Mazumdar, Ben Mahler, Marco Massenzio, and Vinod Kone.
> 
> 
> Repository: mesos-incubating
> 
> 
> Description
> -------
> 
> Adding a method for Accept header in request + refactor of Accept-Encoding
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp b8d9300 
>   3rdparty/libprocess/src/http.cpp 4dcbd74 
>   3rdparty/libprocess/src/tests/http_tests.cpp ecbcbd5 
> 
> Diff: https://reviews.apache.org/r/36402/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Isabel Jimenez
> 
>