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 }}
Repository navigation
Added live output (stream, WS and SSE) support - #123
Adds live command output to shell2http through per-endpoint streaming and Server-Sent Events (SSE), addressing the progress-display and continuous-log use cases in #33 and #97.
Changes:
Adds stream=1 and sse=1 endpoint options, immediate output flushing, and exit-code reporting.
Shares command preparation between output modes and adds cancellation on streaming-client disconnect or server shutdown.
Adds streaming and option-parsing tests, plus usage and lifecycle documentation.
File
Description
stream.go
Implements streaming responses, SSE framing, and line splitting.
stream_unix_test.go
Tests streaming output, cancellation, timeout, and shutdown behavior.
shell2http.go
Parses endpoint options, shares execution logic, and coordinates shutdown.
shell2http.1
Refreshes the manual with streaming and shutdown guidance.
shell2http_test.go
Tests endpoint-option parsing and duplicate-path handling.
README.md
Documents streaming configuration, examples, and limitations.
Makefile
Excludes test files from errcheck.
http_middlewares.go
Allows response controllers to unwrap the logging middleware.
exec_unix.go
Defines Unix shutdown signals.
exec_other.go
Defines the shutdown signal for non-Unix platforms.
doc.go
Adds endpoint-option documentation and streaming examples.
config.go
Adds the shared shutdown context for command cancellation.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unbounded request-body reads and response writes can leave streaming handlers stuck after command exit or cancellation, preventing cleanup and lock release.
Preserve split UTF-8 characters at the buffer limit
stream.go:183
If a write ends at exactly 64 KiB in the middle of a UTF-8 character, this emits the incomplete character immediately: the backtracking loop is skipped because end == len(lw.buf). For example, 65,535 ASCII bytes followed by the first byte of я, with its second byte in the next write, produces two SSE events containing replacement characters instead of я. Retain a newline-free buffer at exactly the limit until another byte arrives (or final flush), so the split can identify the character boundary.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The WebSocket handler can block on stdin delivery and miss disconnect cancellation, while its preparation path can bypass the configured upload-size limit.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed to evaluate subtle UTF-8 boundary and upload-cancellation interactions that can corrupt streamed output or prevent timely shutdown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #33 and #97