Failed HEAD request drops Retry-After and the error code and message
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- java
- Domain
- api, networking
Research direction
Start in httpclient/src/main/java/com/backblaze/b2/client/webApiHttpClient/B2WebApiHttpClientImpl.java: read the non-200 else branch in head() around line 178 and compare it with the POST path at line 286, extractExceptionFromErrorResponse, and getRetryAfterSecondsOrNull (around lines 303-314). Make HEAD failures carry the error code, message and Retry-After the way POST does. Done when a mocked 503 with Retry-After: 7 on a HEAD yields getRetryAfterSecondsOrNull() of 7 and a populated error code and message.
Written by the indexing model from the issue text.
Description
What happens
When B2WebApiHttpClientImpl.head() gets a status other than 200, it throws B2Exception.create(null, statusCode, null, ""). The error has no code and an empty message, and the Retry-After header is ignored, so a 429 or 503 on a HEAD request is retried with the default delay rather than the server's. The POST path keeps all of these.
Where
httpclient/src/main/java/com/backblaze/b2/client/webApiHttpClient/B2WebApiHttpClientImpl.java:178 (head); compare :286 and :303-314 (getRetryAfterSecondsOrNull) used by the POST path.
Why it matters
Impact: Wrong request or result (a poorer error and wrong retry delay), loud. Severity: High, because it happens on every failed HEAD request (normal path for errors), and there is no workaround besides reading the status code from the exception.
How to check
Found by reading the code, not reproduced. Read the else branch in head() and compare it with extractExceptionFromErrorResponse. A test with a mock HTTP client returning 503 with Retry-After: 7 on a HEAD should show getRetryAfterSecondsOrNull() as null.
Version
Seen at v6.5.0. Present on the default branch: present.
- Dominant language
- Java
- Stars
- 103
- Forks
- 23
- Avg merge
- 5d 8h
- Merged PRs (30d)
- 3
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Backblaze/b2-sdk-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Backblaze/b2-sdk-java#248 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Backblaze/b2-sdk-java#246 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Backblaze/b2-sdk-java#245 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Backblaze/b2-sdk-java#242 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Backblaze/b2-sdk-java#241 ·
Maintainers usually reply within 3 days
All issues in Backblaze/b2-sdk-java
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
IETF-Hackathon/pqc-certificates#351 ·
Maintainers usually reply within 2 days
-
hermes-queue
Difficulty 2/5 Under an hour Newbie friendliness 72/100
chrisalunlloyd2-sudo/mindpalace#393 ·
Maintainers usually reply within 1 day
-
core-types enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
higher-kinded-j/higher-kinded-j#1509 ·
Maintainers usually reply within 1 day