Fix crash with 3xx requests without location header (#265)

Co-authored-by: Joona Hoikkala <joohoi@io.fi>
This commit is contained in:
Joona Hoikkala 2020-07-23 13:13:27 +03:00 committed by GitHub
parent 9bb613050e
commit bef2dc04ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -14,6 +14,7 @@
- Fixed HTML report to display select/combo-box for rows per page (and increased default from 10 to 250 rows).
- Added Host information to JSON output file
- Fixed request method when supplying request file
- Fixed crash with 3XX responses that weren't redirects (304 Not Modified, 300 Multiple Choices etc)
- v1.0.2
- Changed

View File

@ -24,7 +24,11 @@ func (resp *Response) GetRedirectLocation(absolute bool) string {
redirectLocation := ""
if resp.StatusCode >= 300 && resp.StatusCode <= 399 {
redirectLocation = resp.Headers["Location"][0]
if loc, ok := resp.Headers["Location"]; ok {
if len(loc) > 0 {
redirectLocation = loc[0]
}
}
}
if absolute {