Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Stored cached responses ignore non 200 status codes

Abierto
#159 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java

Línea de trabajo

Start by tracing how the cache stores a response and restores it on a cache hit; the issue does not name implementation files or tests. Check where the original status code is preserved and compare the first response with the cached response in the reproducer. Done means cached 203 and 206 responses retain their status codes; add or update a regression test for a cached 206 response.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug
Version

5.x and 4.x

Context

Stored response upon HIT always override status code to 200. That is a problem for other successful cached responses (e.g. 203 and 206).

Steps to reproduce

JBang reproducer:

///usr/bin/env jbang "$0" "$@"
//DEPS io.vertx:vertx-core:5.2.0
//DEPS io.vertx:vertx-http-proxy:5.2.0
//DEPS io.vertx:vertx-web-client:5.2.0

import io.vertx.core.Vertx;
import io.vertx.core.http.HttpHeaders;
import io.vertx.ext.web.client.WebClient;
import io.vertx.httpproxy.HttpProxy;
import io.vertx.httpproxy.ProxyOptions;
import io.vertx.httpproxy.cache.CacheOptions;

public class cache_206_bug {

  public static void main(String[] args) throws Exception {
    Vertx vertx = Vertx.vertx();

    vertx.createHttpServer()
        .requestHandler(req -> req.response()
            .setStatusCode(206)
            .putHeader(HttpHeaders.CACHE_CONTROL, "public, max-age=3600")
            .putHeader(HttpHeaders.CONTENT_RANGE, "bytes 0-99/1000")
            .putHeader(HttpHeaders.CONTENT_TYPE, "video/mp4")
            .end("partial content"))
        .listen(8081)
        .await();

    HttpProxy proxy = HttpProxy.reverseProxy(
        new ProxyOptions().setCacheOptions(new CacheOptions()),
        vertx.createHttpClient()).origin(8081, "localhost");

    vertx.createHttpServer()
        .requestHandler(proxy)
        .listen(8080)
        .await();

    WebClient client = WebClient.create(vertx);

    var resp1 = client.get(8080, "localhost", "/video").send().await();
    System.out.println("Request 1 Status: " + resp1.statusCode()); // returns 206

    Thread.sleep(1000);

    var resp2 = client.get(8080, "localhost", "/video").send().await();
    System.out.println("Request 2 Status: " + resp2.statusCode()); // returns 200, should be 206
    vertx.close().await();
  }
}
Do you have a reproducer?

No response

Lenguaje dominante
Java
Estrellas
68
Forks
39
Merge medio
2 d 43 min
PR fusionados (30 d)
5

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de eclipse-vertx/vertx-http-proxy

Todos los issues de eclipse-vertx/vertx-http-proxy

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.