Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

outside_tests hit servers with behavior that depends on country of origin #27

Closed
Alexander-Shukaev opened this issue Dec 1, 2015 · 8 comments
Labels

Comments

@Alexander-Shukaev
Copy link

Built from the latest revision (78f8554) in the master branch:

Starting test case outside_tests:outside_cnn_dot_com...
../tests/functional/http/client/outside_tests.cpp:56: error: Failure in outside_cnn_dot_com: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
../tests/functional/http/client/outside_tests.cpp:61: error: Failure in outside_cnn_dot_com: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
Test case outside_tests:outside_cnn_dot_com FAILED
Starting test case outside_tests:outside_google_dot_com...
../tests/functional/http/client/outside_tests.cpp:73: error: Failure in outside_google_dot_com: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
../tests/functional/http/client/outside_tests.cpp:73: error: Failure in outside_google_dot_com: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
Test case outside_tests:outside_google_dot_com FAILED
Starting test case outside_tests:multiple_https_requests...
../tests/functional/http/client/outside_tests.cpp:87: error: Failure in multiple_https_requests: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
../tests/functional/http/client/outside_tests.cpp:87: error: Failure in multiple_https_requests: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
../tests/functional/http/client/outside_tests.cpp:87: error: Failure in multiple_https_requests: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
../tests/functional/http/client/outside_tests.cpp:87: error: Failure in multiple_https_requests: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
../tests/functional/http/client/outside_tests.cpp:87: error: Failure in multiple_https_requests: CHECK_EQUAL(status_codes::OK, response.status_code()) where status_codes::OK=200 and response.status_code()=302
 FAILED
Test case outside_tests:multiple_https_requests FAILED
Starting test case outside_tests:reading_google_stream...
../tests/functional/http/client/outside_tests.cpp:107: error: Failure in reading_google_stream: CHECK_EQUAL(strcmp((const char *) chars, "<!doctype html><html itemscope=\"\" itemtype=\"http://schema.org/WebPage\""), 0) where strcmp((const char *) chars, "<!doctype html><html itemscope=\"\" itemtype=\"http://schema.org/WebPage\"")=1 and 0=0
 FAILED
Test case outside_tests:reading_google_stream FAILED

Any ideas?

Kind regards,
Alexander

@Alexander-Shukaev
Copy link
Author

I found the following patch in Ubuntu's casablanca package [1]:

Description: Debian forbids calls to http websites.
 Tests trying to do web calls are disabled
 Currently there are only 4 tests that has been disabled:
 outside_cnn_dot_com, outside_google_dot_comm,
 reading_google_stream and outside_ssl_json.

Author: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
Origin: debian
Forwarded: not-needed
Reviewed-By: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
Last-Update: 2014-09-27

--- casablanca-2.2.0.orig/Release/tests/Functional/http/client/CMakeLists.txt
+++ casablanca-2.2.0/Release/tests/Functional/http/client/CMakeLists.txt
@@ -14,7 +14,6 @@ set(SOURCES
   multiple_requests.cpp
   oauth1_tests.cpp
   oauth2_tests.cpp
-  outside_tests.cpp
   pipeline_stage_tests.cpp
   progress_handler_tests.cpp
   proxy_tests.cpp

Could it be the same problem on Arch Linux?

@ras0219-msft
Copy link
Contributor

Hmm, this might be the issue. It looks like https://en.wikipedia.org/wiki/HTTP_302 is Redirect, so are the tests possibly being run under some sort of proxy?

What is your testing environment? Archlinux 64-bit on a desktop computer with internet?

@Alexander-Shukaev
Copy link
Author

Yes, Arch Linux 64-bit desktop with Internet connection. No, there is no proxy involved. At least, I'm not aware of the one as this is my personal box and I didn't install any proxy here.

@ras0219-msft
Copy link
Contributor

Odd. At the very least, I don't think the core library functionality should be diminished.

After running the tests again and ensuring they fail on your current internet connection, could you paste the results of
$ curl -I http://www.cnn.com/
here?

@Alexander-Shukaev
Copy link
Author

There you go:

$ curl -I http://www.cnn.com/
HTTP/1.1 302 Found
Server: Varnish
Retry-After: 0
Content-Length: 0
Location: http://edition.cnn.com/
Accept-Ranges: bytes
Date: Wed, 02 Dec 2015 19:15:29 GMT
Via: 1.1 varnish
Connection: close
X-Served-By: cache-fra1242-FRA
X-Cache: HIT
X-Cache-Hits: 0

@ras0219-msft
Copy link
Contributor

Aha, this looks like a US-centrism on our part. Apparently cnn.com redirects users from other countries to the "http://edition.cnn.com/" drop location, which is causing the problem.

This means that 1) you can consider these tests passing ☺ and 2) these tests should probably be changed to hit the international home pages (which at least in the cnn case does not redirect even in the US).

Thanks for reporting this issue; if you'd like to prepare a PR changing the tests please do.

@AnyCPU
Copy link
Contributor

AnyCPU commented Dec 22, 2015

On FreeBSD this fails too.

@ras0219-msft ras0219-msft changed the title Four HTTP client tests fail on Arch Linux outside_tests hit servers with behavior that depends on country of origin Jan 19, 2016
@iamazeem
Copy link

I have the same issue on Mac OS X. Here's the list of failed tests:-

**** outside_tests:outside_cnn_dot_com FAILED ****
**** outside_tests:outside_google_dot_com FAILED ****
**** outside_tests:multiple_https_requests FAILED ****
**** outside_tests:reading_google_stream FAILED ****
**** outside_tests:server_hostname_mismatch FAILED ****
**** authentication_tests:sni_with_older_server_test FAILED ****
**** authentication_tests:sni_explicit_hostname FAILED ****
**** authentication_tests:hostname_mismatch FAILED ****

Using curl shows the redirections. That means the tests have not been updated so far.
Here are the curl results:-

CNN:

$ curl -I http://www.cnn.com/
HTTP/1.1 302 Found
Server: Varnish
Retry-After: 0
Content-Length: 0
Location: http://edition.cnn.com/
Accept-Ranges: bytes
Date: Tue, 20 Sep 2016 04:51:02 GMT
Via: 1.1 varnish
Connection: close
Set-Cookie: countryCode=PK; Domain=.cnn.com
X-Served-By: cache-lhr6343-LHR
X-Cache: HIT
X-Cache-Hits: 0

Google:

$ curl -I http://www.google.com/
HTTP/1.1 302 Found
Location: http://www.google.com.pk/?gws_rd=cr&ei=o8DgV4T-LIPTU9f4rXA
Cache-Control: private
Content-Type: text/html; charset=UTF-8
P3P: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."
Date: Tue, 20 Sep 2016 04:52:51 GMT
Server: gws
Content-Length: 259
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Set-Cookie: NID=86=jaM6fxcpSqTxvKBVYiSVli7BeIq9B6NCTA2pL0g6cIfekZdg3DIMzB_A_xNzQW6WsE9-Iq-tvNkmT9OUNwzge1KzeeDlNBD51NsgmFeJXImHHvDIwxx0eTlMdke1_iKo; expires=Wed, 22-Mar-2017 04:52:51 GMT; path=/; domain=.google.com; HttpOnly

But, what about the other failures? Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants