> On Oct. 1, 2015, 7:40 p.m., Marco Massenzio wrote: > > 3rdparty/libprocess/src/http.cpp, lines 75-160 > > <https://reviews.apache.org/r/38416/diff/3/?file=1084845#file1084845line75> > > > > +1 for the map > > > > I am also wondering if it can be templatized or something? maybe > > augmenting the `StatusCode` class? > > > > (I've always felt that we should split the `code` -eg, 200; an `int`- > > and the `reason` -`"OK"`; a `string`) - it makes comparing "classes" of > > responses much easier. > > > > For example, in Python's `requests` this is what one can typically do: > > ``` > > r = req.get('http://google.com') > > if 200 <= r.status_code < 300: > > # all is well > > elif r.status_code >= 400: > > # yuk! we hit the skids > > ``` > > Timothy Chen wrote: > It's going to be an int as Ben suggested. About the status string, we > currently just use the status string directly to assign to HTTP responses, so > we could modify that we always return a code + status string. But I think > until we see a use case where we really just want the status text portion > I'll leave it as is.
Ok - whatever we return, let's make sure we are consistent with the RFC (2616) so that we don't confuse client libraries: https://www.ietf.org/rfc/rfc2616.txt (see section 6.1): ``` Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF ``` (and I'm sorry, I'm missing context here, so this may not be applicable). - Marco ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/38416/#review101271 ----------------------------------------------------------- On Sept. 25, 2015, 10:38 p.m., Timothy Chen wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/38416/ > ----------------------------------------------------------- > > (Updated Sept. 25, 2015, 10:38 p.m.) > > > Review request for mesos, Anand Mazumdar, Ben Mahler, Jie Yu, Jojy Varghese, > and Jiang Yan Xu. > > > Bugs: MESOS-3429 > https://issues.apache.org/jira/browse/MESOS-3429 > > > Repository: mesos > > > Description > ------- > > Allow HTTP response codes to be checked with code. > > > Diffs > ----- > > 3rdparty/libprocess/include/process/http.hpp > fbd6cf7967173495875a8ea90ed28ade88b982a2 > 3rdparty/libprocess/src/decoder.hpp > 67a5135f302153e376e8dfe8db82aa0b15449389 > 3rdparty/libprocess/src/http.cpp 9ad613a16c379b6d76a9a0f8d6160fe23a182fd4 > 3rdparty/libprocess/src/process.cpp > 4afa30569b4d235637b49a624602e6b199c32e0e > 3rdparty/libprocess/src/tests/benchmarks.cpp > 97c81b8e61a75771e5bf7d46505cec4e0c0f404a > 3rdparty/libprocess/src/tests/http_tests.cpp > d0b9399d38fa284466a012a21080b1d9007af98b > 3rdparty/libprocess/src/tests/process_tests.cpp > 1023500ac2e3c55be955c4686e7f720eba6b4cc9 > > Diff: https://reviews.apache.org/r/38416/diff/ > > > Testing > ------- > > make > > > Thanks, > > Timothy Chen > >
