Skip to content

Build resumable upload Location from the request host - #528

Open
ymatrix1 wants to merge 1 commit into
goccy:mainfrom
ymatrix1:fix/resumable-upload-location-host
Open

ymatrix1 wants to merge 1 commit into
goccy:mainfrom
ymatrix1:fix/resumable-upload-location-host

Conversation

@ymatrix1

Copy link
Copy Markdown

The resumable upload session URL (Location header of POST /upload/bigquery/v2/projects/<p>/jobs?uploadType=resumable) was built from the server's listen address. With --host=0.0.0.0 (the usual Docker setup) clients then PUT to http://0.0.0.0:9050/upload/..., which fails on Windows with WinError 10049 (address not valid); e.g. the Python client's load_table_from_file / dbt seed.

This builds the URL from the scheme and Host the client actually used (honoring X-Forwarded-Proto), falling back to the listen address only when the request has no Host.

Regression test TestResumableUploadLocationUsesRequestHost fails before the change (Location = "http:/upload/..." under the test server) and passes after.

With --host=0.0.0.0 the session URL pointed at http://0.0.0.0:9050, which
clients on Windows cannot connect to (WinError 10049). Use the scheme and
Host of the incoming request (honoring X-Forwarded-Proto), falling back to
the listen address only when the request has no Host.
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