[passthrough] engine: zstd request-body decompression + header overrides (#29684)

This commit is contained in:
Jialin Ouyang
2026-06-30 23:48:56 -07:00
committed by GitHub
parent 47ae1241d3
commit 40594bd381
7 changed files with 341 additions and 0 deletions
@@ -104,6 +104,7 @@ from sglang.srt.entrypoints.openai.serving_tokenize import (
from sglang.srt.entrypoints.openai.serving_transcription import (
OpenAIServingTranscription,
)
from sglang.srt.entrypoints.request_headers import apply_header_overrides
from sglang.srt.entrypoints.warmup import execute_warmups
from sglang.srt.environ import envs
from sglang.srt.function_call.function_call_parser import FunctionCallParser
@@ -403,6 +404,13 @@ app.add_middleware(
allow_headers=["*"],
)
if envs.SGLANG_ENABLE_REQUEST_DECOMPRESSION.get():
from sglang.srt.entrypoints.http_request_decompression import (
RequestDecompressionMiddleware,
)
app.add_middleware(RequestDecompressionMiddleware)
# Include routers
from sglang.srt.entrypoints.v1_loads import router as v1_loads_router
@@ -781,6 +789,8 @@ if os.environ.get("DUMPER_SERVER_PORT") == "reuse":
)
async def generate_request(obj: GenerateReqInput, request: Request):
"""Handle a generate request."""
if envs.SGLANG_ENABLE_REQUEST_HEADER_OVERRIDES.get():
apply_header_overrides(obj, request.headers)
if obj.stream:
async def stream_results() -> AsyncIterator[bytes]: