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

Aberta Para iniciantes
#2,356 2 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
62/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
c
Domínio
backend

Direção de pesquisa

Comece pela verificação de rota em src/ext_http.c, onde o byte após o prefixo registrado deve ser / ou o fim do caminho. Reproduza com um único registro http_static of ["/s1/", "files"] e um GET para /s1/a.txt, que deve retornar 404. Escolha um dos dois resultados que a issue permite, ou corresponder à forma com barra final ou rejeitá-la no registro, e registre a escolha em docs/BUILTINS.md. Está concluído quando as duas grafias estiverem cobertas por um teste que inicia um servidor e busca um arquivo.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
C
Estrelas
3
Forks
7
Merge médio
3h 30min
PRs com merge (30d)
264

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de InauguralSystems/EigenScript

Todas as issues de InauguralSystems/EigenScript

Issues semelhantes

Mais issues de C

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.