Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect handling of resumable upload responses without a range header #7835

Closed
coryan opened this issue Jan 6, 2022 · 0 comments · Fixed by #7877
Closed

Incorrect handling of resumable upload responses without a range header #7835

coryan opened this issue Jan 6, 2022 · 0 comments · Fixed by #7877
Assignees
Labels
api: storage Issues related to the Cloud Storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@coryan
Copy link
Contributor

coryan commented Jan 6, 2022

The client library treats 308 responses as an unrecoverable error:

std::uint64_t new_next_byte = session_->next_expected_byte();

which can be triggered from here:

auto r = response.headers.find("range");
if (r == response.headers.end()) {
std::ostringstream os;
os << __func__ << "() missing range header in resumable upload response"
<< ", response=" << response;
result.annotations += " " + std::move(os).str();
return result;
}

However the spec allows for an empty range header:

If Cloud Storage has not yet persisted any bytes, the 308 response does not have a Range header. In this case, you should start your upload from the beginning.

https://cloud.google.com/storage/docs/performing-resumable-uploads

@coryan coryan added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: storage Issues related to the Cloud Storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Jan 6, 2022
@coryan coryan self-assigned this Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant