jeffreyhorner / Rook

A web server interface for R
161 stars 30 forks source link

cookies() method fails to work with too many cookies #26

Open hughjonesd opened 9 years ago

hughjonesd commented 9 years ago

After some number of cookies is set (for me, about 20-30), cookies() stops returning the truth and starts returning an empty list. Test case below. Run and hit refresh in your browser until you get 0. Then check that in fact your browser has (and is sending) the right number of cookies. Tested in Firefox and Chrome.

library(Rook)

app <- function (env) {
  r <- Rook::Request(env)
  cookies <- r$cookies()
  res <- Rook::Response$new()
  res$set_cookie(paste0("foo", sample(100000,1)), paste0("bar",sample(100000,1)))
  res$write("<html><body>");
  res$write(paste("I can see", length(cookies), "cookies in your last request.. 
    adding another one with random name  and content</body></html>"))
  res$finish()
}

svr <- Rhttpd$new()
rhapp <- RhttpdApp$new(name="cookies", app=app)
svr$add(rhapp)
require(tools)
svr$start(port=35538)

Rook packageVersion: 1.1.1. R version: 3.1.1.

jeffreyhorner commented 9 years ago

This seems to be a bug in R 3.1.1 Rhttpd handling of headers, although I can't verify for sure. Can you try with R devel?

hughjonesd commented 9 years ago

hmm... tried with R-devel of today, and it now does not recognize ANY cookies at all. The script I wrote just reports "0 cookies" all the time.

I also tried with R 3.1.2 and got the same behaviour as with R 3.1.1.

David

On 12 December 2014 at 21:49, jeffreyhorner notifications@github.com wrote:

This seems to be a bug in R 3.1.1 Rhttpd handling of headers, although I can't verify for sure. Can you try with R devel?

— Reply to this email directly or view it on GitHub https://github.com/jeffreyhorner/Rook/issues/26#issuecomment-66840698.

hughjonesd commented 9 years ago

oops, that's not quite correct. I hadn't cleared my cookie cache. the behaviour with R-devel is the same as with R 3.1.2: on my particular machine, it will report up to 37 cookies, then starts to report 0 cookies.

David

On 13 December 2014 at 20:58, David Hugh-Jones davidhughjones@gmail.com wrote:

hmm... tried with R-devel of today, and it now does not recognize ANY cookies at all. The script I wrote just reports "0 cookies" all the time.

I also tried with R 3.1.2 and got the same behaviour as with R 3.1.1.

David

On 12 December 2014 at 21:49, jeffreyhorner notifications@github.com wrote:

This seems to be a bug in R 3.1.1 Rhttpd handling of headers, although I can't verify for sure. Can you try with R devel?

— Reply to this email directly or view it on GitHub https://github.com/jeffreyhorner/Rook/issues/26#issuecomment-66840698.

hughjonesd commented 9 years ago

Do you know to whom I should report this if it is a bug in the core? It still seems to be there.