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

オープン 初心者向け
#2,356 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c
領域
backend

調査の方向性

src/ext_http.c のルートチェックから始めます。ここでは、登録されたプレフィックスの直後のバイトが / であるか、パスの終端である必要があります。単一の http_static of ["/s1/", "files"] 登録と、/s1/a.txt への GET で再現します。結果は 404 になるはずです。issue が認めている 2 つの結果のうち、末尾スラッシュ付きの形式に合わせるか、登録時に拒否するかのいずれかを選び、その選択を docs/BUILTINS.md に記録してください。完了の条件は、両方の書き方を、サーバーを起動してファイルを取得するテストでカバーすることです。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
C
スター
3
フォーク
7
平均マージ
3時間 30分
マージ済み PR(30日)
264

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

InauguralSystems/EigenScript のほかの issue

InauguralSystems/EigenScript の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。