Skip to content

Commit 5dd38a9

Browse files
diogoosorioDiogo Osório
authored andcommitted
Default the Content-Length response header to 0¬
If the response payload doesn't contain a 'Content-Length' header and the '--ignore-content-length' parameter is provided, the script was trying to cast a None type into an integer. This commit fixes that by return '0' has the 'Content-Length' if the header isn't present.
1 parent 4f38ca5 commit 5dd38a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/core/virtual_host_scanner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def scan(self):
134134
if res.status_code in self.ignore_http_codes:
135135
continue
136136

137-
response_length = int(res.headers.get('content-length'))
137+
response_length = int(res.headers.get('content-length', 0))
138138
if self.ignore_content_length and \
139139
self.ignore_content_length == response_length:
140140
continue

0 commit comments

Comments
 (0)