[mapserver-commits] r7632 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Fri May 30 01:00:11 EDT 2008


Author: sdlime
Date: 2008-05-30 01:00:10 -0400 (Fri, 30 May 2008)
New Revision: 7632

Modified:
   trunk/mapserver/maptemplate.c
Log:
Added checks to make sure certain env vars exist before trying to use in a template. (bug 2589)

Modified: trunk/mapserver/maptemplate.c
===================================================================
--- trunk/mapserver/maptemplate.c	2008-05-30 04:43:22 UTC (rev 7631)
+++ trunk/mapserver/maptemplate.c	2008-05-30 05:00:10 UTC (rev 7632)
@@ -2955,10 +2955,14 @@
     outstr = msReplaceSubstring(outstr, "[map]", repstr);
   }
 
-  snprintf(repstr, PROCESSLINE_BUFLEN, "%s", getenv("HTTP_HOST")); 
-  outstr = msReplaceSubstring(outstr, "[host]", repstr);
-  snprintf(repstr, PROCESSLINE_BUFLEN, "%s", getenv("SERVER_PORT"));
-  outstr = msReplaceSubstring(outstr, "[port]", repstr);
+  if(getenv("HTTP_HOST")) {
+    snprintf(repstr, PROCESSLINE_BUFLEN, "%s", getenv("HTTP_HOST")); 
+    outstr = msReplaceSubstring(outstr, "[host]", repstr);
+  }
+  if(getenv("SERVER_PORT")) { 
+    snprintf(repstr, PROCESSLINE_BUFLEN, "%s", getenv("SERVER_PORT"));
+    outstr = msReplaceSubstring(outstr, "[port]", repstr);
+  }
   
   snprintf(repstr, PROCESSLINE_BUFLEN, "%s", mapserv->Id);
   outstr = msReplaceSubstring(outstr, "[id]", repstr);



More information about the mapserver-commits mailing list