这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Fixed an issue where output (often a lot of it) would be printed after entering interactive mode
- Fixed an issue when reading wordlist files from ffufrc
- Fixed an issue where `-of all` option only creates one output file (instead of all formats)
- Fixed an issue where redirection to the same domain in recursive mode dropped port info from URL
- Added HTTP2 support

- v1.3.1
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* [fang0654](https://github.com/fang0654)
* [Hazegard](https://github.com/Hazegard)
* [helpermika](https://github.com/helpermika)
* [h1x](https://github.com/h1x-lnx)
* [Ice3man543](https://github.com/Ice3man543)
* [JamTookTheBait](https://github.com/JamTookTheBait)
* [jimen0](https://github.com/jimen0)
Expand Down
30 changes: 29 additions & 1 deletion pkg/ffuf/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,40 @@ func (resp *Response) GetRedirectLocation(absolute bool) string {
if err != nil {
return redirectLocation
}
redirectLocation = baseUrl.ResolveReference(redirectUrl).String()
if redirectUrl.IsAbs() && UrlEqual(redirectUrl, baseUrl) {
redirectLocation = redirectUrl.Scheme + "://" +
baseUrl.Host + redirectUrl.Path
} else {
redirectLocation = baseUrl.ResolveReference(redirectUrl).String()
}
}

return redirectLocation
}

func UrlEqual(url1, url2 *url.URL) bool {
if url1.Hostname() != url2.Hostname() {
return false
}
if url1.Scheme != url2.Scheme {
return false
}
p1, p2 := getUrlPort(url1), getUrlPort(url2)
return p1 == p2
}

func getUrlPort(url *url.URL) string {
var portMap = map[string]string{
"http": "80",
"https": "443",
}
p := url.Port()
if p == "" {
p = portMap[url.Scheme]
}
return p
}

func NewResponse(httpresp *http.Response, req *Request) Response {
var resp Response
resp.Request = req
Expand Down