Skip to content

Rserve 1.8-15

Latest
Compare
Choose a tag to compare
@s-u s-u released this 18 Dec 22:34
· 3 commits to master since this release
  • The static HTTP/HTTPS handers are now officially supported so Rserve.http.add.static() is now exported and documented. Also Rserve.http.rm.all.statics() has been added to allow the removal of all handlers.

  • There were several bugfixes in the handling of paths in the static http handlers (sanitization was done on the full path instead of the request part only and separating / are now inserted where necessary).

  • Shorthand arguments --RS-simple-http <path> and --RS-simple-http-only <path> have been added to the command line Rserve. They disable QAP and register a static http handler using the supplied <path> as document root. If http.port has not been set, it will default to 8080.
    Note that the <path> should be absolute since Rserve changes the working directory to / when daemonizing (or use --RS-set daemon=no). The --RS-simple-http variant continues to process other handlers (static or R) while the --RS-simple-http-only variant will respond with 404 if the resource is not found (see Rserve.http.add.static() documentation).

    QAP can be re-enabled if desired by subsequent arguments. If the desire is to only run a HTTPS server then --RS-set http.port=0 can be used to disable the default and then add all necessary arguments (or a config file) for the TLS part.

  • added run.Rserve(background=TRUE) mode which meshes server processing loop (i.e., the loop which accepts new connections) and the R session event loop. The function returns as soon as all the server ports are bound (essentially immediately). This allows the server R process to run R code in the main session after the server was started and thus influence future client connections. This is currently only supported on unix.

    Please note that any changes to the server R session only affect new connections, not existing ones.

    If a function .Rserve.served is defined in the global environment then it will be called after each new accepted client connection in the main R session.

    Function stop.Rserve() can be used to stop and remove all servers started with run.Rserve(). Note that all existing client connections will remain intact.

    NB: This functionality is currently considered experimental and the return value is undefined (currently TRUE on success, but may return other information in the future to enable more fine-grained control over the background servers).