http_static: a prefix with a trailing slash matches no file, and nothing says so

Đang mở Phù hợp với người mới
#2,356 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

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

Hướng nghiên cứu

Bắt đầu từ kiểm tra route trong src/ext_http.c, nơi byte sau tiền tố đã đăng ký phải là / hoặc là cuối đường dẫn. Tái hiện lỗi bằng một đăng ký duy nhất http_static of ["/s1/", "files"] và một yêu cầu GET tới /s1/a.txt, yêu cầu này cần trả về 404. Chọn một trong hai kết quả mà issue cho phép: hoặc khớp với dạng có dấu gạch chéo cuối, hoặc từ chối ngay khi đăng ký, rồi ghi lại lựa chọn trong docs/BUILTINS.md. Hoàn thành khi cả hai cách viết đều được bao phủ bởi một test khởi động server và tải về một tệp.

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

Mô tả

area:http kind:bug

Found by a consumer's HTTP server at 54008422.

What happens

http_static of [prefix, dir] serves the files of dir under prefix. A prefix written with a trailing slash matches no file. With files/a.txt present:

http_static of ["/s1/", "files"]
http_serve of 3000

GET /s1/a.txt answers 404 ({"error": "not_found"}). The same program with the prefix "/s1" answers 200. The route check in src/ext_http.c asks that the byte after the whole prefix be / or the end of the path, and after /s1/ the next byte is the file's first letter.

Why it matters

Both spellings are common, nothing is printed at registration, and the 404 is the same one an unknown path gets. A page that loads its script from such a prefix simply has no script.

Done when

  • http_static with a trailing slash on the prefix serves the same files as without it, or refuses the prefix at registration with an error that names it.
  • docs/BUILTINS.md says which form the prefix takes.
  • A test starts one server for each spelling and fetches a file under it.

Corrected 2026-11-12. The first text of this issue registered both spellings in one program and read the 404 for /s1/ there. That program cannot show it: a second http_static replaces the first (#2357), so /s1/ would have answered 404 with or without its slash. The single registration above was run afterwards and answers 404 as described.

Ngôn ngữ chính
C
Star
3
Fork
7
Merge trung bình
3 giờ 30 phút
Pull request đã merge (30 ngày)
264

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

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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 InauguralSystems/EigenScript

Tất cả issue của InauguralSystems/EigenScript

Issue tương tự

Thêm issue về C

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.