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

Unified Diff: httparchive.py

Issue 2346853003: Add command for updating the host name in WPR archive
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: httparchive.py
diff --git a/httparchive.py b/httparchive.py
index 32dbe9771f27a77be6673ce186f6d4923c341668..f8e52f58d8df901d8b5bdded43cbd57554e55cf8 100755
--- a/httparchive.py
+++ b/httparchive.py
@@ -1061,6 +1061,19 @@ def main():
elif command == 'edit':
http_archive.edit(options.command, options.host, options.full_path)
http_archive.Persist(replay_file)
+ elif command == 'remap-host':
+ old_host = args[2]
+ new_host = args[3]
+ update_count = 0
+ for req in http_archive:
+ if req.host == old_host:
+ req.host = new_host
+ update_count += 1
+ updated_file_path = replay_file + '.updated'
+ http_archive.Persist(updated_file_path)
+ print 'Updated %i hosts of address %s to address %s' % (
+ update_count, old_host, new_host)
+ print 'The updated WPR is saved as %s' % updated_file_path
else:
option_parser.error('Unknown command "%s"' % command)
return 0
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698