fix: send browser request headers to puller so hotlinked streams work#16
Merged
Conversation
MIME-detected streams (e.g. 1embed.cc/api/proxy) were fetched with the Cloudflare response headers instead of request headers: the response event's RequestHeaders come back empty, and the old fallback substituted the response's own headers. Those carry no Referer, so proxy/CDN hosts that enforce hotlink protection returned 403 on every probe and pull. Record the real outgoing headers from requestWillBeSent (Referer, User-Agent, sec-ch-*) by request ID and hand them to the response handler, so a stream confirmed by MIME is fetched with the same headers the browser used. Fixes #14
Closed
A stream URL logged to console is captured with nil headers; if that sighting lands before the browser's actual network request for the same URL, dedup kept the header-less version and dropped the real Referer/ User-Agent. Upgrade a captured candidate's headers when a later network sighting carries them and the stored ones were empty, so hotlink- protected hosts always get the headers the browser sent.
The extension-relaxing flags (-allowed_segment_extensions, -seg_format_options, ...) are options on the HLS demuxer. Passing them for a plain-file input like MP4 makes ffmpeg abort with 'Option not found' (ffprobe tolerates them, which is why probing an MP4 succeeded while the pull died). Thread the source content type into the puller and network encoder and select the input flags by container, so a direct MP4 is fetched without HLS-specific options.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
MIME-detected streams (e.g. 1embed.cc/api/proxy) were fetched with the Cloudflare response headers instead of request headers: the response event's RequestHeaders come back empty, and the old fallback substituted the response's own headers. Those carry no Referer, so proxy/CDN hosts that enforce hotlink protection returned 403 on every probe and pull.
Record the real outgoing headers from requestWillBeSent (Referer, User-Agent, sec-ch-*) by request ID and hand them to the response handler, so a stream confirmed by MIME is fetched with the same headers the browser used.
Fixes #14