Comments (3)
I'm assuming that the bucket you were trying to write to was a newly created bucket?
In that case, you can receive a temporary redirect (307) when you try to access the bucket because the DNS records that have to be created to resolve the bucket using virtual-hosted addressing have not yet propagated throughout the network.
This 307 redirect should, however, contain a Location header. Are you sure there was no location header present?
from botocore.
Did more digging into this. You do get a location header with the region specific endpoint (bucket.s3region.amazonaws.com), but the problem is that the fileobj has been exhausted so .read()
returns nothing. When you send the request to the new location it waits for content-length
bytes, but eventually s3 closes the socket on their end.
Does requests provide anything to rewind a stream? Is this something we could do before requests retries the request?
from botocore.
I spent more time researching this and have a few observations:
- The ideal way to handle this would be through an
Expect: 100-continue
header. From the research I've done it seems likehttplib
does not properly support this. It will handle a 100 continue response but it already sends the body. I also double checked that requests/urllib3 does not support 100 continue. - The requests library has a hook when a request is received, this includes redirect responses. We could add a hook that
.seek(0)
's the body on redirects, otherwise it raises an error if it's not seekable. The only downside here is that we're potentially sending part of the body twice.
The reason I'd like to get this implemented is for better memory utilization in this branch of the CLI: https://github.com/jamesls/aws-cli/compare/memory-utilization
This branch is ready to go, except that by switching from bytearrays to file objects, we run into this issue here.
from botocore.
Related Issues (20)
- SSO OIDC client should not attempt to contact AWS metadata HOT 4
- "TypeError: can't compare offset-naive and offset-aware datetimes" when fetching credentials via iam-role HOT 14
- Identical data is loaded into every session wasting memory HOT 3
- client.py : _resolve_endpoint_ruleset returns 3 values instead of 2 HOT 3
- Lambda python 3.11 does not start with current boto 1.33.2 HOT 29
- ImportError: cannot import name 'is_s3express_bucket' from 'botocore.utils' HOT 3
- botocore using deprecated datetime.datetime.utcnow() call HOT 2
- Bucket validation cannot handle project:bucketname syntax for openstack type of s3 HOT 2
- route53resolver endpoints have incorrect required argument: CreatorRequestId HOT 6
- SageMaker client's FIPS endpoint incorrect in us-gov-west-1 HOT 2
- botocore does not ignore credential_process when that configuration value is blank (empty string)
- get_available_regions does not return ec2 for the new region ca-west-1 HOT 5
- ImportError: cannot import name 'is_s3express_bucket' from 'botocore.utils' python 3.9 HOT 3
- Credentials JSONFileCache explodes if cache file has malformed JSON HOT 1
- Add 'readinfo' shim to botocore.response.StreamingBody HOT 1
- Allow $AWS_PROFILE to be blank
- When uploading, checking 'Expect' header results in "TypeError: sequence item 0: expected str instance, bytes found" HOT 46
- Support urllib3 2.1.0 and 2.2.0 to be installed HOT 2
- Add pagination support for App Runner ListServices HOT 2
- ExpiredTokenException: Error when retrieving credentials from container-role HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from botocore.