Skip to content

fix(webhdfs): fix WebHDFS provider to handle requests without Range header#90

Merged
rexzhang merged 5 commits intorexzhang:mainfrom
SilviaSWR:fix/webhdfs-handle-no-range
Feb 20, 2026
Merged

fix(webhdfs): fix WebHDFS provider to handle requests without Range header#90
rexzhang merged 5 commits intorexzhang:mainfrom
SilviaSWR:fix/webhdfs-handle-no-range

Conversation

@SilviaSWR
Copy link
Copy Markdown
Contributor

Checklist

  • I have read the contribution guidelines
  • One Feature(issus) One PR
  • All commits in the PR will be merged into a single commit.
  • Add an entry in changelog.en.md if necessary? Don't forget to add your name and github profile link!
  • Add / update tests if necessary, Don't missing.
  • Add new / update outdated documentation

Description

This PR fixes the WebHDFS provider to correctly handle requests without a Range header.
Previously, if a request did not include the Range header, the provider would raise an exception when range support was enabled. This breaks the expected behavior where a request without a Range should download the entire file.

With this change, the WebHDFS provider:

  • Gracefully handles requests with no Range header
  • Downloads the full file if the user did not specify a range
  • Preserves existing range support functionality for partial downloads

fixes #88

@SilviaSWR
Copy link
Copy Markdown
Contributor Author

This contribution has received funding from the Spanish government (grant EQC2021-007479-P, funded by MCIN/AEI/10.13039/501100011033), the EU NextGeneration/PRTR (PRTR-C17.I1), and the Generalitat de Catalunya.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.02%. Comparing base (6e48e98) to head (fcd503c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #90      +/-   ##
==========================================
+ Coverage   75.79%   76.02%   +0.22%     
==========================================
  Files          26       26              
  Lines        3772     3774       +2     
==========================================
+ Hits         2859     2869      +10     
+ Misses        913      905       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SilviaSWR
Copy link
Copy Markdown
Contributor Author

It would be really useful if you could create a new release including these two WebHDFS fixes:

Thank you!

@rexzhang
Copy link
Copy Markdown
Owner

please fix:

  • codecov/patch to 100%
  • RuntimeWarning: Failed to access the underlying source code for analysis. Was ic() invoked in a REPL (e.g. from the command line), a frozen application (e.g. packaged with PyInstaller), or did the underlying source code change during execution?

@rexzhang
Copy link
Copy Markdown
Owner

It would be really useful if you could create a new release including these two WebHDFS fixes:

* [DAVTime fails with WebHDFS timestamps in milliseconds #87](https://github.com/rexzhang/asgi-webdav/issues/87)

* [WebHDFS fails on no-Range requests #88](https://github.com/rexzhang/asgi-webdav/issues/88)

Thank you!

Okay, no problem.

@SilviaSWR
Copy link
Copy Markdown
Contributor Author

All set on my side, should be good now.

@rexzhang
Copy link
Copy Markdown
Owner

These error alerts seriously interfere with other people's development tests, please fix pytest error:

[2](https://github.com/rexzhang/asgi-webdav/actions/runs/22093632849/job/63844899535?pr=90#step:7:53)
  /home/runner/work/asgi-webdav/asgi-webdav/asgi_webdav/provider/webhdfs.py:123: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    response.raise_for_status()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_provider_webhdfs.py::test_do_get_file
tests/test_provider_webhdfs.py::test_do_get_file_non_range
  /opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/events.py:94: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    self._context.run(self._callback, *self._args)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_provider_webhdfs.py::test_do_delete_success
  /home/runner/work/asgi-webdav/asgi-webdav/asgi_webdav/provider/webhdfs.py:353: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    response.raise_for_status()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_provider_webhdfs.py::test_do_put
  /home/runner/work/asgi-webdav/asgi-webdav/asgi_webdav/provider/webhdfs.py:373: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    response.raise_for_status()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_provider_webhdfs.py::test_do_put
  /home/runner/work/asgi-webdav/asgi-webdav/asgi_webdav/provider/webhdfs.py:380: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    response.raise_for_status()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_provider_webhdfs.py::test_do_move
  /home/runner/work/asgi-webdav/asgi-webdav/asgi_webdav/provider/webhdfs.py:419: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    response.raise_for_status()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_provider_webhdfs.py::test_do_move
  /home/runner/work/asgi-webdav/asgi-webdav/asgi_webdav/provider/webhdfs.py:434: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    resp.raise_for_status()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

@SilviaSWR
Copy link
Copy Markdown
Contributor Author

All the warnings related to the WebHDFS provider have been addressed.

@rexzhang
Copy link
Copy Markdown
Owner

All the warnings related to the WebHDFS provider have been addressed.

still...

=============================== warnings summary ===============================
tests/test_provider_webhdfs.py::test_do_get_file
tests/test_provider_webhdfs.py::test_do_get_file_non_range
  /opt/hostedtoolcache/Python/3.14.2/x64/lib/python3.14/asyncio/events.py:94: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    self._context.run(self._callback, *self._args)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_provider_webhdfs.py::test_do_put
  /home/runner/work/asgi-webdav/asgi-webdav/asgi_webdav/provider/webhdfs.py:373: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    response.raise_for_status()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_provider_webhdfs.py::test_do_put
  /home/runner/work/asgi-webdav/asgi-webdav/asgi_webdav/provider/webhdfs.py:380: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    response.raise_for_status()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_provider_webhdfs.py::test_do_mkcol
tests/test_provider_webhdfs.py::test_do_propfind
tests/test_provider_webhdfs.py::test_do_head
tests/test_provider_webhdfs.py::test_do_precheck_destination
  /home/runner/work/asgi-webdav/asgi-webdav/asgi_webdav/provider/webhdfs.py:123: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    response.raise_for_status()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_provider_webhdfs.py::test_do_move
  /home/runner/work/asgi-webdav/asgi-webdav/asgi_webdav/provider/webhdfs.py:419: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    response.raise_for_status()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_provider_webhdfs.py::test_do_move
  /home/runner/work/asgi-webdav/asgi-webdav/asgi_webdav/provider/webhdfs.py:434: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    resp.raise_for_status()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

try pytest-mock, You can refer to def test_get_timezone(mocker): in tests/test_helpers.py and async def test_get(self, mocker): in tests/test_lock.py

@SilviaSWR SilviaSWR force-pushed the fix/webhdfs-handle-no-range branch from 4fd2c30 to fcd503c Compare February 20, 2026 13:59
@SilviaSWR
Copy link
Copy Markdown
Contributor Author

All the warnings have been addressed.

@rexzhang rexzhang merged commit 52018c2 into rexzhang:main Feb 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebHDFS fails on no-Range requests

2 participants