Index: src/library/tools/R/dynamicHelp.R =================================================================== --- src/library/tools/R/dynamicHelp.R (revision 50616) +++ src/library/tools/R/dynamicHelp.R (working copy) @@ -21,7 +21,7 @@ ## documentation with path = "/doc/....", possibly updated under tempdir()/.R ## html help, either by topic, /library//help/ (pkg=NULL means any) ## or by file, /library//html/.html -httpd <- function(path, query, ...) +httpd <- function(path, query, body, ...) { .HTMLdirListing <- function(dir, base, up) { Index: src/modules/internet/Rhttpd.c =================================================================== --- src/modules/internet/Rhttpd.c (revision 50616) +++ src/modules/internet/Rhttpd.c (working copy) @@ -406,6 +406,22 @@ c->attr |= CONNECTION_CLOSE; } +/* + * structures the body as a raw vector if there is a body or return NULL + * otherwise + */ +static SEXP parse_body(httpd_conn_t *c) { + char* body = c->body ; + /* no body */ + if( !body ) return R_NilValue ; + + /* structure the body as a raw vector */ + SEXP res = PROTECT( Rf_allocVector( RAWSXP, c->content_length ) ); + memcpy( RAW(res), c->body, c->content_length ) ; + UNPROTECT( 1 ) ; /* res */ + return res ; +} + /* process a request by calling the httpd() function in R */ static void process_request(httpd_conn_t *c) { @@ -424,7 +440,7 @@ uri_decode(c->url); /* decode the path part */ { /* construct try(httpd(url, query), silent=TRUE) */ SEXP sTrue = PROTECT(ScalarLogical(TRUE)); - SEXP y, x = PROTECT(lang3(install("try"), LCONS(install("httpd"), CONS(mkString(c->url), CONS(query ? parse_query(query) : R_NilValue, R_NilValue))), sTrue)); + SEXP y, x = PROTECT(lang3(install("try"), LCONS(install("httpd"), CONS(mkString(c->url), CONS(query ? parse_query(query) : R_NilValue, CONS(parse_body(c),R_NilValue)))), sTrue)); SET_TAG(CDR(CDR(x)), install("silent")); DBG(Rprintf("eval(try(httpd('%s'),silent=TRUE))\n", c->url)); x = PROTECT(eval(x, R_FindNamespace(mkString("tools"))));