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


Fix it, then Ship it!




Let's add a unit test in `3rdparty/libprocess/src/tests/decoder_tests.cpp`.


3rdparty/libprocess/src/http.cpp (lines 767 - 770)
<https://reviews.apache.org/r/55496/#comment233149>

    In fact, I would always feed an EOF to the decoder, even if `responses` is 
non empty:
    
    ```
    vector<Response> result;
    
    auto appendResult = [=](const dequeue<http::Response*>& responses) mutable {
      foreach (Response* response, responses) {
        result.push_back(*response);
        delete response;
      }
    };
    
    appendResult(decoder.decode(s.data(), s.length()));
    appendResult(decoder.decode("", 0));
    
    if (decoder.failed()) {
      return Error("Decoding failed");
    }
    
    if (responses.empty()) {
      return Error("No response decoded");
    }
    
    return result;
    ```


- Jie Yu


On Jan. 17, 2017, 2:35 p.m., Jan Schlicht wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/55496/
> -----------------------------------------------------------
> 
> (Updated Jan. 17, 2017, 2:35 p.m.)
> 
> 
> Review request for mesos, Benjamin Bannier, Gilbert Song, and Jie Yu.
> 
> 
> Bugs: MESOS-6010
>     https://issues.apache.org/jira/browse/MESOS-6010
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Some HTTP responses might not set the 'Content-Length' header. This
> usually means that the message body should be read until EOF. This
> will be done by an additional call of 'decoder.decode' with an empty
> string.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/http.cpp 8895f0cfadf1cca9714fc7110ed0914e3db18983 
> 
> Diff: https://reviews.apache.org/r/55496/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jan Schlicht
> 
>

Reply via email to