@@ -69,13 +69,14 @@ def cbLinkFollow(response, *args, **kwargs):
6969@click .argument ("url" )
7070@click .option ("-T" , "--timeout" , default = 10 , help = "Request timeout in seconds" )
7171@click .option ("-a" , "--accept" , default = "*/*" , help = "Accept header value" )
72+ @click .option ("-b" , "--body" , is_flag = True , help = "Show response body" )
7273@click .option ("-j" , "--json" , "json_report" , is_flag = True , help = "Report in JSON" )
7374@click .option ("-k" , "--insecure" , default = False , is_flag = True , help = "Don't verify certificates" )
74- @click .option ("-b" , "--body" , is_flag = True , help = "Show response body" )
7575@click .option ("-L" , "--link-type" , default = None , help = "Follow link header with type" )
76- @click .option ("-R" , "--link-rel" , default = 'alternate' , help = "Follow link header with rel" )
7776@click .option ("-P" , "--link-profile" , default = None , help = "Follow link header with profile" )
78- def main (url , timeout , accept , json_report , insecure , body , link_type , link_rel , link_profile ):
77+ @click .option ("-R" , "--link-rel" , default = 'alternate' , help = "Follow link header with rel" )
78+ @click .option ("-U" , "--user-agent" , default = None , help = "User agent header value" )
79+ def main (url , timeout , accept , body , json_report , insecure , link_type , link_profile , link_rel , user_agent ):
7980 if insecure :
8081 urllib3 .disable_warnings (urllib3 .exceptions .InsecureRequestWarning )
8182
@@ -89,6 +90,8 @@ def main(url, timeout, accept, json_report, insecure, body, link_type, link_rel,
8990 "Accept" : accept ,
9091 "User-Agent" : htrace .USER_AGENT ,
9192 }
93+ if not user_agent is None :
94+ headers ["User-Agent" ] = user_agent
9295 hooks = {
9396 'response' : [cbUrl , cbLinkFollow ]
9497 }
0 commit comments