From d70912a26af49db468af7ec88e9689b8176e0576 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 26 May 2005 01:06:32 +0000 Subject: r6981: first version of the builtin web server for Samba4 This includes an embedded server side scripting system called 'esp' (see http://www.appwebserver.org/products/esp/esp.html) and javascript based scripting language called 'esj' (see http://www.appwebserver.org/products/ejs/ejs.html) The justification for including this scripting language is that it should make it much easier to write a high quality web interface for Samba4. The scripting language can call into any Samba4 library code (so for example it will be able to make ldb and loadparm calls), plus it provides easy support for forms, cookies, sessions etc. There is still quite a bit more work to do on the web server, but there is enough here now for people to look at and comment. I will be committing some sample web pages that test esp functionality shortly. (This used to be commit 26f0ba92c0c565ac9e4cb5a079d795d4262497dd) --- source4/web_server/web_server.h | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 source4/web_server/web_server.h (limited to 'source4/web_server/web_server.h') diff --git a/source4/web_server/web_server.h b/source4/web_server/web_server.h new file mode 100644 index 0000000000..0202c91ef7 --- /dev/null +++ b/source4/web_server/web_server.h @@ -0,0 +1,49 @@ +/* + Unix SMB/CIFS implementation. + + Copyright (C) Andrew Tridgell 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "request.h" +#include "smbd/process_model.h" + +/* + context of one open web connection +*/ +struct websrv_context { + struct stream_connection *conn; + struct { + DATA_BLOB partial; + BOOL end_of_headers; + char *url; + unsigned content_length; + BOOL post_request; + const char *content_type; + const char *query_string; + const char *user_agent; + const char *referer; + const char *host; + const char *accept_encoding; + } input; + struct { + DATA_BLOB content; + int fd; + unsigned nsent; + int response_code; + const char **headers; + } output; +}; -- cgit From fc45b63e478f6f891f0d04bf49423be30a63617d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 27 May 2005 00:29:58 +0000 Subject: r6998: - added support for application[] data, which is global to all clients using the web server. This allows for things like application['state'] = "shuttting down" and then every web client can see that the server is going down - added support for session[] data. This allows web pages to store long term data specific to this client. It relies on cookies. Sessions auto timeout (default timeout 5 minutes). The timeout can be set in the scripts. - changed from processing all .html files as esp, to only processing .esp files as esp. This makes it easier to compare the samba web server to appWeb as a reference implementation. - expanded the number of standard variables setup by esp. See the showvars.esp example page for all variables. (This used to be commit c418b23c2ea383da8fad21b62213ec01fd135ebb) --- source4/web_server/web_server.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source4/web_server/web_server.h') diff --git a/source4/web_server/web_server.h b/source4/web_server/web_server.h index 0202c91ef7..f23ea90d55 100644 --- a/source4/web_server/web_server.h +++ b/source4/web_server/web_server.h @@ -25,6 +25,7 @@ context of one open web connection */ struct websrv_context { + struct task_server *task; struct stream_connection *conn; struct { DATA_BLOB partial; @@ -38,6 +39,10 @@ struct websrv_context { const char *referer; const char *host; const char *accept_encoding; + const char *accept_language; + const char *accept_charset; + const char *cookie; + const char *session_key; } input; struct { DATA_BLOB content; @@ -46,4 +51,7 @@ struct websrv_context { int response_code; const char **headers; } output; + struct session_data *session; }; + + -- cgit From ebb0b35242f5c2967afdba9e746679bc87c5b745 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 27 May 2005 11:57:14 +0000 Subject: r7013: added tls support to the builtin web server. It auto-detects if the client is using tls by looking at the first byte on the connection. This allows both https and http services to be on the same port (This used to be commit 6369dfb6585ce4d4e3028c557395f2d73c290c92) --- source4/web_server/web_server.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source4/web_server/web_server.h') diff --git a/source4/web_server/web_server.h b/source4/web_server/web_server.h index f23ea90d55..53f97964f1 100644 --- a/source4/web_server/web_server.h +++ b/source4/web_server/web_server.h @@ -28,6 +28,9 @@ struct websrv_context { struct task_server *task; struct stream_connection *conn; struct { + BOOL tls_detect; + BOOL tls_first_char; + uint8_t first_byte; DATA_BLOB partial; BOOL end_of_headers; char *url; @@ -45,13 +48,32 @@ struct websrv_context { const char *session_key; } input; struct { + BOOL output_pending; DATA_BLOB content; int fd; unsigned nsent; int response_code; const char **headers; } output; + void *tls_session; struct session_data *session; }; +/* + context for long term storage in the web server, to support session[] + and application[] data. Stored in task->private. +*/ +struct esp_data { + struct session_data { + struct session_data *next, *prev; + struct esp_data *edata; + const char *id; + struct MprVar *data; + struct timed_event *te; + int lifetime; + } *sessions; + struct MprVar *application_data; + void *tls_data; +}; + -- cgit From 822498b7f536e4c4e552c524b14d6cb691ec5b62 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 19 Jun 2005 04:21:45 +0000 Subject: r7744: converted the web server to use the lib/tls/ generic tls code (This used to be commit 023fc567badba38b87895ea73515b2ce0b703a8c) --- source4/web_server/web_server.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/web_server/web_server.h') diff --git a/source4/web_server/web_server.h b/source4/web_server/web_server.h index 53f97964f1..92bc673d75 100644 --- a/source4/web_server/web_server.h +++ b/source4/web_server/web_server.h @@ -55,7 +55,7 @@ struct websrv_context { int response_code; const char **headers; } output; - void *tls_session; + struct tls_context *tls; struct session_data *session; }; @@ -74,6 +74,6 @@ struct esp_data { int lifetime; } *sessions; struct MprVar *application_data; - void *tls_data; + struct tls_params *tls_params; }; -- cgit From 5c8447773f306e302c7182611e4fc03978c340b6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 9 Jan 2006 21:44:30 +0000 Subject: r12801: Some more include/ cleanups (remove unused macros + move files to specific dirs) (This used to be commit 243cf760b077e155f5ac508aeebf819f7708a84e) --- source4/web_server/web_server.h | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/web_server/web_server.h') diff --git a/source4/web_server/web_server.h b/source4/web_server/web_server.h index 92bc673d75..f23a578206 100644 --- a/source4/web_server/web_server.h +++ b/source4/web_server/web_server.h @@ -18,7 +18,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "request.h" #include "smbd/process_model.h" /* -- cgit From c389883ba2c93dfc11ac410a952f42f1065057d2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 6 Mar 2006 22:01:03 +0000 Subject: r13902: Stricter checking for the -fvisibility flag Add two more proto headers. (This used to be commit 0c95bf0cd33d8a6c35f692b796d7fbfd98b4d068) --- source4/web_server/web_server.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/web_server/web_server.h') diff --git a/source4/web_server/web_server.h b/source4/web_server/web_server.h index f23a578206..45617082e6 100644 --- a/source4/web_server/web_server.h +++ b/source4/web_server/web_server.h @@ -19,6 +19,7 @@ */ #include "smbd/process_model.h" +#include "web_server/proto.h" /* context of one open web connection -- cgit From e3f2414cf9e582a4e4deecc662b64a7bb2679a34 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 14 Mar 2006 15:03:25 +0000 Subject: r14380: Reduce the size of structs.h (This used to be commit 1a16a6f1dfa66499af43a6b88b3ea69a6a75f1fe) --- source4/web_server/web_server.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/web_server/web_server.h') diff --git a/source4/web_server/web_server.h b/source4/web_server/web_server.h index 45617082e6..6e266cc8bc 100644 --- a/source4/web_server/web_server.h +++ b/source4/web_server/web_server.h @@ -19,7 +19,6 @@ */ #include "smbd/process_model.h" -#include "web_server/proto.h" /* context of one open web connection @@ -77,3 +76,5 @@ struct esp_data { struct tls_params *tls_params; }; +#include "web_server/proto.h" + -- cgit From 742c110cd67f4995639822981e8bfcb1f652f2c4 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 2 May 2006 20:15:47 +0000 Subject: r15400: Move the TLS code behind the socket interface. This reduces caller complexity, because the TLS code is now called just like any other socket. (A new socket context is returned by the tls_init_server and tls_init_client routines). When TLS is not available, the original socket is returned. Andrew Bartlett (This used to be commit 09b2f30dfa7a640f5187b4933204e9680be61497) --- source4/web_server/web_server.h | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/web_server/web_server.h') diff --git a/source4/web_server/web_server.h b/source4/web_server/web_server.h index 6e266cc8bc..f64a946bee 100644 --- a/source4/web_server/web_server.h +++ b/source4/web_server/web_server.h @@ -54,7 +54,6 @@ struct websrv_context { int response_code; const char **headers; } output; - struct tls_context *tls; struct session_data *session; }; -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/web_server/web_server.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/web_server/web_server.h') diff --git a/source4/web_server/web_server.h b/source4/web_server/web_server.h index f64a946bee..c43a887caf 100644 --- a/source4/web_server/web_server.h +++ b/source4/web_server/web_server.h @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "smbd/process_model.h" -- cgit From 61ffa08f4c95e29d301de9fbabd6e71c2dbc1056 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 27 Aug 2007 18:10:19 +0000 Subject: r24712: No longer expose the 'BOOL' data type in any interfaces. (This used to be commit 1ce32673d960c8b05b6c1b1b99e1976a402417ae) --- source4/web_server/web_server.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/web_server/web_server.h') diff --git a/source4/web_server/web_server.h b/source4/web_server/web_server.h index c43a887caf..52aff05dcc 100644 --- a/source4/web_server/web_server.h +++ b/source4/web_server/web_server.h @@ -26,14 +26,14 @@ struct websrv_context { struct task_server *task; struct stream_connection *conn; struct { - BOOL tls_detect; - BOOL tls_first_char; + bool tls_detect; + bool tls_first_char; uint8_t first_byte; DATA_BLOB partial; - BOOL end_of_headers; + bool end_of_headers; char *url; unsigned content_length; - BOOL post_request; + bool post_request; const char *content_type; const char *query_string; const char *user_agent; @@ -46,7 +46,7 @@ struct websrv_context { const char *session_key; } input; struct { - BOOL output_pending; + bool output_pending; DATA_BLOB content; int fd; unsigned nsent; -- cgit