diff --git a/cmd/integration-test/http.go b/cmd/integration-test/http.go index 62bc34e7..caa14480 100644 --- a/cmd/integration-test/http.go +++ b/cmd/integration-test/http.go @@ -19,14 +19,14 @@ var httpTestcases = map[string]testutils.TestCase{ "Raw HTTP GET Request": &standardHttpGet{unsafe: true}, "Raw request with non standard rfc path via stdin": &standardHttpGet{unsafe: true, stdinPath: "/%invalid"}, "Raw request with non standard rfc path via cli flag": &standardHttpGet{unsafe: true, path: "/%invalid"}, - "Regression test for: https://github.com/projectdiscovery/httpx/issues/363": &issue363{}, // infinite redirect - "Regression test for: https://github.com/projectdiscovery/httpx/issues/276": &issue276{}, // full path with port in output - "Regression test for: https://github.com/projectdiscovery/httpx/issues/277": &issue277{}, // scheme://host:port via stdin - "Regression test for: https://github.com/projectdiscovery/httpx/issues/303": &issue303{}, // misconfigured gzip header with uncompressed body - "Regression test for: https://github.com/projectdiscovery/httpx/issues/400": &issue400{}, // post operation with body - "Regression test for: https://github.com/projectdiscovery/httpx/issues/414": &issue414{}, // stream mode with path - "Regression test for: https://github.com/projectdiscovery/httpx/issues/433": &issue433{}, // new line scanning with title flag - "Request URI to existing file - https://github.com/projectdiscovery/httpx/issues/480": &issue480{}, // request uri pointing to existing file + "Regression test for: https://github.com/projectdiscovery/httpx/issues/363": &issue363{}, // infinite redirect + "Regression test for: https://github.com/projectdiscovery/httpx/issues/276": &issue276{}, // full path with port in output + "Regression test for: https://github.com/projectdiscovery/httpx/issues/277": &issue277{}, // scheme://host:port via stdin + "Regression test for: https://github.com/projectdiscovery/httpx/issues/303": &issue303{}, // misconfigured gzip header with uncompressed body + "Regression test for: https://github.com/projectdiscovery/httpx/issues/400": &issue400{}, // post operation with body + "Regression test for: https://github.com/projectdiscovery/httpx/issues/414": &issue414{}, // stream mode with path + "Regression test for unwanted chars": &titleUnwantedChars{}, // new line scanning with title flag, Regression test for: https://github.com/projectdiscovery/httpx/issues/433 + "Request URI to existing file - https://github.com/projectdiscovery/httpx/issues/480": &issue480{}, // request uri pointing to existing file "Standard HTTP GET Request with match response time": &standardHttpGet{mrt: true, inputValue: "\"<10s\""}, "Standard HTTP GET Request with filter response time": &standardHttpGet{frt: true, inputValue: "\">3ms\""}, "Multiple Custom Header": &customHeader{inputData: []string{"-debug-req", "-H", "'user-agent: test'", "-H", "'foo: bar'"}, expectedOutput: []string{"User-Agent: test", "Foo: bar"}}, @@ -257,14 +257,14 @@ func (h *issue414) Execute() error { return nil } -type issue433 struct{} +type titleUnwantedChars struct{} -func (h *issue433) Execute() error { +func (h *titleUnwantedChars) Execute() error { var ts *httptest.Server router := httprouter.New() uriPath := "/index" router.GET(uriPath, httprouter.Handle(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { - htmlResponse := "Project\n\r Discovery\n - Httpx>test data" + htmlResponse := "\v\fProject\n\r Discovery\n - Httpx\t>test data" fmt.Fprint(w, htmlResponse) })) ts = httptest.NewServer(router) diff --git a/common/httpx/title.go b/common/httpx/title.go index efcd4772..1b59b1e7 100644 --- a/common/httpx/title.go +++ b/common/httpx/title.go @@ -35,7 +35,7 @@ func ExtractTitle(r *Response) (title string) { // remove unwanted chars title = strings.TrimSpace(strings.Trim(title, cutset)) - title = stringsutil.ReplaceAll(title, "\n", "\r") + title = stringsutil.ReplaceAll(title, "", "\n", "\t", "\v", "\f", "\r") return title }