svn commit: samba r7014 - in branches/SAMBA_4_0/source/web_server: .

tridge at samba.org tridge at samba.org
Fri May 27 12:05:36 GMT 2005


Author: tridge
Date: 2005-05-27 12:05:36 +0000 (Fri, 27 May 2005)
New Revision: 7014

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7014

Log:
added Content-Length header to both esp and non-esp output

Modified:
   branches/SAMBA_4_0/source/web_server/http.c


Changeset:
Modified: branches/SAMBA_4_0/source/web_server/http.c
===================================================================
--- branches/SAMBA_4_0/source/web_server/http.c	2005-05-27 11:57:14 UTC (rev 7013)
+++ branches/SAMBA_4_0/source/web_server/http.c	2005-05-27 12:05:36 UTC (rev 7014)
@@ -60,6 +60,7 @@
 	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 @@
 	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;



More information about the samba-cvs mailing list