diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-05-27 12:05:36 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:06 -0500 |
commit | b63ce2f4795168eb871a54db71e0a117ea26b8c9 (patch) | |
tree | ba54a4026bc95b11fdee622b401d5c2fa206f684 /source4/web_server | |
parent | ebb0b35242f5c2967afdba9e746679bc87c5b745 (diff) | |
download | samba-b63ce2f4795168eb871a54db71e0a117ea26b8c9.tar.gz samba-b63ce2f4795168eb871a54db71e0a117ea26b8c9.tar.bz2 samba-b63ce2f4795168eb871a54db71e0a117ea26b8c9.zip |
r7014: added Content-Length header to both esp and non-esp output
(This used to be commit e0673dcfc0056b3a1b72ef0b10d82948ca8c9819)
Diffstat (limited to 'source4/web_server')
-rw-r--r-- | source4/web_server/http.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source4/web_server/http.c b/source4/web_server/http.c index 11ddec552d..36704a1370 100644 --- a/source4/web_server/http.c +++ b/source4/web_server/http.c @@ -60,6 +60,7 @@ static void http_output_headers(struct websrv_context *web) int i; char *s; DATA_BLOB b; + uint32_t content_length = 0; const char *response_string = "Unknown Code"; const struct { unsigned code; @@ -90,7 +91,15 @@ static void http_output_headers(struct websrv_context *web) for (i=0;web->output.headers[i];i++) { s = talloc_asprintf_append(s, "%s\r\n", web->output.headers[i]); } - s = talloc_asprintf_append(s, "\r\n"); + + /* work out the content length */ + content_length = web->output.content.length; + if (web->output.fd != -1) { + struct stat st; + fstat(web->output.fd, &st); + content_length += st.st_size; + } + s = talloc_asprintf_append(s, "Content-Length: %u\r\n\r\n", content_length); if (s == NULL) return; b = web->output.content; |