claude found neat bugs

This commit is contained in:
Patricio Whittingslow
2026-07-25 19:51:06 -03:00
parent 0fd0ad8cbf
commit 9397caf144
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -128,8 +128,6 @@ func (r *Router) Configure(cfg RouterConfig) error {
}
func (r *Router) Handle(conn conn) error {
r.mu.Lock()
defer r.mu.Unlock()
exch := r.getExch(conn)
if exch == nil {
return lneto.ErrExhausted
@@ -141,7 +139,9 @@ func (r *Router) Handle(conn conn) error {
}
select {
case r.pendingConns <- job{exch: exch}:
return nil
default:
// pendingConns cannot store another Conn, we drop and return error.
exch.used.Store(false) // release.
}
return lneto.ErrPacketDrop
@@ -286,6 +286,7 @@ func (exch *Exchange) Configure(rawbuf []byte, requestLim int, normalizeKeys boo
if respSize < 0 {
panic("request lim larger than buffer")
}
exch.rawbuf = rawbuf
exch.reqHdr.Reset(rawbuf[:0:requestLim])
exch.normalizeKeys = normalizeKeys
}
@@ -320,7 +321,7 @@ func (exch *Exchange) SetHeader(key, value string) (enoughMemory bool) {
if exch.normalizeKeys {
httpraw.NormalizeHeaderKey(exch.rawbuf[off : off+n])
}
exch.rawbuf[n] = ':'
exch.rawbuf[off+n] = ':'
n++
n += copy(exch.rawbuf[off+n:], value)
exch.rawbuf[off+n] = '\r'
+1 -1
View File
@@ -605,7 +605,7 @@ func CopyDecodedPercentURL(dst, value []byte, plusAsSpace bool) (n int, err erro
func copyPlusDecoded(dst, src []byte, plusAsSpace bool) int {
n := copy(dst, src)
if plusAsSpace {
for i := 0; i < n; i++ {
for i := range n {
if dst[i] == '+' {
dst[i] = ' '
}