Skip to content

Support S3-compatible presigned URL demo upload (HTTP PUT) - #387

Open
FlowingSPDG wants to merge 1 commit into
shobhit-pathak:devfrom
FlowingSPDG:feature/demo-s3-presigned-upload
Open

FlowingSPDG wants to merge 1 commit into
shobhit-pathak:devfrom
FlowingSPDG:feature/demo-s3-presigned-upload

Conversation

@FlowingSPDG

@FlowingSPDG FlowingSPDG commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Hello there. It's been while since I was away from CS2.
I've added demo upload feature for supporting S3 style object storage such as AWS S3 or Cloudflare R2.

Summary

Implements issue #378: optional HTTP PUT of raw .dem bytes to matchzy_demo_upload_url (e.g. S3 / R2 presigned URL), avoiding intermediary POST body limits for large demos.

Changes

  • New cvars: matchzy_demo_upload_s3 / get5_demo_upload_s3 (default: false)
  • When enabled: PUT with Content-Type: application/octet-stream, streaming upload, extended timeout; no MatchZy/Get5 metadata headers (SigV4-safe)
  • Documentation + sample config.cfg + changelog

Usage

matchzy_demo_upload_url "<presigned-put-url>"
matchzy_demo_upload_s3 1

Presigned URL should be generated with Content-Type: application/octet-stream to match the client.

Made with Cursor

- Add matchzy_demo_upload_s3 / get5_demo_upload_s3 cvars
- Stream PUT with application/octet-stream; omit custom headers for SigV4
- Extend HttpClient timeout for large demos
- Docs, sample config, changelog

Made-with: Cursor
@FlowingSPDG
FlowingSPDG marked this pull request as ready for review April 10, 2026 17:47
mrc4tt added a commit to mrc4tt/MatchZy that referenced this pull request Aug 1, 2026
Port upstream's demo upload plus upstream PR shobhit-pathak#387 (S3-compatible presigned
URLs) onto the fork, which stopped the recording with tv_stoprecord but had
no upload path at all.

matchzy_demo_upload_s3 switches UploadFileAsync from the panel POST (metadata
headers + byte body) to a plain HTTP PUT streaming the .dem as the request
body, which is what a presigned S3 URL expects. The MatchZy-/Get5- headers are
deliberately not sent on that path, since unsigned headers break SigV4.

Three fixes on top of the upstream PR:

- The POST path reused _sharedHttpClient, whose 10s timeout is sized for event
  publishing. A demo runs to hundreds of MB, so every real upload was cancelled
  mid-transfer. Both paths now use a dedicated client (2h for S3, 30m for POST).
- "matchzy_demo_upload_s3 1" could never enable the flag: bool.TryParse rejects
  "1", and the fallback ANDed against the current value, which defaults false.
  Accept 1/0 alongside true/false, and treat an empty argument as a no-op.
- Dropped a leftover File.OpenRead on the POST path whose stream was never read.

matchzy_demo_upload_s3 is surfaced in the config.cfg template so it reaches
existing servers through MergeMissingConfigCvars. The upload URL and auth
header stay convar-only and are documented as a comment instead: a presigned
URL and a token are credentials, and config.cfg is world readable.

UploadFileAsync now returns success so StopDemoRecording can fire
demo_upload_ended, an event the fork already declared but never sent. The
upload settings are snapshotted on the main thread before the Task.Run.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant