summaryrefslogtreecommitdiff
path: root/source4/web_server/http.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-27 00:43:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:04 -0500
commit1ddf07bd63d157bcd879f8eeb4e3d63e30a07bbb (patch)
tree630295d70f4abdc370caa0df8b1edcf109e343d5 /source4/web_server/http.c
parent26a8394ee92443ce2a9688bc01a02df4c2ad74fa (diff)
downloadsamba-1ddf07bd63d157bcd879f8eeb4e3d63e30a07bbb.tar.gz
samba-1ddf07bd63d157bcd879f8eeb4e3d63e30a07bbb.tar.bz2
samba-1ddf07bd63d157bcd879f8eeb4e3d63e30a07bbb.zip
r7000: only keep session data if not empty - this saves us using lots of memory needlessly
(This used to be commit cee3caba9239b1e66c7f50d3f808b53e9fc22a53)
Diffstat (limited to 'source4/web_server/http.c')
-rw-r--r--source4/web_server/http.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/source4/web_server/http.c b/source4/web_server/http.c
index 5dd9e35edd..fd9b1be67f 100644
--- a/source4/web_server/http.c
+++ b/source4/web_server/http.c
@@ -780,13 +780,19 @@ void http_process_input(struct websrv_context *web)
talloc_free(web->session->data);
web->session->data = talloc_zero(web->session, struct MprVar);
mprSetCtx(web->session->data);
- mprCopyVar(web->session->data, &esp->variables[ESP_SESSION_OBJ], MPR_DEEP_COPY);
-
- /* setup the timeout for the session data */
- talloc_free(web->session->te);
- web->session->te = event_add_timed(web->conn->event.ctx, web->session,
- timeval_current_ofs(web->session->lifetime, 0),
- session_timeout, web->session);
+ if (esp->variables[ESP_SESSION_OBJ].properties == NULL ||
+ esp->variables[ESP_SESSION_OBJ].properties[0].numItems == 0) {
+ talloc_free(web->session);
+ web->session = NULL;
+ } else {
+ mprCopyVar(web->session->data, &esp->variables[ESP_SESSION_OBJ],
+ MPR_DEEP_COPY);
+ /* setup the timeout for the session data */
+ talloc_free(web->session->te);
+ web->session->te = event_add_timed(web->conn->event.ctx, web->session,
+ timeval_current_ofs(web->session->lifetime, 0),
+ session_timeout, web->session);
+ }
}
talloc_free(esp);