Giter Site home page Giter Site logo

fastrweb's People

Contributors

s-u avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fastrweb's Issues

systemd-startup-file

It would be great to have a systemd-startup-definition file...

Does anyone already created one for his/her use and can share it?

(I'm currently upgrading a FastRWeb installation - and I don't want to emulate a rc.local-file on the new systemd-based Debian ;-) )

Request Headers missing

Hello Simon/,

I am using your framework to develop an analytics platform using R. I created some web apis using concepts laid down by FastRWeb, however, in order to do authentication I need to parse the request headers and verify the tokens. I noticed that in code headers are being parsed, but they are being set to expose only certain parameters like
uri=url, method='GET', c.type='', c.length=-1, body=NULL, client.ip='0.0.0.0', query.string='', raw.cookies=''" etc.

headers are being parsed from line 67 to 78.

Would it be possible to include all the headers so that the framework can be used for authentication?

Or else I need some help in understanding how I can read custom headers from the request.

Kind regards,
Satya

Use additional headers

As mistakenly requested in the repository Rserve (s-u/Rserve#177), I would like to correctly tip in my feature request in this repository.
It would be nice to have more headers or header information in the request object, like Authorization: Bearer. Currently there a just a few available. It should be possible to add more headers, if given in the incoming request.

WebResult HTTP Status Code

I was wondering, if there is a way to also set the HTTP status code for a WebResult (like headers). I couldn't find anything in the docs, but it would be nice, if this was possible, since a 200 is not always suitable.

echoed GET data comes back corrupted

Hello,
When I POST a bunch of data to a simple FastRWeb script that echoes it back, it sometimes comes back slightly altered, depending on how I did the POST.

Example output:

$ diff cmdline.txt rcurl.txt 
178c178
< ensembl/release-74/fasta/erinaceus_europaeus/dna/Erinaceus_europaeus.HEDGEHOG.74.dna.toplevel.fa.rz

---
> ensembl/release-74/fasta/erinaceus_europaeus/dna/EErinaceus_europaeus.HEDGEHOG.74.dna.toplevel.fa.rz
350c350
< ensembl/release-74/fasta/pelodiscus_sinensis/dna/Pelodiscus_sinensis.PelSin_1.0.74.dna_rm.toplevel.fa.rz

---
> ensembl/release-74/fasta/pelodiscus_sinensis/dna/Pelodiscus_sinensis.PelSin_11.0.74.dna_rm.toplevel.fa.rz

See how Erinaceus becomes EErinaceus and 1.0 becomes 11.0.

Here's the simple FastRWeb script (save this as test.R in your web.R directory):

run <- function(...) {
  params <- list(...)
  out(params$RDataPath)
}

I compared the results with an equivalent python CGI script:

import cgi
print "Content-Type: text/html"
print   
form = cgi.FieldStorage()
print(form["RDataPath"].value)

and the problem does not occur with python so it seems to be happening in FastRWeb.

How to reproduce:

Download these files:
https://s3.amazonaws.com/fastrweb-problem/paths.txt
https://s3.amazonaws.com/fastrweb-problem/paths2.txt

They are identical except paths2.txt has "RDataPath=" at the beginning so it's suitable for POSTing from the curl command line.

1: POSTing from the command line:

curl -X POST --data @paths2.txt http://localhost/cgi-bin/R/test.R > cmdline.txt

2: POSTing from RCurl:

library(RCurl)
pathStr <- readLines("paths.txt")
res <- postForm("http://localhost/cgi-bin/test.cgi", RDataPath=pathStr)
cat(res, file="rcurl.txt")

3: evaluate results:

edit both cmdline.txt and rcurl.txt, replacing all spaces with newlines.
Then diff them:

diff cmdline.txt rcurl.txt

You should see something like the diff output at the beginning of this email.
It seems to corrupt the data in slightly different ways each time.

I hope you can fix this. It isn't clear to me how to work around it because I can't predict where the corruption will occur. Unfortunately using command-line curl is not a good workaround since I need to POST from a Bioconductor package which may be running on systems (e.g. windows) where command-line curl is not available. I'm not an RCurl expert but maybe there's a way to make my RCurl post look more like the command-line curl post and thereby not confuse FastRWeb so much?

Thanks!
Dan

BTW, the bugzilla link on http://rforge.net/ is broken, it points to http://rforge.net/bugzilla/ which is not found.

@mtmorgan
@mrjc42

Example application

Hi,
Is there any tutorial on how to build a web app with this package?
Thanks,

Status Header is always 200 OK when running RServe standalone

Hello Simon,

I noticed that my response headers are not working properly anymore for Statuses. When I was running with CGI enabled, then I had an option to set Status. I am trying out the apis in Advanced rest client. A small screensot of script not found error is attached.
statuscode

Response Raw putput from Fiddler.

HTTP/1.1 200 OK
Content-type: text/html
Status: 404 Script not found
Content-length: 26

Script /api111.R not found

Kind regards,
Satya.

match media type without parameters when decoding parameters

When I post with a number of parameters in the body, info.R shows no parameters. It shows that the contente type is:

$ c.type      : chr "application/x-www-form-urlencoded; charset=UTF-8"

meanwhile, the code doesn't handle media type parameters; it just does an exact string match:

    if (request$c.type == 'application/x-www-form-urlencoded' && is.raw(request$body)) {

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.