Skip to content
Snippets Groups Projects
Commit bd03cac8 authored by kr328's avatar kr328
Browse files

Chore: remove system proxy timeout

parent da3ee71d
No related branches found
No related tags found
No related merge requests found
...@@ -5,17 +5,12 @@ import ( ...@@ -5,17 +5,12 @@ import (
"net" "net"
"net/http" "net/http"
"sync" "sync"
"time"
"github.com/Dreamacro/clash/adapter/inbound" "github.com/Dreamacro/clash/adapter/inbound"
"github.com/Dreamacro/clash/log" "github.com/Dreamacro/clash/log"
"github.com/Dreamacro/clash/tunnel" "github.com/Dreamacro/clash/tunnel"
) )
const (
LocalHttpTimeout = time.Minute * 5
)
var listener *httpListener var listener *httpListener
var lock sync.Mutex var lock sync.Mutex
...@@ -79,18 +74,14 @@ func stopLocked() { ...@@ -79,18 +74,14 @@ func stopLocked() {
} }
func (l *httpListener) handleConn(conn net.Conn) { func (l *httpListener) handleConn(conn net.Conn) {
_ = conn.SetReadDeadline(time.Now().Add(LocalHttpTimeout))
br := bufio.NewReader(conn) br := bufio.NewReader(conn)
request, err := http.ReadRequest(br) request, err := http.ReadRequest(br)
_ = conn.SetReadDeadline(time.Time{})
if err != nil || request.URL.Host == "" { if err != nil || request.URL.Host == "" {
if err != nil { if err != nil {
log.Warnln("HTTP Connection closed: %s", err.Error()) log.Warnln("[HTTP] Connection closed: %s", err.Error())
} else { } else {
log.Warnln("HTTP Connection closed: unknown host") log.Warnln("[HTTP] Connection closed: unknown host")
} }
_ = conn.Close() _ = conn.Close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment