2016-03-28 4 views
0

Rserve(HTTP)の前に直接nginxを設定しようとしています。 Rserve 1.7.0のリリースノート(http://www.rforge.net/Rserve/news.html)では、.http.requestワーカー関数を定義する必要があることが示唆されています。私が見つけたすべての例は、これらの行をRserv.confに追加することを提案していますが、FastRWebを使用したくありません。FastRWebを使わないRserve .http.request機能

library(FastRWeb) 
.http.request <- FastRWeb:::.http.request 

マイRserve.confとして、次のとおりです。

remote enable http.port 6312

あなたがFastRWebに依存しない.http.requestの実装で私を助けることができますか?ありがとう!

答えて

0

これはnginxとどのように関連しているのか分かりませんが、これはリバースプロキシとしてのみ動作するため、Rserve設定を変更する必要がないためです。

しかし、あなたがやりたいし、その後(Rserveから引用)以下を返すことができ

.http.request <- function(url, query, body, headers, ...) 

として定義するだけの機能であることを.http.requestがあります

 the result is expected to have one of the following forms:    

     a) character vector of length 1 => error (possibly from try),   
     will create 500 response            

     b) list(payload[, content-type[, headers[, status code]]])    

     payload: can be a character vector of length one or a     
     raw vector. if the character vector is named "file" then    
     the content of a file of that name is the payload      

     content-type: must be a character vector of length one     
     or NULL (if present, else default is "text/html")      

     headers: must be a character vector - the elements will     
     have CRLF appended and neither Content-type nor       
     Content-length may be used            

     status code: must be an integer if present (default is 200)    

のみペイロードは、必須ですそれ以外はすべてオプションです。 tryCatch({ ... }, error=function(e) e$message)のようなコードでコードを折り返して、エラーが発生した場合の出力を確認することをお勧めします。 Rserve関連の質問のためのstats-rosuda-develメーリングリストを使用することを検討してください:これは内蔵のHTTPサーバR.

PSで使用されるのと同じAPIであることを

注意。

関連する問題