Re: Problem with 'plus' signs in query strings

23 views
Skip to first unread message

Jeffrey

unread,
Jan 10, 2013, 2:23:00 PM1/10/13
to rr...@googlegroups.com
This is an R thing and a bug in Rook. The internal web server parses and decodes the query string before handing it off to Rook. If you have devtools, then you can just issue the following command to get the latest release:

library(devtools)
install_github('Rook','jeffreyhorner')

I'll shipping off a new version to CRAN rsn.

Jeff

On Wednesday, October 24, 2012 11:11:06 AM UTC-5, Richard Morey wrote:
I'm having trouble with URIs including encoded plusses. Take the following example:

########### Begin R code
library(Rook)
s <- Rhttpd$new()
s$start(quiet=TRUE)

app <- function(env){
  req <- Request$new(env)
  res <- Response$new()
  cat(req$query_string(),"\n")
  cat(req$GET()$a,"\n")

  return(res$finish())
}

s$add(name="response", app=app)

s$browse('response') # Opens a browser window to the app.


#s$remove(all=TRUE)
#rm(s)
################
When use a URL like:
http://localhost:44767/custom/response?a=b%2Bc

I get the right content in query_string() (see the cat()), but I get the wrong content from GET(). GET()$a contains the string, but the + is now a space, even though the + was properly URI encoded. Am I missing something, or is this a Rook/R issue? 
Reply all
Reply to author
Forward
0 new messages