Harden scan robustness and tests

This commit is contained in:
ZacharyZcR
2026-06-14 22:23:48 +08:00
parent 5ad914a1bb
commit c49c23c7f0
100 changed files with 4483 additions and 412 deletions
+23
View File
@@ -0,0 +1,23 @@
package proxy
import (
"net"
"testing"
"time"
)
func TestHTTPDialerRejectsConnectTargetWithLineBreak(t *testing.T) {
client, server := net.Pipe()
defer client.Close()
defer server.Close()
dialer := &httpDialer{
config: &ProxyConfig{Timeout: time.Second},
stats: &ProxyStats{},
}
err := dialer.sendConnectRequest(client, "example.com:80\r\nX-Injected: yes")
if err == nil {
t.Fatal("sendConnectRequest() error = nil, want invalid target error")
}
}