Skip to content

unit test faild,because of "http://www.boost.org" return "301 Moved Permanently" #836

Closed

Description

@limenghua

OS: CentOS7.4 x64
gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
boost 1.66
cpp-netlib:0.12.0-final

tests]$ ./cpp-netlib-http-client_get_streaming_test
cpp-netlib-0.12.0-final/libs/network/test/http/client_get_streaming_test.cpp:41: Failure
Expected: 200u
Which is: 200
To be equal to: response.status()
Which is: 301
/home/limenghua/Downloads/cpp-netlib-0.12.0-final/libs/network/test/http/client_get_streaming_test.cpp:42: Failure
Expected: "OK"
To be equal to: response.status_message()
Which is: "Moved Permanently"

Activity

  1. umennel commented on May 3, 2018

    @umennel

    Hi @limenghua, in the 0.13 release, we used to connect to boost.org in some of the tests because the site would support chunked transfer encoding. But now they don't allow unencrypted connections any more. We need to find another source for testing chunked transfer encoding. But since you are using the 0.12 release, chunked transfer encoding is not available anyway, so I guess any site allowing unencrypted connections will do.

  2. deanberris commented on May 8, 2018

    @deanberris
    Member

    Yeah, this one's tricky -- we definitely should update the test to either:

    1. Use HTTPS and chunked transfer encoding.

    2. Set up our own server to make HTTP requests to.

    While I'm not a great fan of solution 2, that might be the easiest thing to do in this case.

  3. yhager commented on May 14, 2018

    @yhager

    The test passes for me on 0.13-release branch if I change http to https:

    --- a/libs/network/test/http/client_get_streaming_test.cpp
    +++ b/libs/network/test/http/client_get_streaming_test.cpp
    @@ -26,7 +26,7 @@ struct body_handler {
     TYPED_TEST_CASE(HTTPClientTest, ClientTypes);
     
     TYPED_TEST(HTTPClientTest, GetStreamingTest) {
    -  typename TypeParam::request request("http://www.boost.org");
    +  typename TypeParam::request request("https://www.boost.org");
       typename TypeParam::response response;
       typename TypeParam::string_type body_string;
       typename TypeParam::string_type dummy_body;
  4. deanberris commented on May 15, 2018

    @deanberris
    Member

    Cool -- can you send a pull request with that change @yhager?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions