Content-type in Post Requests
When the client doesn't send an content-type in the HTTP-header mapserver
segfaults. The patch below fixes the problem.
diff -ur mapserver-4.8.0-rc2/cgiutil.c mapserver-4.8.0-rc2.new/cgiutil.c
--- mapserver-4.8.0-rc2/cgiutil.c 2006-01-26 15:00:33.000000000 +0100
+++ mapserver-4.8.0-rc2.new/cgiutil.c 2006-01-26 15:00:26.000000000 +0100
@@ -129,9 +129,14 @@
char *post_data;
request->type = MS_POST_REQUEST;
- request->contenttype = strdup(getenv("CONTENT_TYPE"));
-
post_data = readPostBody( request );
+ if (s = getenv("CONTENT_TYPE"))
+ request->contenttype = strdup(s);
+ /* we've to set default content-type which is
+ * application/octet-stream according to
+ * W3 RFC 2626 section 7.2.1 */
+ else request->contenttype = "application/octet-stream";
+
if(strcmp(request->contenttype, "application/x-www-form-urlencoded"))
request->postrequest = post_data;
else
Change History
(5)
Resolution: |
→ fixed
|
Status: |
assigned → closed
|