Skip to content

httpuv claims to handle NULL body #11

Description

@nteetor

Line 202 of httpuv/httpuv.cpp claims that NULL is valid value for "body" in the list returned by $call(). However, I know this is not true, for one reason or another. See the below example,

demo_app <- list(
  call = function(req) {
    if (req$PATH_INFO == '/null_body') {
      list(
        status = 200L,
        headers = list(
          'Connection' = 'close'
        ),
        body = NULL
      )
    } else {
      list(
        status = 404L,
        headers = list(
          'Content-Type' = 'text/plain'
        ),
        body = paste(req$PATH_INFO, 'not found')
      )
    }
  }
)

httpuv::runServer('127.0.0.1', 3030, demo_app)

If you navigate to localhost:3030/null_body the httpuv server will crash with an Rcpp error. I have not raised an httpuv issue yet as I do not have the location of the bug. Once I can confirm this is truly an httpuv issue I will raise an issue with httpuv.

Although I have been working around this bug for some time, I raise this issue now because I just came across httpuv's claim on line 202.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions