diff options
author | Felix Fietkau <nbd@openwrt.org> | 2008-06-29 00:06:36 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2008-06-29 00:06:36 +0000 |
commit | 533d8dee9d7d0dad8443c6393886dc984b9d3c70 (patch) | |
tree | 81b77f3b624132c4d5eba662bb35c53bb9cf9a3a /libs | |
parent | b2483cf23aec066a9b83efa35d24019b04ab8bc1 (diff) |
add cookie support
Diffstat (limited to 'libs')
-rw-r--r-- | libs/sgi-webuci/boa-patches/200-plugin_api.patch | 31 | ||||
-rw-r--r-- | libs/sgi-webuci/root/usr/lib/boa/luci.lua | 1 | ||||
-rw-r--r-- | libs/sgi-webuci/src/luci.c | 1 |
3 files changed, 27 insertions, 6 deletions
diff --git a/libs/sgi-webuci/boa-patches/200-plugin_api.patch b/libs/sgi-webuci/boa-patches/200-plugin_api.patch index 0d3a81167..c287ec50c 100644 --- a/libs/sgi-webuci/boa-patches/200-plugin_api.patch +++ b/libs/sgi-webuci/boa-patches/200-plugin_api.patch @@ -607,8 +607,8 @@ Index: boa-0.94.13/src/list.h Index: boa-0.94.13/src/plugin.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ boa-0.94.13/src/plugin.c 2008-06-29 01:22:01.000000000 +0200 -@@ -0,0 +1,190 @@ ++++ boa-0.94.13/src/plugin.c 2008-06-29 02:02:42.000000000 +0200 +@@ -0,0 +1,191 @@ +/* + * Simple plugin API for boa + * Copyright (C) 2008 John Crispin <blogic@openwrt.org> @@ -674,6 +674,7 @@ Index: boa-0.94.13/src/plugin.c + ctx.query_string = req->query_string; + ctx.remote_addr = req->remote_ip_addr; + ctx.remote_port = req->remote_port; ++ ctx.cookie = req->cookie; + if (req->method == M_POST) { + if (req->content_type) + ctx.content_type = req->content_type; @@ -802,7 +803,7 @@ Index: boa-0.94.13/src/plugin.c Index: boa-0.94.13/src/request.c =================================================================== --- boa-0.94.13.orig/src/request.c 2008-06-29 01:11:52.000000000 +0200 -+++ boa-0.94.13/src/request.c 2008-06-29 01:12:36.000000000 +0200 ++++ boa-0.94.13/src/request.c 2008-06-29 01:49:46.000000000 +0200 @@ -50,6 +50,7 @@ dequeue(&request_free, request_free); /* dequeue the head */ } else { @@ -852,6 +853,15 @@ Index: boa-0.94.13/src/request.c if (req->is_cgi) { return init_cgi(req); +@@ -698,6 +716,8 @@ + req->header_user_agent = value; + if (!add_cgi_env(req, "USER_AGENT", value, 1)) + return 0; ++ } else if (!memcmp(line, "COOKIE", 7)) { ++ req->cookie = value; + } else { + if (!add_cgi_env(req, line, value, 1)) + return 0; Index: boa-0.94.13/src/Makefile.in =================================================================== --- boa-0.94.13.orig/src/Makefile.in 2008-06-29 01:11:52.000000000 +0200 @@ -981,7 +991,7 @@ Index: boa-0.94.13/src/alias.c Index: boa-0.94.13/src/globals.h =================================================================== --- boa-0.94.13.orig/src/globals.h 2008-06-29 01:11:52.000000000 +0200 -+++ boa-0.94.13/src/globals.h 2008-06-29 01:12:36.000000000 +0200 ++++ boa-0.94.13/src/globals.h 2008-06-29 01:47:25.000000000 +0200 @@ -47,6 +47,7 @@ struct request { /* pending requests */ int fd; /* client's socket fd */ @@ -998,6 +1008,14 @@ Index: boa-0.94.13/src/globals.h char *path_info; /* env variable */ char *path_translated; /* env variable */ +@@ -99,6 +101,7 @@ + char *query_string; /* env variable */ + char *content_type; /* env variable */ + char *content_length; /* env variable */ ++ char *cookie; /* env variable */ + + struct mmap_entry *mmap_entry_var; + Index: boa-0.94.13/src/read.c =================================================================== --- boa-0.94.13.orig/src/read.c 2008-06-29 01:11:52.000000000 +0200 @@ -1019,8 +1037,8 @@ Index: boa-0.94.13/src/read.c Index: boa-0.94.13/src/boa-plugin.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ boa-0.94.13/src/boa-plugin.h 2008-06-29 01:12:36.000000000 +0200 -@@ -0,0 +1,67 @@ ++++ boa-0.94.13/src/boa-plugin.h 2008-06-29 02:02:27.000000000 +0200 +@@ -0,0 +1,68 @@ +#ifndef _HTTPD_PLUGIN_H__ +#define _HTTPD_PLUGIN_H__ + @@ -1047,6 +1065,7 @@ Index: boa-0.94.13/src/boa-plugin.h + char *content_type; + char *content_length; + char *http_accept; ++ char *cookie; + + void *priv; +}; diff --git a/libs/sgi-webuci/root/usr/lib/boa/luci.lua b/libs/sgi-webuci/root/usr/lib/boa/luci.lua index 879ef19b4..5c9531a2e 100644 --- a/libs/sgi-webuci/root/usr/lib/boa/luci.lua +++ b/libs/sgi-webuci/root/usr/lib/boa/luci.lua @@ -58,6 +58,7 @@ function handle_req(context) env.PATH_INFO = context.uri env.REMOTE_PORT = context.remote_port env.SERVER_ADDR = context.server_addr + env.HTTP_COOKIE = context.cookie env.SCRIPT_NAME = env.REQUEST_URI:sub(1, #env.REQUEST_URI - #env.PATH_INFO) luci.sgi.webuci.run(env, vars) diff --git a/libs/sgi-webuci/src/luci.c b/libs/sgi-webuci/src/luci.c index 24d4324a9..44a44af14 100644 --- a/libs/sgi-webuci/src/luci.c +++ b/libs/sgi-webuci/src/luci.c @@ -160,6 +160,7 @@ static int luci_handle_req(struct httpd_plugin *p, struct http_context *ctx) /* convert http_context data structure to lua table */ #define PUSH(x) pushvar(#x, ctx->x) + PUSH(cookie); PUSH(request_method); PUSH(server_addr); PUSH(server_proto); |