Silent failure when staticPaths points to a file instead of a directory

Aperta
#267 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
c, r
Ambito
backend

Direzione di ricerca

Start with the staticPaths and staticPathOptions handling used by startServer, then reproduce the /foo/bar request with the example app and curl. Determine how a file-valued static path is handled, and make the behavior report an explicit error instead of failing silently; verify the request no longer produces an unexplained 500.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Given this app:

app <- list(
  call = function(req) {
    list(status = 404L,
         headers = list('Content-Type' = 'text/plain'),
         body = "Not found")
  },
  staticPaths = list(
    "/foo" = "foo.html"
  ),
  staticPathOptions = staticPathOptions(fallthrough = TRUE)
)
s <- startServer('127.0.0.1', 31337, app)

Any attempts to fetch a subpath under /foo will fail silently:

$ curl -v http://localhost:31337/foo/bar
*   Trying 127.0.0.1:31337...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 31337 (#0)
> GET /foo/bar HTTP/1.1
> Host: localhost:31337
> User-Agent: curl/7.66.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 Internal Server Error
< Date: Fri, 08 May 2020 02:20:02 GMT
< Content-Length: 26
< 
500 Internal Server Error
* Connection #0 to host localhost left intact

There is no error in the R console when this request is made.

This may not be a bug per se, but if specifying a file instead of a directory in staticPaths is not allowed, I would have expected some sort of error telling me so. Let me know if I can provide any further information.

Lingua principale
C
Stelle
252
Fork
87
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rstudio/httpuv

Tutte le issue di rstudio/httpuv

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.