g-wan

Does anyone has first-hand experience with G-WAN web Server?

。_饼干妹妹 提交于 2019-12-02 16:46:10
The only place where I found informations on G-WAN web server was the project web site and it looked very much like advertisement. What I would really know is, for someone who is proficient with C, if it is as easy to use and extend that other architectures. For now I would mostly focus on scripting abilities. Are C scripts on GWAN easy to write ? Can you easily update and upload new C scripts to the server (say as easily than some PHP or Java pages on other architectures) ? Do you have to restart the server when doing so ? Can you easily extend it with third party or existing C libraries ?

feature request: an atomicAdd() function included in gwan.h

旧时模样 提交于 2019-12-01 09:48:42
问题 In the G-WAN KV options, KV_INCR_KEY will use the 1st field as the primary key. That means there is a function which increments atomically already built in the G-WAN core to make this primary index work. It would be good to make this function opened to be used by servlets, i.e. included in gwan.h. By doing so, ANSI C newbies like me could benefit from it. 回答1: There was ample discussion about this on the old G-WAN forum, and people were invited to share their experiences with atomic

GWAN Key-Value persistent multiple store

狂风中的少年 提交于 2019-12-01 08:03:50
I want to record a key-value in persistent mode but when I want to use 2 or more different stores it doesn't work. Here's my script: ... typedef struct{ kv_t *kv; char *name; } kv_data; int main(int argc, char *argv[]) { kv_data **data = (kv_data**)get_env(argv, US_SERVER_DATA); if(!data[0]){ data[0] = (kv_data*)calloc(1, sizeof(kv_data)); if(!data[0]){ return 500; } kv_t users; kv_init(&users, "users", 10, 0, 0, 0); data[0]->kv = &users; kv_item item; item.key = "pierre"; item.klen = sizeof("pierre") - 1; item.val = "pierre@example.com"; item.flags = 0; kv_add(data[0]->kv, &item); data[0]-

GWAN Key-Value persistent multiple store

允我心安 提交于 2019-12-01 06:19:07
问题 I want to record a key-value in persistent mode but when I want to use 2 or more different stores it doesn't work. Here's my script: ... typedef struct{ kv_t *kv; char *name; } kv_data; int main(int argc, char *argv[]) { kv_data **data = (kv_data**)get_env(argv, US_SERVER_DATA); if(!data[0]){ data[0] = (kv_data*)calloc(1, sizeof(kv_data)); if(!data[0]){ return 500; } kv_t users; kv_init(&users, "users", 10, 0, 0, 0); data[0]->kv = &users; kv_item item; item.key = "pierre"; item.klen = sizeof(

G-WAN handler rewriting solution

半世苍凉 提交于 2019-12-01 00:11:46
Here's my script : #include "gwan.h" // G-WAN exported functions #include <string.h> // strstr() int init(int argc, char *argv[]) { u32 *states = (u32*)get_env(argv, US_HANDLER_STATES); *states = 1 << HDL_AFTER_READ; return 0; } void clean(int argc, char *argv[]) {} int main(int argc, char *argv[]) { if((long)argv[0] == HDL_AFTER_READ) { xbuf_t *read_xbuf = (xbuf_t*)get_env(argv, READ_XBUF); if(strstr(read_xbuf->ptr, "GET / HTTP/1.1")) { xbuf_repl(read_xbuf, "GET / HTTP/1.1", "GET /?index HTTP/1.1"); } else { if(strstr(read_xbuf->ptr, ".c HTTP/1.1")) { int *pHTTP_status = (int*)get_env(argv,

G-WAN handler rewriting solution

徘徊边缘 提交于 2019-11-30 18:20:41
问题 Here's my script : #include "gwan.h" // G-WAN exported functions #include <string.h> // strstr() int init(int argc, char *argv[]) { u32 *states = (u32*)get_env(argv, US_HANDLER_STATES); *states = 1 << HDL_AFTER_READ; return 0; } void clean(int argc, char *argv[]) {} int main(int argc, char *argv[]) { if((long)argv[0] == HDL_AFTER_READ) { xbuf_t *read_xbuf = (xbuf_t*)get_env(argv, READ_XBUF); if(strstr(read_xbuf->ptr, "GET / HTTP/1.1")) { xbuf_repl(read_xbuf, "GET / HTTP/1.1", "GET /?index