Failed HEAD request drops Retry-After and the error code and message

Aperta Adatta ai principianti
#247 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
api, networking

Direzione di ricerca

Inizia in httpclient/src/main/java/com/backblaze/b2/client/webApiHttpClient/B2WebApiHttpClientImpl.java: leggi il ramo else per le risposte non 200 in head(), intorno alla riga 178, e confrontalo con il percorso POST alla riga 286, con extractExceptionFromErrorResponse e con getRetryAfterSecondsOrNull (circa righe 303-314). Fai in modo che gli errori di HEAD riportino codice di errore, messaggio e Retry-After nello stesso modo di POST. Il lavoro è completo quando un 503 simulato con Retry-After: 7 su una HEAD restituisce un getRetryAfterSecondsOrNull() pari a 7 e un codice di errore e un messaggio valorizzati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Java
Stelle
103
Fork
23
Merge medio
5g 8h
PR unite (30g)
3

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Backblaze/b2-sdk-java

Tutte le issue di Backblaze/b2-sdk-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.