You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
635 B
28 lines
635 B
9 years ago
|
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
|