From 68024f41250e890acc37d34c8f528db5b78c5d1c Mon Sep 17 00:00:00 2001 From: Peter Solymos Date: Wed, 16 Dec 2020 10:23:59 -0700 Subject: [PATCH 1/2] Change tools:::httpdPort to tools:::httpdPort() Make tools:::httpdPort a dynamic variable: https://github.com/wch/r-source/commit/368f045c56bfef9310a61272ed65f68ad1930929#diff-511a7690b48f353bb2bb27e5ac70040466b0f9423837d502bda503717562ed3d --- R/Rhttpd.R | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/R/Rhttpd.R b/R/Rhttpd.R index c42f34c..6882e40 100644 --- a/R/Rhttpd.R +++ b/R/Rhttpd.R @@ -116,7 +116,7 @@ Rhttpd <- setRefClass( paste('http://',listenAddr,':',listenPort,appList[[i]]$path,sep='') }, launch = function(...){ - .self$start(quiet=TRUE) + .self$start(quiet=TRUE) # Try to create a new app from the supplied arguments app <- RhttpdApp$new(...) if (add(app)){ @@ -156,9 +156,9 @@ Rhttpd <- setRefClass( if(grepl('rstudio',base::.Platform$GUI,ignore.case=TRUE)){ # RStudio has already set up host and port - listenPort <<- tools:::httpdPort + listenPort <<- tools:::httpdPort() if (!missing(port)) - warning("RStudio has already started the web server on port ",tools:::httpdPort) + warning("RStudio has already started the web server on port ",tools:::httpdPort()) return(invisible()) } @@ -208,15 +208,15 @@ Rhttpd <- setRefClass( #.self$httpdOrig <- tools:::httpd #assignInNamespace( # app$name, - # function(path,query,postBody,headers) - # .self$handler(app$name,path,query,postBody,headers), + # function(path,query,postBody,headers) + # .self$handler(app$name,path,query,postBody,headers), # 'tools' #) } else { assign( - app$name, - function(path,query,postBody,headers) - .self$handler(app$name,path,query,postBody,headers), + app$name, + function(path,query,postBody,headers) + .self$handler(app$name,path,query,postBody,headers), tools:::.httpd.handlers.env ) } @@ -292,10 +292,10 @@ Rhttpd <- setRefClass( ), env ) - + if(exists("HTTP_REQUEST_METHOD", env)){ assign('REQUEST_METHOD',get("HTTP_REQUEST_METHOD", env) ,env) - } else { + } else { assign('REQUEST_METHOD',ifelse(is.null(postBody),'GET','POST'),env) } From a2a73cf077ff3330b787a96e6a1c72f6fe3c75d9 Mon Sep 17 00:00:00 2001 From: Peter Solymos Date: Wed, 16 Dec 2020 10:31:21 -0700 Subject: [PATCH 2/2] R version dependency added httpdPort is unexported, so I took the next minor version after the httpdPort() commit. --- DESCRIPTION | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d409f40..8437e5c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,14 +1,14 @@ Package: Rook Type: Package Title: Rook - a web server interface for R -Version: 1.1-1 -Date: 2014-10-20 +Version: 1.1-2 +Date: 2020-12-16 Author: Jeffrey Horner Maintainer: Jeffrey Horner Description: This package contains the Rook specification and convenience software for building and running Rook applications. To get started, be sure and read the 'Rook' help file first. -Depends: R (>= 2.13.0) +Depends: R (>= 3.2.0) Imports: utils, tools, methods, brew License: GPL-2 LazyLoad: yes