How about these bugfixes?

(Not tested)


-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
From ca31f07117f96880030e9e707fd7cdca87fdea00 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?=C3=98yvind=20Harboe?= <oyvind.har...@zylin.com>
Date: Sun, 8 Nov 2009 19:50:35 +0100
Subject: [PATCH] httpd: fix warnings, more robust error handling, improved MIME handling
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

The httpd is work in progress...

No mime type set by default. Let the browser guess.

Signed-off-by: Øyvind Harboe <oyvind.har...@zylin.com>
---
 src/server/httpd.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/server/httpd.c b/src/server/httpd.c
index 0ddeb97..00724f8 100644
--- a/src/server/httpd.c
+++ b/src/server/httpd.c
@@ -123,7 +123,7 @@ static int httpd_Jim_Command_writeform(Jim_Interp *interp, int argc,
 
 	const char *script = alloc_printf("set dummy_val $httppostdata(%s); set dummy_val",
 			name);
-	retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__);
+	retcode = Jim_Eval_Named(interp, script, __FILE__, __LINE__);
 	free((void *) script);
 	if (retcode != JIM_OK)
 		return retcode;
@@ -164,7 +164,7 @@ httpd_Jim_Command_formfetch(Jim_Interp *interp,
 
     const char *script = alloc_printf("set dummy_val $httppostdata(%s); set dummy_val",
     			name);
-    	int retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__);
+    	int retcode = Jim_Eval_Named(interp, script, __FILE__, __LINE__);
     	free((void *) script);
     	if (retcode != JIM_OK)
     	{
@@ -288,10 +288,10 @@ static int handle_request(struct MHD_Connection * connection, const char * url)
 
 		const char *script = alloc_printf(
 				"global httpdata; source {%s}; set httpdata", url);
-		retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__);
+		retcode = Jim_Eval_Named(interp, script, __FILE__, __LINE__);
 		free((void *) script);
 
-		if (retcode == JIM_ERR)
+		if (retcode != JIM_OK)
 		{
 			printf("Tcl failed\n");
 			const char *t = httpd_exec_cgi_tcl_error(interp);
@@ -341,7 +341,7 @@ static int handle_request(struct MHD_Connection * connection, const char * url)
 		LOG_DEBUG("Serving %s length=%zu", url, len);
 		/* serve file directly */
 		response = MHD_create_response_from_data(len, data, MHD_YES, MHD_NO);
-		MHD_add_response_header(response, "Content-Type", "image/png");
+//		MHD_add_response_header(response, "Content-Type", "image/png");
 
 		ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
 		MHD_destroy_response(response);
@@ -353,7 +353,7 @@ static int handle_request(struct MHD_Connection * connection, const char * url)
 
 static int ahc_echo_inner(void * cls, struct MHD_Connection * connection,
 		const char * url, const char * method, const char * version,
-		const char * upload_data, unsigned int * upload_data_size, void ** ptr)
+		const char * upload_data, size_t * upload_data_size, void ** ptr)
 {
 	int post = 0;
 
@@ -442,7 +442,7 @@ static int ahc_echo_inner(void * cls, struct MHD_Connection * connection,
 
 static int ahc_echo(void * cls, struct MHD_Connection * connection,
 		const char * url, const char * method, const char * version,
-		const char * upload_data, unsigned int * upload_data_size, void ** ptr)
+		const char * upload_data, size_t * upload_data_size, void ** ptr)
 {
 	int result;
 
-- 
1.6.3.3

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to