Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1674)

Unified Diff: Tools/Scripts/webkitpy/thirdparty/mechanize/_debug.py

Issue 18418010: Check in the thirdparty libs needed for webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/thirdparty/mechanize/_debug.py
diff --git a/Tools/Scripts/webkitpy/thirdparty/mechanize/_debug.py b/Tools/Scripts/webkitpy/thirdparty/mechanize/_debug.py
new file mode 100644
index 0000000000000000000000000000000000000000..8243969990ddf98865bbcf8bcd910819cc18dfb4
--- /dev/null
+++ b/Tools/Scripts/webkitpy/thirdparty/mechanize/_debug.py
@@ -0,0 +1,28 @@
+import logging
+
+from _response import response_seek_wrapper
+from _urllib2_fork import BaseHandler
+
+
+class HTTPResponseDebugProcessor(BaseHandler):
+ handler_order = 900 # before redirections, after everything else
+
+ def http_response(self, request, response):
+ if not hasattr(response, "seek"):
+ response = response_seek_wrapper(response)
+ info = logging.getLogger("mechanize.http_responses").info
+ try:
+ info(response.read())
+ finally:
+ response.seek(0)
+ info("*****************************************************")
+ return response
+
+ https_response = http_response
+
+class HTTPRedirectDebugProcessor(BaseHandler):
+ def http_request(self, request):
+ if hasattr(request, "redirect_dict"):
+ info = logging.getLogger("mechanize.http_redirects").info
+ info("redirecting to %s", request.get_full_url())
+ return request

Powered by Google App Engine
This is Rietveld 408576698