Meta tags:
description= An AI Gateway, registry, and proxy that sits in front of any MCP, A2A, or REST/gRPC APIs, exposing a unified endpoint with centralized discovery, guardrails and management. Optimizes Agent & Tool calling, and supports plugins. - fix(transport): remove manual Content-Length headers causing compression errors by ja8zyjits · Pull Request #5663 · IBM/mcp-context-forge;
Headings (most frequently used words):
uh, oh, comment, content, length, compression, this, context, left, choose, reason, for, hiding, issues, pull, saved, searches, fix, transport, remove, manual, headers, causing, errors, navigation, to, mcp, forge, 5457, bug, mismatch, when, enabled, related, footer, loading, testing, gandhipratik203, search, code, repositories, users, requests, provide, feedback, 5663, request, menu, use, filter, your, results, more, quickly, 5663ja8zyjits, merged, commits, intomainibm, mainfrom, 2ibm, 2copy, head, branch, name, clipboard, conversation, issue, summary, reviewability, type, of, change, verification, checklist, notes, ja8zyjits, commented, jul, 16, 2026, edited, there, was, an, error, while, please, reload, page, automated, test, coverage, files, modified, known, limitation, review, follow, up, architecture, strategy, msureshkumar88, reviewers, assignees, labels, projects, milestone, development, participants,
Text of the page (most frequently used words):
the (56), #content (48), length (48), this (46), #compression (30), and (21), code (20), tests (20), 2026 (18), changes (17), comment (17), for (16), from (15), when (15), response (15), manual (14), pull (13), there (13), was (13), error (13), with (13), fix (13), that (12), github (12), while (12), request (12), reload (12), ja8zyjits (12), jul (12), middleware (12), applied (11), bug (11), review (11), view (11), all (11), validationmiddleware (11), bytes (11), headers (11), security (10), please (10), loading (10), enabled (10), pass (10), mcp (10), copy (10), transport (10), can (9), page (9), mismatch (9), issues (9), gandhipratik203 (9), 5457 (9), regression (9), mcpgateway (9), reason (9), ibm (9), errors (9), line (8), branch (8), unit (8), test (8), compressed (8), responses (8), you (7), not (7), suggestion (7), cannot (7), suggestions (7), merge (7), added (7), path (7), declared (7), quality (7), remove (7), context (7), change (6), single (6), requested (6), main (6), worker (6), rpc (6), true (6), app (6), off (6), choose (6), hiding (6), signed (6), body (6), after (6), forge (6), your (6), enterprise (6), now (5), commit (5), invalid (5), these (5), brian (5), hussey (5), msureshkumar88 (5), sign (5), more (5), july (5), merged (5), queue (5), into (5), checks (5), hide (5), blocking (5), real (5), pre (5), correctly (5), header (5), static (5), files (5), sets (5), skip (5), tools (5), issue (5), sanitization (5), causing (5), utf (5), session (5), set (5), transports (5), documentation (5), search (5), community (4), navigation (4), multi (4), resolved (4), outdated (4), add (4), one (4), lang (4), akshay (4), owner (4), crivetimihai (4), approved (4), characters (4), text (4), learn (4), via (4), details (4), reactions (4), sorry (4), something (4), went (4), wrong (4), redis (4), new (4), streamablehttp_transport (4), actual (4), http (4), requests (4), post (4), fixes (4), low (4), topic (4), describe (4), others (4), collaborator (4), markdown (4), link (4), but (4), commits (4), replacement (4), source (4), are (4), make (4), test_streamablehttp_compression_contentlength (4), support (4), status (3), check (3), has (3), must (3), lines (3), batch (3), only (3), closed (3), projects (3), awaiting (3), already (3), conversation (3), hidden (3), unicode (3), than (3), open (3), without (3), e2e (3), full (3), green (3), failing (3), forwarded (3), stale (3), matches (3), two (3), loopback (3), fixed (3), same (3), analysis (3), gzip (3), against (3), wire (3), json (3), head (3), client (3), too (3), much (3), data (3), 500 (3), compression_enabled (3), duplicate (3), abuse (3), spam (3), will (3), displayed (3), problem (3), left (3), reviewed (3), updated (3), com (3), addressed (3), manually (3), before (3), uncompressed (3), locations (3), byte (3), bogdan (3), marius (3), catanus (3), still (3), routing (3), testing (3), layer (3), compressionmiddleware (3), test_validation_middleware_contentlength (3), coverage (3), name (3), 5663 (3), insights (3), actions (3), settings (3), another (3), tab (3), window (3), refresh (3), saved (3), use (3), feedback (3), grade (3), features (3), copilot (3), platform (3), solutions (3), explore (3), manage (2), footer (2), comments (2), existing (2), order (2), create (2), deleted (2), because (2), successfully (2), merging (2), may (2), development (2), milestone (2), none (2), yet (2), file (2), bidirectional (2), what (2), below (2), passed (2), tasks (2), other (2), work (2), mentioned (2), removed (2), suite (2), live (2), run (2), repro (2), earlier (2), both (2), ran (2), including (2), encoding (2), 588 (2), httpx (2), h11 (2), read (2), through (2), reports (2), process (2), out (2), corruption (2), force (2), false (2), venv (2), bin (2), end (2), verification (2), results (2), look (2), focused (2), side (2), e5ed166 (2), jitesh (2), nair (2), jiteshnair (2), runs (2), size (2), prevent (2), future (2), 5461 (2), updates (2), validation_middleware (2), original (2), sizes (2), large (2), environment (2), forwarding (2), doesn (2), connection (2), tracked (2), related (2), verifies (2), final (2), helper (2), pytest (2), lint (2), type (2), they (2), clear (2), update (2), could (2), clipboard (2), discussions (2), appearance (2), cancel (2), see (2), available (2), searches (2), repositories (2), business (2), advanced (2), developer (2), topics (2), resources (2), customer (2), services (2), devops (2), perform, action, time, share, personal, information, cookies, contact, docs, privacy, terms, inc, right, back, later, queued, pending, reviews, been, marked, valid, applying, supported, per, viewing, subset, were, made, participants, close, labels, assignees, reviewers, have, account, join, free, show, contains, interpreted, compiled, differently, appears, editor, reveals, about, 77d99df, pyright, extensive, 5702, self, assigned, due, failed, bot, reaction, reacted, heart, emoji, given, passes, demonstrably, corrects, defects, approving, honest, caveat, sandbox, reach, cross, 4246, since, recalculates, its, own, regardless, specific, verified, above, rather, starlette, compress, points, round, updating, covered, copied, tree, them, fail, counts, finds, brotli, zstd, deflate, proof, comparing, parent, isolated, worktree, 098dc0ea1, decompressed, parsed, returned, protocol, result, behave, under, output, e5ed1668d, replayed, class, strict, remoteprotocolerror, http1, dispatch, called, internally, authenticated, raw, gunzip, parse, truncation, curl, accept, script, anyone, who, wants, rerun, live_gateway, e2e_content_length_compression, registered, rest, over, threshold, list, config, defaults, plugins_enabled, auth_required, compression_minimum_size, fresh, sqlite, jwt, auth, uvicorn, setup, independent, running, gateway, mocks, confirm, good, increments, get_value, locally, reran, instance, counter, findings, compare, 194f9e5, pushed, 2b78f02, setting, causes, streamablehttp, occurrences, compressing, ensuring, transmitted, count, d966120, causi, rewrites, sanitized, changing, leaving, 279, 290, produce, is_internally_forwarded, 4259, thanks, narrowing, down, remain, owners, different, algorithms, affinity, cycle, stack, recommended, deployment, integration, confirms, skips, verify, strategy, modify, compresses, generates, reverse, registration, asgi, execution, architecture, addresses, exists, where, sessions, cleaned, cascading, failures, initial, separately, documented, 5460, secondary, primary, asserts, remains, unset, expansion, compares, encoded, follow, unlikely, trigger, messages, typically, should, consistency, 503, mcp_ingress_mount, 195, priority, location, known, limitation, notes, secrets, credentials, committed, applicable, formatted, black, isort, checklist, 235, 394, recalculate, 4358, local, 4256, 4188, 1312, _send_streamable_http_json_response, core, modified, test_validation_middleware_case_insensitive_content_encoding, test_validation_middleware_handles_empty_content_encoding, test_validation_middleware_preserves_large_compressed_responses, test_validation_middleware_handles_missing_content_encoding, test_validation_middleware_updates_content_length_after_invalid_utf8_decode, test_validation_middleware_updates_content_length_only_if_modified, test_validation_middleware_sanitizes_uncompressed_responses, test_validation_middleware_skips_deflate_compressed_responses, test_validation_middleware_skips_zstd_compressed_responses, test_validation_middleware_skips_brotli_compressed_responses, test_validation_middleware_skips_gzip_compressed_responses, payloads, 10kb, test_large_response_with_compression, behavior, test_content_length_with_compression_disabled, test_redis_forwarded_response_no_content_length, test_loopback_rpc_routing_no_content_length, flow, test_compression_middleware_sets_content_length_correctly, function, test_send_json_response_no_content_length, total, debug, python, command, automated, chore, deps, tooling, refactor, feature, enhancement, assisted, understand, explain, generated, included, validate, unrelated, bugs, improvements, separate, prs, linked, labeled, triage, purpose, reviewability, eliminates, larger, active, which, production, usage, tool, calling, stage, impact, let, solution, default, streamable, based, then, sent, also, retain, expanded, during, root, cause, occurring, removing, summary, closes, alternative, commented, edited, changed, additional, options, 219, 848, star, fork, 759, notification, notifications, public, message, dismiss, alert, switched, accounts, resetting, focus, qualifiers, our, query, filter, quickly, submit, include, email, address, contacted, every, piece, take, input, very, seriously, provide, syntax, tips, users, jump, pricing, premium, ons, powered, collections, trending, archive, program, stars, accelerator, maintainer, lab, programs, fund, developers, sponsors, partners, trust, center, forum, skills, ebooks, events, webinars, stories, software, industries, government, manufacturing, financial, healthcare, industry, cases, devsecops, modernization, case, nonprofits, startups, small, medium, teams, enterprises, company, marketplace, changelog, blog, why, stop, leaks, start, secret, protection, secure, build, find, vulnerabilities, application, enforce, plan, track, instant, dev, environments, codespaces, automate, any, workflow, workflows, integrate, external, registry, direct, agents, write, better, creation, toggle, menu,
Text of the page (random words):
context forge github skip to content navigation menu toggle navigation sign in appearance settings platform ai code creation github copilot write better code with ai github copilot app direct agents from issue to merge mcp registry new integrate external tools developer workflows actions automate any workflow codespaces instant dev environments issues plan and track work code review manage code changes code quality enforce quality at merge application security github advanced security find and fix vulnerabilities code security secure your code as you build secret protection stop leaks before they start explore why github documentation blog changelog marketplace view all features solutions by company size enterprises small and medium teams startups nonprofits by use case app modernization devsecops devops ci cd view all use cases by industry healthcare financial services manufacturing government view all industries view all solutions resources explore by topic ai software development devops security view all topics explore by type customer stories events webinars ebooks reports business insights github skills support services documentation customer support community forum trust center partners view all resources open source community github sponsors fund open source developers programs security lab maintainer community accelerator github stars archive program repositories topics trending collections enterprise enterprise solutions enterprise platform ai powered developer platform available add ons github advanced security enterprise grade security features copilot for business enterprise grade ai features premium support enterprise grade 24 7 support pricing search or jump to search code repositories users issues pull requests search clear search syntax tips provide feedback we read every piece of feedback and take your input very seriously include my email address so i can be contacted cancel submit feedback saved searches use saved searches to filter your results more quickly name query to see all available qualifiers see our documentation cancel create saved search sign in sign up appearance settings resetting focus you signed in with another tab or window reload to refresh your session you signed out in another tab or window reload to refresh your session you switched accounts on another tab or window reload to refresh your session dismiss alert message uh oh there was an error while loading please reload this page ibm mcp context forge public notifications you must be signed in to change notification settings fork 759 star 4 1k code issues 848 pull requests 219 discussions actions projects security and quality 4 insights additional navigation options code issues pull requests discussions actions projects security and quality insights fix transport remove manual content length headers causing compression errors 5663 merged ja8zyjits merged 3 commits into main ibm mcp context forge main from 5457 bug content length mismatch when compression enabled 2 ibm mcp context forge 5457 bug content length mismatch when compression enabled 2 copy head branch name to clipboard jul 20 2026 conversation commits 3 3 checks files changed merged fix transport remove manual content length headers causing compression errors 5663 ja8zyjits merged 3 commits into main ibm mcp context forge main from 5457 bug content length mismatch when compression enabled 2 ibm mcp context forge 5457 bug content length mismatch when compression enabled 2 copy head branch name to clipboard conversation ja8zyjits commented jul 16 2026 edited loading uh oh there was an error while loading please reload this page copy link copy markdown collaborator alternative for 5461 pull request related issue closes 5457 summary fixes too much data for declared content length errors occurring when compression is enabled by removing manual content length headers that are set before the compression middleware runs root cause when compression_enabled true default the streamable http transport manually set content length based on uncompressed body sizes the compression middleware then compressed the response body but could not update the already sent headers validationmiddleware could also retain a stale content length after invalid utf 8 bytes expanded into replacement characters during sanitization solution remove manual content length headers from transport layer 4 locations in streamablehttp_transport py skip sanitization for compressed responses in validationmiddleware to prevent header corruption update content length when sanitization changes response bytes including invalid utf 8 replacement bytes let compression middleware set content length correctly after compression impact eliminates client side connection errors for responses larger than 500 bytes when compression is active which was blocking production usage of mcp tool calling in stage environment reviewability this pr has one clear purpose the linked issue is not labeled triage unrelated bugs or improvements are tracked in separate issues prs tests are included with the code they validate if ai assisted i understand and can explain the generated changes ️ type of change bug fix feature enhancement documentation refactor chore deps ci tooling other describe below verification automated testing check command status lint suite make lint pass unit tests make test pass regression tests uv run pytest tests unit mcpgateway transports test_streamablehttp_compression_contentlength py v 6 6 pass focused regression tests debug false venv bin python m pytest q tests unit mcpgateway middleware test_validation_middleware_contentlength py tests unit mcpgateway transports test_streamablehttp_compression_contentlength py 17 17 pass coverage 80 make coverage pass test coverage new regression tests added 17 total transport layer tests test_streamablehttp_compression_contentlength py test_send_json_response_no_content_length verifies helper function doesn t set content length test_compression_middleware_sets_content_length_correctly e2e flow with compression test_loopback_rpc_routing_no_content_length static analysis of source code test_redis_forwarded_response_no_content_length multi worker forwarding path test_content_length_with_compression_disabled behavior without compression test_large_response_with_compression large payloads 10kb validationmiddleware tests test_validation_middleware_contentlength py test_validation_middleware_skips_gzip_compressed_responses test_validation_middleware_skips_brotli_compressed_responses test_validation_middleware_skips_zstd_compressed_responses test_validation_middleware_skips_deflate_compressed_responses test_validation_middleware_sanitizes_uncompressed_responses test_validation_middleware_updates_content_length_only_if_modified test_validation_middleware_updates_content_length_after_invalid_utf8_decode test_validation_middleware_handles_missing_content_encoding test_validation_middleware_preserves_large_compressed_responses test_validation_middleware_handles_empty_content_encoding test_validation_middleware_case_insensitive_content_encoding files modified core fixes mcpgateway transports streamablehttp_transport py removed 4 manual content length locations line 1312 _send_streamable_http_json_response helper line 4188 loopback rpc routing line 4256 redis forwarded responses line 4358 local session owner routing mcpgateway middleware validation_middleware py skip compressed response sanitization and recalculate content length when final response bytes change test files added tests unit mcpgateway transports test_streamablehttp_compression_contentlength py 394 lines tests unit mcpgateway middleware test_validation_middleware_contentlength py 235 lines checklist code formatted make black isort pre commit tests added updated for changes documentation updated if applicable no secrets or credentials committed notes known limitation one low priority location still has manual content length mcpgateway transports mcp_ingress_mount py 195 503 error responses this is unlikely to trigger compression error messages typically 500 bytes but should be addressed for consistency in a future pr review follow up the validationmiddleware review comment is addressed content length now compares original response bytes with final encoded bytes invalid utf 8 regression test verifies replacement byte expansion updates an existing content length no change test now asserts that content length remains unset related issues this fix addresses the primary bug content length mismatch a secondary bug exists where mcp sessions are not cleaned up on connection errors causing cascading failures after the initial error this is tracked separately and documented in issue 5460 architecture context asgi middleware execution order response path is reverse of registration request validationmiddleware compressionmiddleware app response validationmiddleware compressionmiddleware app on the response path app generates uncompressed response compressionmiddleware compresses body and sets content length validationmiddleware must not modify compressed responses or headers testing strategy unit tests verify transport layer doesn t set content length manually compression middleware correctly sets content length after compression validationmiddleware skips compressed responses static analysis confirms no manual content length in source code integration testing recommended post deployment full request response cycle through middleware stack multi worker environment with redis forwarding session affinity routing with large responses different compression algorithms and response sizes sorry something went wrong uh oh there was an error while loading please reload this page all reactions ja8zyjits requested review from lang akshay brian hussey crivetimihai and msureshkumar88 as code owners july 16 2026 16 10 gandhipratik203 requested changes jul 16 2026 view reviewed changes gandhipratik203 left a comment copy link copy markdown collaborator there was a problem hiding this comment choose a reason for hiding this comment the reason will be displayed to describe this comment to others learn more choose a reason spam abuse off topic outdated duplicate resolved low quality hide comment thanks for narrowing this down two blocking issues remain streamablehttp_transport py 4259 still sets content length in the is_internally_forwarded rpc path with compression enabled this can still produce the original mismatch ci is already failing on the new static test validation_middleware py 279 290 rewrites response body after utf 8 replacement but only updates content length when the sanitized text changes invalid utf 8 can change byte length without changing that text leaving a stale header sorry something went wrong uh oh there was an error while loading please reload this page all reactions ja8zyjits mentioned this pull request jul 16 2026 fix transport remove manual content length headers causing compression errors 5461 closed 15 tasks bogdan marius catanus and others added 3 commits july 17 2026 11 28 fix transport middleware remove manual content length headers causi d966120 ng compression errors fixes 5457 when compression is enabled compression_enabled true manually setting content length headers before the compression middleware runs causes too much data for declared content length errors because the declared size is uncompressed but the actual body is compressed changes remove manual content length from streamablehttp transport 4 locations skip sanitization of compressed responses in validationmiddleware add 16 regression tests to prevent future occurrences the compression middleware now correctly sets content length after compressing the response body ensuring the header matches the actual transmitted byte count signed off by bogdan marius catanus bogdan marius catanus ibm com addressed the comments 2b78f02 signed off by jitesh nair jiteshnair ibm com fixed headers e5ed166 signed off by jitesh nair jiteshnair ibm com ja8zyjits force pushed the 5457 bug content length mismatch when compression enabled 2 branch from 194f9e5 to e5ed166 compare july 17 2026 11 17 ja8zyjits requested a review from gandhipratik203 july 17 2026 11 54 gandhipratik203 approved these changes jul 17 2026 view reviewed changes gandhipratik203 left a comment copy link copy markdown collaborator there was a problem hiding this comment choose a reason for hiding this comment the reason will be displayed to describe this comment to others learn more choose a reason spam abuse off topic outdated duplicate resolved low quality hide comment updated review no blocking findings from my side the earlier content length issues look fixed ci is green the focused regression tests pass locally 17 passed and i reran the single instance counter repro successfully increments 1 25 get_value 25 sorry something went wrong uh oh there was an error while loading please reload this page all reactions msureshkumar88 approved these changes jul 17 2026 view reviewed changes msureshkumar88 left a comment copy link copy markdown collaborator there was a problem hiding this comment choose a reason for hiding this comment the reason will be displayed to describe this comment to others learn more choose a reason spam abuse off topic outdated duplicate resolved low quality hide comment ran an independent end to end verification against a real running gateway not mocks to confirm this fixes 5457 and results look good setup venv bin uvicorn mcpgateway main app single process fresh sqlite db real jwt auth config compression_enabled true compression_minimum_size 500 defaults auth_required true plugins_enabled false registered 60 rest tools via post tools to force a tools list response over the compression threshold script tests live_gateway e2e_content_length_compression sh added in this branch for anyone who wants to rerun it what it checks against real http with accept encoding gzip post rpc authenticated json rpc raw wire bytes vs declared content length via curl d wc c gunzip json parse for truncation corruption post mcp with x forwarded internally true the same process loopback rpc dispatch path called out in the issue same checks both requests replayed through httpx client http1 true h11 the class of strict http 1 1 client that reports remoteprotocolerror too much data for declared content length output on this branch head e5ed1668d content encoding gzip declared content length 588 actual wire bytes 588 pass declared content length matches actual compressed wire bytes decompressed and parsed json ok tools returned 60 pass httpx h11 read the full response with no protocol error result pass compression content length behave correctly under real http regression proof comparing against the pre fix parent commit 098dc0ea1 in an isolated worktree copied this pr s two new regression test files into that pre fix tree and ran them there 9 of 17 fail including the static analysis check that counts manual content...
|