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

Abierto
#267 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
38/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
c, r
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C
Estrellas
252
Forks
87
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rstudio/httpuv

Todos los issues de rstudio/httpuv

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.