Skip to content

icap code fix by opus 5.5 - #115

Merged
zh-jq merged 9 commits into
mainfrom
icap-fix
Sep 25, 2026
Merged

zh-jq merged 9 commits into
mainfrom
icap-fix

Conversation

@zh-jq

@zh-jq zh-jq commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

No description provided.

zh-jq and others added 9 commits September 25, 2026 20:18
Resume the chunked upstream body after preview with H2StreamFromChunkedTransfer,
so trailer reading is covered by the same idle check loop, and drop the
separate http trailer recv timeout.

Co-authored-by: Cursor <cursoragent@cursor.com>
…imeout

Only skip preview when the upstream chunked body is still at a chunk
boundary, otherwise keep reading under the idle checker, as the partial
consumed chunk encoding can not be resent by a fresh chunked transfer.

Co-authored-by: Cursor <cursoragent@cursor.com>
The trailer of the adapted http body from the ICAP server was limited to
128 bytes, which made the ICAP connection not reusable for larger ones.

Co-authored-by: Cursor <cursoragent@cursor.com>
The body is always forwarded as chunked if the h2/h3 stream has one, so
session based auth should not make body_type() return None. This keeps
it consistent with the h2_to_h1 reqmod adapter, which uses the stream end.

Co-authored-by: Cursor <cursoragent@cursor.com>
So the ICAP adapters can use the small body path when the body size is
exactly the preview size, like the h1 ones, instead of a preview request
and an extra 100-continue round trip.

Co-authored-by: Cursor <cursoragent@cursor.com>
HTTP/2 forbids connection-specific headers, so an ICAP response with
Upgrade or Proxy-Connection or headers listed on Connection would make
the h2 send fail. Filter them in adapted h2 request/response and in the
adapter error response sent to h2 clients.

Co-authored-by: Cursor <cursoragent@cursor.com>
The preview data, including the part left over for the following body
transfer, is buffered locally, so release the flow control capacity for
it, or the stream will stall if the preview size is not less than the
stream window.

Co-authored-by: Cursor <cursoragent@cursor.com>
- accept 'req-hdr=0, res-hdr=X, res-body/null-body=Y' in RESPMOD responses,
  and skip the returned http request header
- use checked parsing for the byte offsets and reject empty values
- limit the encapsulated http header size by the ICAP max header size

Co-authored-by: Cursor <cursoragent@cursor.com>
- use InvalidResponse/UnknownResponse instead of the AfterContinue variants
  on non-preview respmod paths, and move the code check out of the h2 and
  h1_to_h2 bidirectional helpers to the callers, as reqmod and respmod h1 do
- report ICAP-RESPMOD-206 instead of ICAP-REQMOD-206 in respmod preview
- remove duplicated NoPayload check in respmod h2 forward_header

Co-authored-by: Cursor <cursoragent@cursor.com>
@zh-jq
zh-jq merged commit 5554ff3 into main Sep 25, 2026
125 of 130 checks passed
@zh-jq
zh-jq deleted the icap-fix branch September 25, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant