feat(httpapi): harden control plane and speed up prefix refresh
Очередь job получила lease и fencing, телеметрия и прогресс deploy сохраняются, ревизия пишет manifest входов. Обновление префиксов не переписывает неизменённый снимок, большие наборы идут через COPY, а устаревшая ревизия не попадает в deploy. Бандл ноды кэшируется, prune и постановка job больше не держат горячий путь. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
924f111e48
commit
f8e0520817
197 files changed
+18655
-1416
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package httpclient
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ErrResponseTooLarge means the complete decoded HTTP response exceeded its budget.
|
||||
var ErrResponseTooLarge = errors.New("httpclient: response body exceeds limit")
|
||||
|
||||
// ReadResponseBody reads a complete bounded body, including one extra byte to
|
||||
// distinguish an exact limit from truncation. Standard Transport gzip decoding
|
||||
// occurs before this reader, so the limit covers decompressed data as well.
|
||||
func ReadResponseBody(resp *http.Response, limit int64) ([]byte, error) {
|
||||
if limit <= 0 || limit == int64(^uint64(0)>>1) {
|
||||
return nil, fmt.Errorf("httpclient: invalid response limit")
|
||||
}
|
||||
if resp.ContentLength > limit {
|
||||
return nil, ErrResponseTooLarge
|
||||
}
|
||||
body, err := io.ReadAll(io.LimitReader(resp.Body, limit+1))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if int64(len(body)) > limit {
|
||||
return nil, ErrResponseTooLarge
|
||||
}
|
||||
return body, nil
|
||||
}
|
||||
Reference in new issue
Block a user