Header Parsing Error
See original GitHub issueOperation Azure BlockBlobService save operation
Expected Result Operation completed with no errors
Actual Result Sometimes a HeaderParsingError is raised
Versions
Running in docker container image python:3.6.3-jessie
pip freeze
azure==2.0.0
azure-storage==0.34.3
azure-storage-blob==1.0.0
Relevant Information
Running the following code:
from azure.storage.blob import BlockBlobService
service = BlockBlobService(account_name, account_key)
...
self.service.create_blob_from_bytes(self.container_name,
blob_name=ref_id, blob=compressed_data, metadata=metadata)
Sometimes produces this error:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py",
line 398, in _make_request
assert_header_parsing(httplib_response.msg)
File "/usr/local/lib/python3.6/site-packages/requests/packages/urllib3/util/response.py",
line 66, in assert_header_parsing
raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data)
requests.packages.urllib3.exceptions.HeaderParsingError: [
StartBoundaryNotFoundDefect(),
MultipartInvariantViolationDefect()], unparsed data: ''
Relevant header info:
Receiving Response: Server-Timestamp=Thu, 08 Feb 2018 20:43:09 GMT,
Server-Request-ID=*guid*, HTTP Status Code=201, Message=Created,
Headers={
'x-ms-blob-type': 'BlockBlob',
'x-ms-lease-id': None,
'If-Modified-Since': None,
'If-Unmodified-Since': None,
'If-Match': None,
'If-None-Match': None,
'x-ms-meta-encoding': 'application/json',
'x-ms-meta-compression': 'gzip',
'Content-Length': '547',
'x-ms-version': '2017-04-17',
'User-Agent': 'Azure-Storage/1.0.0-1.0.0
(Python CPython 3.6.3; Linux 4.9.60-linuxkit-aufs)',
'x-ms-client-request-id': '*guid*',
'x-ms-date': 'Thu, 08 Feb 2018 20:43:09 GMT',
'Authorization': 'SharedKey myusername:mykey'}
For now, I have a try/except block around the creation catching HeaderParsingError to ignore it. Is this safe to do? Is there a way to prevent the error at all?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to resolve parse error when HTTP content-type header is ...
In order to resolve this issue, one can use one of the following methods to set the HTTP content-type header with correct value:...
Read more >Tomcat 7.0.43 "INFO: Error parsing HTTP request header"
If there are too many cookies cached, it breaks the server (the size of a request header is too big ...
Read more >Tomcat Resolve "Error parsing HTTP request header" - FreeKB
"Error parsing HTTP request header" appears in catalina.log. 26-Jul-2022 01:13:52.454 INFO [tomcat-http--27] org.apache.coyote.http11.
Read more >Tomcat 8 HTTP header parsing error - Server Fault
This error normaly is caused when you try to do a https request to a port that only accept http. I'm not sure...
Read more >Parse Error: Header overflow · Issue #8656 - GitHub
Since Version 7 of Postman I am experiencing an issue with header size from Some Huawei cloud service APIs. The error manifests itself...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @dagrooms52, I really apologize for the confusion and inconvenience. The
azure
mega-package is installing the old deprecatedazure-storage
, so I’ve created a PR to fix that. Thanks for raising the issue here.As for the table service, you should definitely use azure-cosmosdb-table. As for the import error
ImportError: cannot import name '_to_int'
, I think that it is because azure-cosmosdb-table is depending on an older version of azure-storage-common, and when you installed azure-cosmosdb-table it overwrote the new/correct azure-storage-common (1.1.0). I’ve created an issue on their repo to fix this problem.Thanks to your issue I realized that it was not a very nice experience installing/using the storage packages along with other azure packages. I’ll be more mindful in the future. Thank you!
Please let me know if you are still encountering problems.
I’m now getting an error when importing both the TableService and the BlobService in the same file (I don’t actually do this, I import both of the wrappers I’ve made for these services, which in turn import the services, but I’m not doing
import *
).It appears that the name
_to_int
is imported into the scope by both of these modules, and they are stepping on each other.