From edfcddd3c3e16d53a7c46d5c49eb978fdf2b6f98 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 13 Mar 2012 10:58:15 +0000 Subject: [PATCH] minor fix for logging only cookies used by request (e.g. --load-cookies case) --- lib/request/connect.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/request/connect.py b/lib/request/connect.py index 78f87f992..9e854fd3a 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -272,7 +272,9 @@ class Connect: requestHeaders += "\n".join("%s: %s" % (key.capitalize() if isinstance(key, basestring) else key, getUnicode(value)) for (key, value) in req.header_items()) if not req.has_header(HTTPHEADER.COOKIE) and conf.cj: - requestHeaders += "\n%s" % ("Cookie: %s" % ";".join("%s=%s" % (getUnicode(cookie.name), getUnicode(cookie.value)) for cookie in conf.cj)) + conf.cj._policy._now = conf.cj._now = int(time.time()) + cookies = conf.cj._cookies_for_request(req) + requestHeaders += "\n%s" % ("Cookie: %s" % ";".join("%s=%s" % (getUnicode(cookie.name), getUnicode(cookie.value)) for cookie in cookies)) if not req.has_header(HTTPHEADER.CONNECTION): requestHeaders += "\n%s: close" % HTTPHEADER.CONNECTION