Re: [Monetdb-developers] [Monetdb-pf-checkins] pathfinder/runtime shttpd.c, 1.19.4.1, 1.19.4.2 shttpd.h, 1.6.6.1, 1.6.6.2 xrpc_server.mx, 1.7.2.7, 1.7.2.8
Sorry, I forgot to mention that you need to update and rebuild MonetDB4 because there are some changes in conf/MonetDB4.conf.in Regards, Jennie On Wed, Feb 21, 2007 at 04:22:52PM +0000, Ying Zhang wrote:
Update of /cvsroot/monetdb/pathfinder/runtime In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv31043
Modified Files: Tag: XQuery_0-16 shttpd.c shttpd.h xrpc_server.mx Log Message: implementation of - xrpc_open (only listen to localhost or not) - xrpc_port (default port nr) - xrpc_trusted (prefix of module locations) - xrpc_admin (hosts that have (web) access to the functions defined in <datadir>/MonetDB/xrpc/admin/admin.xq)
Index: shttpd.c =================================================================== RCS file: /cvsroot/monetdb/pathfinder/runtime/shttpd.c,v retrieving revision 1.19.4.1 retrieving revision 1.19.4.2 diff -u -d -r1.19.4.1 -r1.19.4.2 --- shttpd.c 15 Feb 2007 01:46:13 -0000 1.19.4.1 +++ shttpd.c 21 Feb 2007 16:22:49 -0000 1.19.4.2 @@ -332,11 +332,11 @@ * change enum that goes below! */ {'d', "document_root", 0, NULL, OPT_STR, {0}, NULL }, - {'i', "index_files", 0, NULL, OPT_STR, {0}, INDEX_FILES }, - {'D', "list_directories",0,NULL, OPT_BOOL, {0}, "1" }, - {'c', "cgi_extention", 0, NULL, OPT_STR, {0}, CGI_EXTENTION }, - {'N', "server_name", 0, NULL, OPT_STR, {0}, AUTH_REALM }, - {'p', "listen_port", 0, NULL, OPT_INT, {0}, LISTEN_PORT }, + {'i', "index_files", 1, NULL, OPT_STR, {INDEX_FILES}, INDEX_FILES }, + {'D', "list_directories",1,NULL, OPT_BOOL, {0}, "0" }, + {'c', "cgi_extention", 1, NULL, OPT_STR, {CGI_EXTENTION}, CGI_EXTENTION }, + {'N', "server_name", 1, NULL, OPT_STR, {AUTH_REALM}, AUTH_REALM }, + {'p', "listen_port", 1, NULL, OPT_INT, {LISTEN_PORT}, LISTEN_PORT }, {'l', "access_log", 0, NULL, OPT_STR, {0}, NULL }, {'e', "error_log", 0, NULL, OPT_STR, {0}, NULL }, {'m', "mime_types", 0, NULL, OPT_STR, {0}, NULL }, @@ -346,7 +346,7 @@ {'I', "inetd_mode", 0, NULL, OPT_BOOL, {0}, "0" }, {'u', "runtime_uid", 0, NULL, OPT_STR, {0}, NULL }, {'V', "show_stats", 0, NULL, OPT_BOOL, {0}, "0" }, - {'C', "config_file", 0, NULL, OPT_STR, {0}, CONFIG }, + {'C', "config_file", 1, NULL, OPT_STR, {CONFIG}, CONFIG }, {0, NULL, 0, NULL, OPT_BOOL, {0}, NULL } };
@@ -1080,7 +1080,7 @@ * Setup listening socket on given port, return socket */ shttpd_socket -shttpd_open_port(int port) +shttpd_open_port(int port, int accept_any) { shttpd_socket ret; SOCKET sock; @@ -1092,10 +1092,10 @@ if (port == 0) port = INTOPT(OPT_LISTENPORT);
- sa.len = sizeof(sa.u.sin); - sa.u.sin.sin_family = AF_INET; - sa.u.sin.sin_port = htons((uint16_t) port); - sa.u.sin.sin_addr.s_addr = htonl(INADDR_ANY); + sa.len = sizeof(sa.u.sin); + sa.u.sin.sin_family = AF_INET; + sa.u.sin.sin_port = htons((uint16_t) port); + sa.u.sin.sin_addr.s_addr = accept_any?htonl(INADDR_ANY):htonl(INADDR_LOOPBACK);
if ((sock = socket(PF_INET, SOCK_STREAM, 6)) == -1) elog(ERR_FATAL, "shttpd_open_port: socket: %s",strerror(ERRNO)); @@ -3242,6 +3242,12 @@ return arg->connection->uri; }
+struct in_addr +shttpd_get_inAddr(struct shttpd_callback_arg *arg) +{ + return arg->connection->sa.u.sin.sin_addr; +} + void shttpd_finish(struct shttpd_callback_arg *arg) {
Index: shttpd.h =================================================================== RCS file: /cvsroot/monetdb/pathfinder/runtime/shttpd.h,v retrieving revision 1.6.6.1 retrieving revision 1.6.6.2 diff -u -d -r1.6.6.1 -r1.6.6.2 --- shttpd.h 15 Feb 2007 01:46:13 -0000 1.6.6.1 +++ shttpd.h 21 Feb 2007 16:22:50 -0000 1.6.6.2 @@ -159,7 +159,7 @@ extern void shttpd_setopt(const char *variable, const char *value); extern void shttpd_addmimetype(const char *ext, const char *mime); extern void shttpd_register_mountpoint(const char *uri, const char *system_path); -extern shttpd_socket shttpd_open_port(int port); +extern shttpd_socket shttpd_open_port(int port, int accept_any); extern void shttpd_register_url(const char *url, shttpd_callback_t callback, void *callback_data); extern void shttpd_protect_url(const char *url, const char *file); @@ -172,6 +172,7 @@ extern char *shttpd_get_method(struct shttpd_callback_arg *arg); extern char *shttpd_get_uri(struct shttpd_callback_arg *arg); extern int shttpd_get_socket(struct shttpd_callback_arg *arg); +extern struct in_addr shttpd_get_inAddr(struct shttpd_callback_arg *arg); extern void shttpd_finish(struct shttpd_callback_arg *arg);
#ifdef MT
Index: xrpc_server.mx =================================================================== RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_server.mx,v retrieving revision 1.7.2.7 retrieving revision 1.7.2.8 diff -u -d -r1.7.2.7 -r1.7.2.8 --- xrpc_server.mx 17 Feb 2007 01:10:38 -0000 1.7.2.7 +++ xrpc_server.mx 21 Feb 2007 16:22:50 -0000 1.7.2.8 @@ -40,61 +40,123 @@
@- HTTP server function(s) @m -.COMMAND httpd_start(int port, str option) : void = CMDhttpd_start; +.COMMAND rpcd_start(int port, bit open, str options) : void = CMDrpcd_start; "Start the HTTP server for RPC calls on the specified port."
.EPILOGUE = xrpc_epilogue; .END xrpc_server;
@mil [...1118 lines suppressed...]
/* Open listening socket */ - ctx = shttpd_open_port(*port); + ctx = shttpd_open_port(xrpc_port, *open); + listen_socket = ctx.sock;
/* Serve connections infinitely until someone kills us */ for ( ; rpcd_running; ) shttpd_poll(&ctx, 200); @@ -905,8 +1199,10 @@ return GDK_SUCCEED; }
-void xrpc_epilogue() { +void xrpc_epilogue() +{ shttpd_fini(); /* Shut down the HTTP server. */ rpcd_running = 0; /* Stop RPC server */ + close(listen_socket); } /* vim:set shiftwidth=4 expandtab: */
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Monetdb-pf-checkins mailing list Monetdb-pf-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins
participants (1)
-
Ying Zhang