Add simple docstring for Python modules.
[jelmer/samba4-debian.git] / source / web_server / http.c
index 67329fba7ed0bbb4c8c7adf06120404b464e180b..bd6efa9262aac42ecd7b6d7769ccc62af91bfc94 100644 (file)
@@ -139,7 +139,8 @@ static int http_readFile(EspHandle handle,
                          const char *path,
                          const char *base_dir)
 {
-       struct websrv_context *web = talloc_get_type(handle, struct websrv_context);
+       struct websrv_context *web = talloc_get_type(handle, 
+                                                    struct websrv_context);
        int fd = -1;
        struct stat st;
        *buf = NULL;
@@ -169,12 +170,11 @@ failed:
        return -1;
 }
 
-static int http_readFileFromSwatDir(EspHandle handle,
-                                       char **buf,
-                                       int *len,
+static int http_readFileFromSwatDir(EspHandle handle, char **buf, int *len,
                                        const char *path)
 {
-    return http_readFile(handle, buf, len, path, lp_swat_directory(global_loadparm));
+    return http_readFile(handle, buf, len, path, 
+                        lp_swat_directory(global_loadparm));
 }
 
 
@@ -388,7 +388,7 @@ static void http_simple_request(struct websrv_context *web)
        const char *path;
        struct stat st;
 
-       path = http_local_path(web, url, lp_swat_directory(global_loadparm));
+       path = http_local_path(web, url, lp_swat_directory(web->task->lp_ctx));
        if (path == NULL) goto invalid;
 
        /* looks ok */
@@ -470,7 +470,7 @@ static void http_setup_arrays(struct esp_state *esp)
                       talloc_asprintf(esp, "%u", socket_address->port));
        }
 
-       SETVAR(ESP_SERVER_OBJ, "DOCUMENT_ROOT", lp_swat_directory(global_loadparm));
+       SETVAR(ESP_SERVER_OBJ, "DOCUMENT_ROOT", lp_swat_directory(esp->web->task->lp_ctx));
        SETVAR(ESP_SERVER_OBJ, "SERVER_PROTOCOL", tls_enabled(web->conn->socket)?"https":"http");
        SETVAR(ESP_SERVER_OBJ, "SERVER_SOFTWARE", "SAMBA");
        SETVAR(ESP_SERVER_OBJ, "GATEWAY_INTERFACE", "CGI/1.1");
@@ -515,7 +515,7 @@ static void esp_request(struct esp_state *esp, const char *url)
        int res;
        char *emsg = NULL, *buf;
 
-       if (http_readFile(web, &buf, &size, url, lp_swat_directory(global_loadparm)) != 0) {
+       if (http_readFile(web, &buf, &size, url, lp_swat_directory(esp->web->task->lp_ctx)) != 0) {
                http_error_unix(web, url);
                return;
        }
@@ -547,7 +547,7 @@ static bool http_preauth(struct esp_state *esp)
 {
        const char *path = http_local_path(esp->web,
                                            HTTP_PREAUTH_URI,
-                                           lp_swat_directory(global_loadparm));
+                                           lp_swat_directory(esp->web->task->lp_ctx));
        int i;
        if (path == NULL) {
                http_error(esp->web, 500, "Internal server error");
@@ -734,7 +734,7 @@ static void http_setup_session(struct esp_state *esp)
                s->data = NULL;
                s->te = NULL;
                s->edata = edata;
-               s->lifetime = lp_parm_int(global_loadparm, NULL, "web", "sessiontimeout", 900);
+               s->lifetime = lp_parm_int(esp->web->task->lp_ctx, NULL, "web", "sessiontimeout", 900);
                DLIST_ADD(edata->sessions, s);
                talloc_set_destructor(s, session_destructor);
                if (!generated_key) {
@@ -1023,7 +1023,7 @@ NTSTATUS http_setup_esp(struct task_server *task)
 
        task->private = edata;
 
-       edata->tls_params = tls_initialise(edata);
+       edata->tls_params = tls_initialise(edata, task->lp_ctx);
        NT_STATUS_HAVE_NO_MEMORY(edata->tls_params);
 
        return NT_STATUS_OK;