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 |