Skip to content

Incomplete Response Body in handleUpstreamResponse #3

Description

@stanleydv12

Incomplete Response Body in handleUpstreamResponse

Description

The server intermittently returns incomplete or empty response bodies, particularly with responses larger than 4KB.

Steps to Reproduce

  1. Start the server:
    docker compose up --build
  2. Make requests to an endpoint that returns >4KB:
    curl -v http://localhost:8080/get
  3. Repeat multiple times

Expected Behavior

Consistently returns complete response body for every request.

Actual Behavior

  • Sometimes returns complete response
  • Sometimes returns partial/empty response
  • No errors logged

Environment

  • OS: Linux Docker
  • Go Version: go1.23.2
  • Commit: c6a947a

Root Cause

handleUpstreamResponse in internal/server/server.go uses a fixed 4KB buffer and doesn't handle:

  • Responses larger than buffer size
  • Chunked transfer encoding
  • Partial reads/writes

Proposed Fix

  1. Implement dynamic buffering for large responses
  2. Add chunked transfer encoding support
  3. Handle partial reads/writes
  4. Improve error logging

Severity

High - Affects response reliability

Reproduction Rate

Intermittent (happens sometimes, not always)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions