Created
June 5, 2017 21:25
-
-
Save clayg/3eda31eefe8deb9dc008ca66dd6f226f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ubuntu@saio:~$ strace python /vagrant/.scratch/simple_client_pipeline.py test test close 2> pipeline_close.trace | |
************************************************** close | |
************************************************** close | |
************************************************** close | |
70c1db56f301c9e337b0099bd4174b28 | |
ubuntu@saio:~$ grep "sendto(" pipeline_close.trace | |
sendto(3, "GET /auth/v1.0 HTTP/1.1\r\nHost: l"..., 167, 0, NULL, 0) = 167 | |
sendto(4, "GET /v1/AUTH_test/test/test HTTP"..., 207, 0, NULL, 0) = 207 | |
sendto(3, "GET /v1/AUTH_test/test/test HTTP"..., 207, 0, NULL, 0) = 207 | |
ubuntu@saio:~$ strace python /vagrant/.scratch/simple_client_pipeline.py test test 2> pipeline_test.trace | |
************************************************** keep-alive | |
************************************************** keep-alive | |
************************************************** keep-alive | |
70c1db56f301c9e337b0099bd4174b28 | |
ubuntu@saio:~$ grep "sendto(" pipeline_test.trace | |
sendto(3, "GET /auth/v1.0 HTTP/1.1\r\nHost: l"..., 167, 0, NULL, 0) = 167 | |
sendto(4, "GET /v1/AUTH_test/test/test HTTP"..., 212, 0, NULL, 0) = 212 | |
sendto(4, "GET /v1/AUTH_test/test/test HTTP"..., 212, 0, NULL, 0) = 212 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from hashlib import md5 | |
from swiftclient import client | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
try: | |
cname, oname = sys.argv[1:3] | |
except ValueError: | |
sys.exit('usage: %s <cname> <oname> [close]' % sys.argv[0]) | |
conn = client.Connection('http://localhost:8080/auth/v1.0', | |
'test:tester', 'testing', retries=0, timeout=11) | |
if sys.argv[-1] == 'close': | |
connection = 'close' | |
else: | |
connection = 'keep-alive' | |
req_headers = {'connection': connection} | |
print '*' * 50, req_headers['connection'] | |
headers, body = conn.get_object(cname, oname, headers=req_headers) | |
print '*' * 50, headers['connection'] | |
headers, body = conn.get_object(cname, oname, headers=req_headers) | |
print '*' * 50, headers['connection'] | |
print md5(body).hexdigest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment