Version 0.2.11
This commit is contained in:
parent
9d274de709
commit
992edab315
17 changed files with 551 additions and 84 deletions
27
pappyproxy/templates/macro_header.py.template
Normal file
27
pappyproxy/templates/macro_header.py.template
Normal file
|
@ -0,0 +1,27 @@
|
|||
from pappyproxy.session import Session
|
||||
|
||||
MACRO_NAME = '{{macro_name}}'
|
||||
SHORT_NAME = '{{short_name}}'
|
||||
runargs = []
|
||||
|
||||
def init(args):
|
||||
global runargs
|
||||
runargs = args
|
||||
|
||||
def modify_header(msg, key, val):
|
||||
"""
|
||||
Modifies the header in a request or a response if it already exists in
|
||||
the message
|
||||
"""
|
||||
if key in msg.headers:
|
||||
msg.headers[key] = val
|
||||
|
||||
def mangle_request(request):
|
||||
global runargs
|
||||
modify_header(request, 'headername', 'headerval')
|
||||
return request
|
||||
|
||||
def mangle_response(request):
|
||||
global runargs
|
||||
modify_header(request.response, 'headername', 'headerval')
|
||||
return request.response
|
Loading…
Add table
Add a link
Reference in a new issue