update,
i've learned already that context.h actually comes from neko. i use the
following lines in .../neko/libs/mod_neko:
/usr/sbin/apxs2 -c -I $(apu-config --includedir) -I /usr/local/include/neko -I
../../vm/ mod_neko.c cgi.c
gcc -fPIC -shared -o mod_neko.ndll -lneko -I/usr/local/include/neko
-I/usr/include/apache2/ -I/usr/include/apr-0/ -lapr-0 cgi.c mod_neko.c
a somewhat newer patch is attached, the following remains the same:
> * make it so the same source file can be used for apache1 and 2.
> * putenv("MOD_NEKO=1") crashes my apache2. so we need to find another way
to signal the cgi module that it's running in apache.
> * send_headers is not yet implemented, i haven't figured how its done in
apache2
> * i had to disable cgi_get_cache to make the cgi module load without
apache.
-dan
--
http://0xDF.com/
http://iterative.org/
? .libs
? NOTES
? cgi.lo
? cgi.slo
? mod_neko.la
? mod_neko.lo
? mod_neko.ndll
? mod_neko.slo
Index: cgi.c
===================================================================
RCS file: /cvsroot/neko/libs/mod_neko/cgi.c,v
retrieving revision 1.14
diff -u -r1.14 cgi.c
--- cgi.c 27 Apr 2006 15:22:51 -0000 1.14
+++ cgi.c 23 May 2006 14:20:56 -0000
@@ -51,7 +51,7 @@
<doc>Return a cookie list as a (name,value) chained list</doc>
**/
static value get_cookies() {
- const char *k = ap_table_get(CONTEXT()->r->headers_in,"Cookie");
+ const char *k = apr_table_get(CONTEXT()->r->headers_in,"Cookie");
char *start, *end;
value p = val_null, tmp;
if( k == NULL )
@@ -90,7 +90,7 @@
val_buffer(b,v);
buffer_append(b,";");
str = buffer_to_string(b);
- ap_table_add(c->r->headers_out,"Set-Cookie",val_string(str));
+ apr_table_add(c->r->headers_out,"Set-Cookie",val_string(str));
return val_true;
}
@@ -131,8 +131,8 @@
mcontext *c = CONTEXT();
val_check(s,string);
HEADERS_NOT_SENT("Redirection");
- ap_table_set(c->r->headers_out,"Location",val_string(s));
- c->r->status = REDIRECT;
+ apr_table_set(c->r->headers_out,"Location",val_string(s));
+ c->r->status = HTTP_TEMPORARY_REDIRECT;
return val_true;
}
@@ -161,7 +161,7 @@
c->content_type = alloc_string(val_string(k));
c->r->content_type = val_string(c->content_type);
} else
- ap_table_set(c->r->headers_out,val_string(s),val_string(k));
+ apr_table_set(c->r->headers_out,val_string(s),val_string(k));
return val_true;
}
@@ -172,7 +172,7 @@
static value get_client_header( value s ) {
mcontext *c = CONTEXT();
val_check(s,string);
- return alloc_string( ap_table_get(c->r->headers_in,val_string(s)) );
+ return alloc_string( apr_table_get(c->r->headers_in,val_string(s)) );
}
/**
@@ -351,7 +351,7 @@
// PARSE "POST" PARAMS
if( c->post_data != NULL ) {
- const char *ctype = ap_table_get(c->r->headers_in,"Content-Type");
+ const char *ctype = apr_table_get(c->r->headers_in,"Content-Type");
if( ctype && strstr(ctype,"application/octet-stream") != NULL )
return p;
if( ctype && strstr(ctype,"multipart/form-data") != NULL )
@@ -396,7 +396,7 @@
cgi_get_cache : void -> #list
<doc>Return the list of modules cached by mod_neko</doc>
**/
-extern value cgi_get_cache();
+//extern value cgi_get_cache();
DEFINE_PRIM(cgi_get_cwd,0);
DEFINE_PRIM(cgi_set_main,1);
@@ -412,6 +412,6 @@
DEFINE_PRIM(set_header,2);
DEFINE_PRIM(set_return_code,1);
DEFINE_PRIM(get_client_header,1);
-DEFINE_PRIM(cgi_get_cache,0);
+//DEFINE_PRIM(cgi_get_cache,0);
/* ************************************************************************ */
Index: mod_neko.c
===================================================================
RCS file: /cvsroot/neko/libs/mod_neko/mod_neko.c,v
retrieving revision 1.17
diff -u -r1.17 mod_neko.c
--- mod_neko.c 28 Mar 2006 12:06:43 -0000 1.17
+++ mod_neko.c 23 May 2006 14:20:56 -0000
@@ -41,7 +41,9 @@
static void send_headers( mcontext *c ) {
if( !c->headers_sent ) {
- ap_send_http_header(c->r);
+ fprintf(stderr,"mod_neko send_headers NYI for apache2\n");
+ fflush(stderr);
+// send_http_header(c->r);
c->headers_sent = true;
}
}
@@ -60,7 +62,7 @@
value fname = alloc_string(r->filename);
while( c != NULL ) {
if( val_compare(fname,c->file) == 0 ) {
- if( r->finfo.st_mtime == c->time )
+ if( r->finfo.mtime == c->time )
return c->main;
if( prev == NULL )
context_set(cache_root,c->next);
@@ -87,7 +89,7 @@
while( c != NULL ) {
if( val_compare(fname,c->file) == 0 ) {
c->main = main;
- c->time = r->finfo.st_mtime;
+ c->time = r->finfo.mtime;
return;
}
c = c->next;
@@ -95,7 +97,7 @@
c = (cache*)alloc_root(sizeof(struct cache) / sizeof(value));
c->file = fname;
c->main = main;
- c->time = r->finfo.st_mtime;
+ c->time = r->finfo.mtime;
c->next = (cache*)context_get(cache_root);
context_set(cache_root,c);
}
@@ -187,47 +189,41 @@
return OK;
}
+ r->content_type = val_string(ctx.content_type);
send_headers(&ctx);
return OK;
}
static int neko_handler( request_rec *r ) {
+ if(strcmp(r->handler,"neko-handler"))
+ return DECLINED;
+
int ret = neko_handler_rec(r);
neko_gc_major();
return ret;
}
-static void neko_init(server_rec *s, pool *p) {
+static int neko_init( apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s ) {
cache_root = context_new();
- putenv("MOD_NEKO=1");
+// putenv("MOD_NEKO=1");
+
neko_global_init(&s);
+ return OK;
}
-static const handler_rec neko_handlers[] = {
- {"neko-handler", neko_handler},
- {NULL}
+static void neko_register_hooks( apr_pool_t *p ) {
+ ap_hook_post_config( neko_init, NULL, NULL, APR_HOOK_MIDDLE );
+ ap_hook_handler( neko_handler, NULL, NULL, APR_HOOK_LAST );
};
-module MODULE_VAR_EXPORT neko_module = {
- STANDARD_MODULE_STUFF,
- neko_init,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- neko_handlers,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+module AP_MODULE_DECLARE_DATA neko_module = {
+ STANDARD20_MODULE_STUFF,
NULL,
NULL,
NULL,
NULL,
- NULL
+ NULL, /*neko_module_cmds, */
+ neko_register_hooks
};
/* ************************************************************************ */
--
Neko : One VM to run them all
(http://nekovm.org)