Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpuv claims to handle NULL body #11

Open
nteetor opened this issue Sep 18, 2015 · 0 comments
Open

httpuv claims to handle NULL body #11

nteetor opened this issue Sep 18, 2015 · 0 comments

Comments

@nteetor
Copy link
Owner

nteetor commented Sep 18, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant