Fix tap for the chunked transfer encoding #251
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the issue Daiquri had with TOPCAT. It was impossible to use the TAP_UPLOAD feature because TOPCAT is sending chunked request which was not supported in Daiquiri.
For now I've limited the fix to the requests sent to
/tap/...
to avoid any surprises for other modules.One important caveat of this fix - it only works with gunicorn because it provides access to the de-chunked body of the request. It doesn't work with the Django development server and I'm not sure about the compatibility with other servers.
Along with the changes in tap, I refactored some other code:
human2bytes
returns only an integer (before it was float, Literal, None) or raises an exceptionmake_query_dict_upper_case
uses a mutable QueryDict instead of copying the dict. There was an issue with copying if the request was bigger than 2.5 MB.I'm not 100% happy with the solution since it requires gunicorn but for now I don't have anything better in mind. I'm open to suggestions.