mirror of
https://github.com/SunBK201/UA3F.git
synced 2025-12-16 16:57:08 +00:00
fix: long http header
This commit is contained in:
parent
05dacdb1a5
commit
2c4f6a3b99
@ -186,7 +186,6 @@ func (r *Rewriter) ProxyHTTPOrRaw(dst net.Conn, src net.Conn, destAddr string, s
|
|||||||
|
|
||||||
// HTTP request loop (handles keep-alive)
|
// HTTP request loop (handles keep-alive)
|
||||||
for {
|
for {
|
||||||
|
|
||||||
if isHTTP, err = r.isHTTP(reader); err != nil {
|
if isHTTP, err = r.isHTTP(reader); err != nil {
|
||||||
err = fmt.Errorf("isHTTP: %w", err)
|
err = fmt.Errorf("isHTTP: %w", err)
|
||||||
return
|
return
|
||||||
@ -221,26 +220,8 @@ func (r *Rewriter) isHTTP(reader *bufio.Reader) (bool, error) {
|
|||||||
}
|
}
|
||||||
hint := string(hintSlice)
|
hint := string(hintSlice)
|
||||||
method, _, _ := strings.Cut(hint, " ")
|
method, _, _ := strings.Cut(hint, " ")
|
||||||
if _, exists := httpMethods[method]; !exists {
|
_, exists := httpMethods[method]
|
||||||
return false, nil
|
return exists, nil
|
||||||
}
|
|
||||||
|
|
||||||
// Detailed check: parse request line
|
|
||||||
line, err := peekLineString(reader)
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
method, _, proto, ok := parseRequestLine(line)
|
|
||||||
if !ok {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
if proto != "HTTP/1.1" && proto != "HTTP/1.0" {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
if _, exists := httpMethods[method]; exists {
|
|
||||||
return true, nil
|
|
||||||
}
|
|
||||||
return false, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// buildNewUA returns either a partial replacement (regex) or full overwrite.
|
// buildNewUA returns either a partial replacement (regex) or full overwrite.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user