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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: MediaIoBaseDownload range header off-by-one #1595

Merged

Conversation

jvtm
Copy link
Contributor

@jvtm jvtm commented Nov 8, 2021

Issue: It looks like Range header end value was constructed by adding chunk size to
current position. This leads into the request being one byte longer, and also
the received response body is one byte longer than anticipated.

Fix: adjust the end to be one byte earlier.

For example with chunksize=1024 and current position being 0, the range header
should be set to bytes=0-1023.

See: https://httpwg.org/specs/rfc7233.html#rule.ranges-specifier

Fixes #1593


Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #1593 馃

@jvtm jvtm requested a review from as a code owner Nov 8, 2021
@google-cla google-cla bot added the cla: no label Nov 8, 2021
Issue: It looks like Range header end value was constructed by adding chunk size to
current position. This leads into the request being one byte longer, and also
the received response body is one byte longer than anticipated.

Fix: adjust the end to be one byte earlier.

For example with `chunksize=1024` and current position being 0, the range header
should be set to `bytes=0-1023`.

See: https://httpwg.org/specs/rfc7233.html#rule.ranges-specifier

Resolves: googleapis#1593
@jvtm jvtm force-pushed the fix-mediaiobasedownload-range-header branch from 4262b62 to d9777dc Compare Nov 9, 2021
@google-cla google-cla bot added cla: yes and removed cla: no labels Nov 9, 2021
@parthea parthea added kokoro:force-run kokoro:run labels Nov 11, 2021
@parthea
Copy link
Contributor

@parthea parthea commented Nov 11, 2021

Thanks for the fix @jvtm !

@parthea parthea added automerge: exact kokoro:force-run kokoro:run and removed kokoro:force-run kokoro:run labels Nov 11, 2021
@yoshi-kokoro yoshi-kokoro removed kokoro:run kokoro:force-run labels Nov 11, 2021
@gcf-merge-on-green gcf-merge-on-green bot merged commit 4b73b2e into googleapis:main Nov 11, 2021
11 checks passed
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge: exact label Nov 11, 2021
gcf-merge-on-green bot pushed a commit that referenced this issue Nov 16, 2021
馃 I have created a release \*beep\* \*boop\*
---
## [2.31.0](https://www.github.com/googleapis/google-api-python-client/compare/v2.30.0...v2.31.0) (2021-11-16)


### Features

* **bigtableadmin:** update the api be7ffcc ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **chromemanagement:** update the api 59c9799 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **cloudasset:** update the api 60f5758 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **cloudfunctions:** update the api c517033 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **contactcenterinsights:** update the api 9ac9faa ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **containeranalysis:** update the api 618985b ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **datapipelines:** update the api a39bb0f ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **datastore:** update the api 5050adb ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **dialogflow:** update the api fd46c12 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **documentai:** update the api 3ba3182 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **drive:** update the api b1840b0 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **file:** update the api b13a249 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **gkehub:** update the api 37cce48 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **healthcare:** update the api 8d1f955 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **metastore:** update the api 9c90df7 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **monitoring:** update the api bf890b6 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **mybusinessbusinessinformation:** update the api 90e206c ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **paymentsresellersubscription:** update the api c879654 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **recaptchaenterprise:** update the api ff95700 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **recommender:** update the api d85fe38 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **securitycenter:** update the api 35a6d4e ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **speech:** update the api 13f1bcb ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **sqladmin:** update the api 770bc14 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **tpu:** update the api ea30e3a ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))
* **vmmigration:** update the api 80e2090 ([815c1ac](https://www.github.com/googleapis/google-api-python-client/commit/815c1ac7e3f7c7ea6df920645adb8cba84b05c22))


### Bug Fixes

* MediaIoBaseDownload range header off-by-one ([#1595](https://www.github.com/googleapis/google-api-python-client/issues/1595)) ([4b73b2e](https://www.github.com/googleapis/google-api-python-client/commit/4b73b2e9d53e63404c8800f2a2b3f1ee86680815))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants