Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Stored cached responses ignore non 200 status codes

Đang mở
#159 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
backend, databases

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Java
Star
68
Fork
39
Merge trung bình
2 ngày 43 phút
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của eclipse-vertx/vertx-http-proxy

Tất cả issue của eclipse-vertx/vertx-http-proxy

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.