Lines Matching +full:get +full:- +full:uri
26 assert response["content-location"] == tests.DUMMY_URL
49 http.request("http://no-such-hostname./")
53 response, content = http.request("http://no-such-hostname./")
54 assert response["content-type"] == "text/plain"
60 os.environ.get("TRAVIS_PYTHON_VERSION") in ("2.7", "pypy"),
62 "See https://travis-ci.org/httplib2/httplib2/jobs/408769880.",
74 os.environ.get("TRAVIS_PYTHON_VERSION") in ("2.7", "pypy"),
76 "See https://travis-ci.org/httplib2/httplib2/jobs/408769880.",
85 assert response["content-type"] == "text/plain"
97 with tests.server_reflect() as uri:
98 response, content = http.request(uri + query, "GET")
101 assert reflected.uri == "/?a=%D0%82"
105 # Test that GET is the default method
107 with tests.server_reflect() as uri:
108 response, content = http.request(uri)
111 assert reflected.method == "GET"
117 methods = ["GET", "PUT", "DELETE", "POST", "unknown"]
118 with tests.server_reflect(request_count=len(methods)) as uri:
120 response, content = http.request(uri, method, body=b" ")
130 respond_with = b"HTTP/1.0 200 OK\r\ncontent-length: " b"14\r\n\r\nnon-empty-body"
131 with tests.server_const_bytes(respond_with) as uri:
132 response, content = http.request(uri, "HEAD")
138 # Test that can do a GET w/o the cache turned on.
140 with tests.server_const_http() as uri:
141 response, content = http.request(uri, "GET")
147 # Test that we provide a default user-agent
149 with tests.server_reflect() as uri:
150 response, content = http.request(uri, "GET")
153 assert reflected.headers.get("user-agent", "").startswith("Python-httplib2/")
157 # Test that the default user-agent can be over-ridden
159 with tests.server_reflect() as uri:
160 response, content = http.request(uri, "GET", headers={"User-Agent": "fred/1.0"})
163 assert reflected.headers.get("user-agent") == "fred/1.0"
176 with tests.server_route(routes, request_count=2) as uri:
177 response, content = http.request(uri, "GET")
184 with tests.server_route(routes, request_count=2) as uri:
185 response, content = http.request(uri, "GET")
201 with tests.server_const_bytes(response) as uri:
202 response, content = http.request(uri, "GET")
212 ) as uri:
213 response, content = http.request(uri, "GET")
232 with tests.server_route(routes, request_count=3) as uri:
233 destination = urllib.parse.urljoin(uri, "/final")
234 response1, content1 = http.request(uri, "GET")
235 response2, content2 = http.request(uri, "GET")
237 assert "content-location" in response2
238 assert response1["content-location"] == destination
244 assert response2["content-location"] == destination
251 not os.environ.get("httplib2_test_still_run_skipped")
252 and os.environ.get("TRAVIS_PYTHON_VERSION") in ("2.7", "pypy"),
267 with tests.server_route(routes, request_count=2) as uri:
268 destination = urllib.parse.urljoin(uri, "/final")
269 response, content = http.request(uri, "HEAD")
271 assert response["content-location"] == destination
287 headers={"location": "/final", "cache-control": "max-age=300"},
291 with tests.server_const_bytes(response) as uri:
292 response, _ = http.request(uri, "GET")
295 response, _ = http.request(uri, "GET")
314 with tests.server_route(routes, request_count=7) as uri:
315 second_url = urllib.parse.urljoin(uri, "/second")
316 final_url = urllib.parse.urljoin(uri, "/final")
317 response1, content1 = http.request(second_url, "GET")
318 response2, content2 = http.request(second_url, "GET")
319 response3, content3 = http.request(uri, "GET")
321 assert response1["content-location"] == final_url
329 assert response2["content-location"] == final_url
333 assert response2.previous["content-location"] == second_url
357 with tests.server_route(routes, request_count=4) as uri:
359 http.request(uri, "GET", redirections=1)
366 # Re-run the test with out the exceptions
368 response, content = http.request(uri, "GET", redirections=1)
378 # Test that we throw an exception when we get
382 with tests.server_const_http(status="302 Found", request_count=2) as uri:
384 http.request(uri, "GET")
391 # Re-run the test with out the exceptions
393 response, content = http.request(uri, "GET")
402 not os.environ.get("httplib2_test_still_run_skipped")
403 and os.environ.get("TRAVIS_PYTHON_VERSION") in ("2.7", "pypy"),
407 # Do a follow-up GET on a Location: header
416 with tests.server_route(routes, request_count=2) as uri:
417 response, content = http.request(uri, "POST", " ")
420 assert reflected.uri == "/final"
423 # Skip follow-up GET
426 with tests.server_route(routes, request_count=1) as uri:
427 response, content = http.request(uri, "POST", " ")
432 cases = "DELETE GET HEAD POST PUT EVEN_NEW_ONES".split(" ")
433 with tests.server_route(routes, request_count=len(cases) * 2) as uri:
435 response, content = http.request(uri, method, body=b"q q")
438 assert reflected.method == "GET"
449 headers={"cache-control": "public,max-age=300"},
453 if request.headers.get("range"):
457 with tests.server_request(handler, request_count=2) as uri:
458 response, _ = http.request(uri, "GET", headers={"accept-encoding": "identity"})
461 http.request(uri, "GET", headers={"accept-encoding": "identity"})
463 uri,
464 "GET",
465 headers={"accept-encoding": "identity", "cache-control": "must-revalidate"},
472 cache_path, httplib2.safename(httplib2.urlnorm(uri)[-1])
479 uri, "HEAD", headers={"accept-encoding": "identity"}
485 uri, "GET", headers={"accept-encoding": "identity", "range": "bytes=0-0"}
495 with tests.server_reflect(request_count=3, **response_kwargs) as uri:
497 uri, "GET", headers={"accept-encoding": "identity"}
503 uri,
504 "GET",
505 headers={"accept-encoding": "identity", "cache-control": "max-age=0"},
508 assert reflected.headers.get("if-none-match")
512 uri,
513 "GET",
514 headers={"accept-encoding": "identity", "cache-control": "max-age=0"},
518 assert not reflected.headers.get("if-none-match")
525 with tests.server_reflect(request_count=3, **response_kwargs) as uri:
526 response, _ = http.request(uri, "GET", headers={"accept-encoding": "identity"})
531 uri,
532 "GET",
533 headers={"accept-encoding": "identity", "cache-control": "max-age=0"},
537 assert reflected.headers.get("if-none-match")
538 assert reflected.headers.get("if-none-match") != "fred"
541 uri,
542 "GET",
544 "accept-encoding": "identity",
545 "cache-control": "max-age=0",
546 "if-none-match": "fred",
551 assert reflected.headers.get("if-none-match") == "fred"
557 # Test that end to end headers get overwritten in the cache
558 # uri = urllib.parse.urljoin(base, "304/end2end.cgi")
559 # response, content = http.request(uri, 'GET')
564 # response, content = http.request(uri, 'GET', headers = {'Cache-Control': 'max-age=0'})
574 # by only using the last-modified cache validator.
581 status=200, body=b"something", headers={"date": date, "last-modified": date}
585 assert request2.headers["if-modified-since"] == date
588 with tests.server_yield(handler, request_count=2) as uri:
589 response, content = http.request(uri, "GET")
590 assert response.get("last-modified") == date
592 response, content = http.request(uri, "GET")
606 headers={"cache-control": "max-age=300"},
609 with tests.server_list_http([r307, r200, r307]) as uri:
610 response, content = http.request(uri, "GET")
617 response, content = http.request(uri, "GET")
632 with tests.server_list_http([r307, r200, r307, r200]) as uri:
633 response, content = http.request(uri, "POST")
640 response, content = http.request(uri, "POST")
656 headers={"cache-control": "max-age=300", "location": "/final"},
660 with tests.server_route(routes, request_count=3) as uri:
661 response, content = http.request(uri, "CHANGE", body=b"hello308")
668 response, content = http.request(uri, "CHANGE")
679 with tests.server_const_http(status=410) as uri:
680 response, content = http.request(uri, "GET")
685 # Test that duplicate headers get concatenated via ','
689 Content-Length: 7\r\n\
692 with tests.server_const_bytes(response) as uri:
693 response, content = http.request(uri, "GET")
702 with tests.server_const_http(status=301, request_count=1) as uri:
703 response, content = http.request(uri, "GET")
710 # GET /?q= HTTP/1.1 <- injected "HTTP/1.1" from attacker
712 # ignore-http: HTTP/1.1 <- nominal "HTTP/1.1" from library
715 with tests.server_reflect() as uri:
717 uri, "?q= HTTP/1.1\r\ninjected: attack\r\nignore-http:"
719 response, content = http.request(danger_url, "GET")
722 assert req.headers.get("injected") is None
726 # Injecting space into request line is precursor to CWE-93 and possibly other injections
728 with tests.server_reflect() as uri:
729 # "\r\nignore-http:" suffix is nuance for current server implementation
731 danger_url = urllib.parse.urljoin(uri, "?q= HTTP/1.1\r\nignore-http:")
732 response, content = http.request(danger_url, "GET")
735 assert req.uri == "/?q=%20HTTP/1.1%0D%0Aignore-http:"