Skip to content

Fix chunked transfer encoding bug by switching from CIO to Java HTTP engine#41

Open
psiman-wandera wants to merge 1 commit into
Heapy:mainfrom
psiman-wandera:fix-chunked-encoding
Open

Fix chunked transfer encoding bug by switching from CIO to Java HTTP engine#41
psiman-wandera wants to merge 1 commit into
Heapy:mainfrom
psiman-wandera:fix-chunked-encoding

Conversation

@psiman-wandera
Copy link
Copy Markdown

Summary

  • Fix chunked transfer encoding parsing bug in Ktor CIO engine
  • Switch HTTP client from CIO to Java engine
  • Adapt SSL/TLS configuration for Java engine API

Problem

The Ktor CIO engine fails to parse chunked transfer encoding responses from the Argo Workflows API with:

io.ktor.utils.io.charsets.TooLongLineException: Line exceeds limit of 0 characters
    at io.ktor.http.cio.ChunkedTransferEncodingKt.decodeChunked

This occurs because the CIO engine's chunked decoder has an uninitialized line limit that defaults to 0, causing it to reject any response.

Solution

Switch from the CIO engine to the Java HTTP engine which uses the built-in Java 11+ HttpClient. The Java HttpClient correctly handles chunked transfer encoding.

Test plan

  • Build and run locally with Docker
  • Successfully list workflows from Argo Workflows API
  • Verify authentication works correctly
  • Test with insecureSkipTlsVerify option

🤖 Generated with Claude Code

…engine

The Ktor CIO engine has a bug where it fails to parse chunked transfer
encoding responses from the Argo Workflows API with:
"TooLongLineException: Line exceeds limit of 0 characters"

This occurs because the CIO engine's chunked decoder has an uninitialized
line limit that defaults to 0.

The fix switches to the Java HTTP engine which uses the built-in Java 11+
HttpClient that correctly handles chunked encoding.

Changes:
- Replace ktor-client-cio with ktor-client-java dependency
- Update ArgoWorkflowsHttpClient to use Java engine
- Adapt SSL/TLS configuration for Java engine API

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@psiman-wandera
Copy link
Copy Markdown
Author

Hi @IRus, can you please review this PR?

@IRus
Copy link
Copy Markdown
Member

IRus commented Apr 23, 2026

Hi @psiman-wandera, I'll test it today, thank you

@IRus
Copy link
Copy Markdown
Member

IRus commented Apr 26, 2026

I couldn't reproduce this issue, when exactly this issue happens?

@psiman-wandera
Copy link
Copy Markdown
Author

Hi @IRus thanks for looking at this. I tried to describe the reproducer in #40. Hope that issue description helps.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants