Index: /trunk/zoo-project/HISTORY.txt
===================================================================
--- /trunk/zoo-project/HISTORY.txt	(revision 944)
+++ /trunk/zoo-project/HISTORY.txt	(revision 945)
@@ -1,4 +1,6 @@
 Version 1.8.0-dev
-  * Fix #172
+  * Fix issue in case JavaScript support is activated
+  * Fix issue with GDAL profile service
+  * Fix #172 for https support 
 Version 1.7.0
   * Fix issue with UOM definitions in zcfg2sql
Index: /trunk/zoo-project/zoo-kernel/response_print.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/response_print.c	(revision 944)
+++ /trunk/zoo-project/zoo-kernel/response_print.c	(revision 945)
@@ -1001,5 +1001,5 @@
  */
 void printDescribeProcessForProcess(registry *reg, maps* m,xmlDocPtr doc,xmlNodePtr nc,service* serv){
-  xmlNsPtr ns,ns_ows,ns_xlink; 
+  xmlNsPtr ns,ns_ows,ns_xlink;
   xmlNodePtr n,nc1;
   xmlNodePtr nc2 = NULL;
@@ -1146,5 +1146,6 @@
 	xmlNewProp(nc2,BAD_CAST "maxOccurs",BAD_CAST "1");
       if((tmp1=getMap(e->content,"maximumMegabytes"))!=NULL){
-	xmlNewProp(nc2,BAD_CAST "maximumMegabytes",BAD_CAST tmp1->value);
+	if(vid==0)
+	  xmlNewProp(nc2,BAD_CAST "maximumMegabytes",BAD_CAST tmp1->value);
       }
     }
@@ -1243,5 +1244,11 @@
 	  }
 	}
-      
+
+	if((tmp1=getMap(e->content,"maximumMegabytes"))!=NULL){
+	  if(vid==1)
+	    xmlNewProp(nc5,BAD_CAST "maximumMegabytes",BAD_CAST tmp1->value);
+	}
+
+
 	tmp1=_tmp->content;
 
@@ -1617,4 +1624,10 @@
 	    }
 	  }
+
+	if((tmp1=getMap(e->content,"maximumMegabytes"))!=NULL){
+	  if(vid==1)
+	    xmlNewProp(nc5,BAD_CAST "maximumMegabytes",BAD_CAST tmp1->value);
+	}
+
 	tmp1=_tmp->content;
 	int oI=0;
Index: /trunk/zoo-project/zoo-kernel/service_internal.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 944)
+++ /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 945)
@@ -198,14 +198,16 @@
   int res=-1;
   if(s!=NULL){
+    int fcntlRes;
     s->lock.l_type = F_UNLCK;
     res=fcntl(fileno(s->lockfile), F_SETLK, &s->lock);
     if(res==-1)
       return res;
-    fclose(s->lockfile);
 #ifndef WIN32
     // Check if there is any process locking a file and delete the lock if not.
     s->lock.l_type = F_WRLCK;
-    if(fcntl(fileno(s->lockfile), F_GETLK, &s->lock)!=-1 && s->lock.l_type == F_UNLCK){
-#endif
+    fcntlRes=fcntl(fileno(s->lockfile), F_GETLK, &s->lock);
+    if(fcntlRes!=1 && s->lock.l_type == F_UNLCK){
+#endif
+      fclose(s->lockfile);
       zUnlink(s->filename);
 #ifndef WIN32
Index: /trunk/zoo-project/zoo-kernel/ulinet.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/ulinet.h	(revision 944)
+++ /trunk/zoo-project/zoo-kernel/ulinet.h	(revision 945)
@@ -26,4 +26,12 @@
 #define _ULINET_H 1
 
+#ifdef USE_JS
+#ifdef WIN32
+#define XP_WIN 1
+#else
+#define XP_UNIX 0
+#endif
+#include "jsapi.h"
+#endif
 #include "fcgi_stdio.h"
 #include <stdlib.h>
@@ -37,12 +45,4 @@
 #include <string.h>
 #include "time.h"
-#ifdef USE_JS
-#ifdef WIN32
-#define XP_WIN 1
-#else
-#define XP_UNIX 0
-#endif
-#include "jsapi.h"
-#endif
 #ifndef __cplusplus
 // knut: see new def of bool in service.h
Index: /trunk/zoo-project/zoo-services/gdal/profile/service.c
===================================================================
--- /trunk/zoo-project/zoo-services/gdal/profile/service.c	(revision 944)
+++ /trunk/zoo-project/zoo-services/gdal/profile/service.c	(revision 945)
@@ -182,6 +182,6 @@
 #endif
   }
+  GDALClose(hDataset);
   OGRCleanupAll();
-  GDALClose(hDataset);
   GDALDestroyDriverManager();
 #ifdef ZOO_SERVICE
