Changeset 817
- Timestamp:
- Feb 2, 2017, 4:24:57 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/kernel/configuration.rst
r796 r817 127 127 -------------------------------- 128 128 129 All the additional sections discribed in the following section are 130 optional. 131 129 132 Headers section 130 133 ............................... … … 225 228 value stored before the Service execution. 226 229 230 Security section 231 ............................... 232 233 The ``[security]`` section can be used to define what headers, the 234 ZOO-Kernel has initially received in the request, should be passed 235 to other servers for accessing resources (such as WMS, WFS, WCS 236 or any other file passed as a reference). This section contains two 237 parameters: 238 239 * ``attributes``: The header to pass to other servers (such as 240 Authorization, Cookie, User-Agent ...), 241 * ``hosts``: The host for wich the restriction apply (can be "*" to 242 forward header to every server or a coma separated list of host 243 names, domain, IP). 244 245 Both parameters are mandatory. 246 247 Suppose you need to share Authorization, Cookie and User-Agent to 248 every server for accessing ressources, then yo ucan use the following 249 section definition: 250 251 .. code:: 252 253 [security] 254 attributes=Authorization,Cookie,User-Agent 255 hosts=* 256 257 In case only local servers require such header forwarding, you may use 258 the following definition: 259 260 .. code:: 261 262 [security] 263 attributes=Authorization,Cookie,User-Agent 264 hosts=localhost,127.0.0.1 265 266 227 267 .. _zoo_activate_db_backend: 228 268 -
trunk/thirds/cgic206/Makefile
r768 r817 3 3 ifeq ($(OS),Darwin) 4 4 MACOS_CFLAGS=-arch x86_64 5 LIBS= -L./ -lcgic /usr/l ib/libfcgi.dylib5 LIBS= -L./ -lcgic /usr/local/lib/libfcgi.dylib 6 6 else 7 7 LIBS= -L./ -lcgic /usr/lib/libfcgi.a 8 8 endif 9 CFLAGS=- g -Wall ${MACOS_CFLAGS}9 CFLAGS=-I/usr/local/include -g -Wall ${MACOS_CFLAGS} 10 10 CC=gcc 11 11 AR=ar -
trunk/zoo-project/HISTORY.txt
r799 r817 1 Version 1.6.0-dev 1 Version 1.7.0-dev 2 * Pass all headers listed in the attributes parameter from the 3 [security] section to the hosts listed in the hosts parameter of the 4 same section (ticket #139) 5 6 Version 1.6.0 2 7 * Add the C# as a supported programming language for Services 3 8 * Add nested inputs and outputs support (WPS 2.0.0) -
trunk/zoo-project/zoo-kernel/caching.c
r797 r817 292 292 int hasAFailure=0; 293 293 if(hInternet!=NULL && hInternet->nb>0){ 294 AddHeaderEntries(hInternet,*m); 294 295 processDownloads(hInternet); 295 296 maps* content=*inputs; -
trunk/zoo-project/zoo-kernel/configure.ac
r813 r817 1 AC_INIT([ZOO Kernel], [1. 6.0], [bugs@zoo-project.org])1 AC_INIT([ZOO Kernel], [1.7.0], [bugs@zoo-project.org]) 2 2 3 3 # Checks for programs. -
trunk/zoo-project/zoo-kernel/ulinet.c
r797 r817 30 30 #include "ulinet.h" 31 31 #include <assert.h> 32 #include <ctype.h> 32 33 33 34 /** … … 219 220 220 221 /** 222 * Add missing headers to an existing _HINTERNET 223 * 224 * 225 * @param handle the _HINTERNET pointer 226 * @param key the header parameter name 227 * @param value the header parameter value 228 * @return 0 if the operation succeeded, -1 in other case. 229 */ 230 int AddMissingHeaderEntry(_HINTERNET* handle,const char* key,const char* value){ 231 int length=strlen(key)+strlen(value)+3; 232 char *entry=(char*)malloc((length)*sizeof(char)); 233 if(entry==NULL) 234 return -1; 235 snprintf (entry, length, "%s: %s", key, value); 236 handle->header = curl_slist_append (handle->header, entry); 237 free(entry); 238 return 0; 239 } 240 241 /** 242 * Verify if a host is protected (appear in [security] > hosts) 243 * 244 * @param protectedHosts string containing all the protected hosts (coma separated) 245 * @param url string used to extract the host from 246 * @return 1 if the host is listed as protected, 0 in other case 247 */ 248 int isProtectedHost(const char* protectedHosts,const char* url){ 249 char *token, *saveptr; 250 token = strtok_r (url, "//", &saveptr); 251 int cnt=0; 252 char* host; 253 while(token!=NULL && cnt<=1){ 254 fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,token); 255 if(cnt==1) 256 fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,strstr(protectedHosts,token)); 257 fflush(stderr); 258 if(cnt==1 && strstr(protectedHosts,token)!=NULL){ 259 fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,strstr(protectedHosts,token)); 260 return 1; 261 } 262 token = strtok_r (NULL, "/", &saveptr); 263 cnt+=1; 264 } 265 return 0; 266 } 267 268 /** 269 * Add headers defined in [security] > attributes to an existing HINTERNET 270 * @see isProtectedHost, AddMissingHeaderEntry 271 * 272 * @param handle the _HINTERNET pointer 273 * @param conf the header parameter name 274 * @param value the header parameter value 275 * @return 0 if the operation succeeded, -1 in other case. 276 */ 277 void AddHeaderEntries(HINTERNET* handle,maps* conf){ 278 map* passThrough=getMapFromMaps(conf,"security","attributes"); 279 map* targetHosts=getMapFromMaps(conf,"security","hosts"); 280 char* passedHeader[10]; 281 int cnt=0; 282 if(passThrough!=NULL && targetHosts!=NULL){ 283 char *tmp=zStrdup(passThrough->value); 284 char *token, *saveptr; 285 token = strtok_r (tmp, ",", &saveptr); 286 for(int i=0;i<handle->nb;i++){ 287 if(targetHosts->value[0]=='*' || isProtectedHost(targetHosts->value,handle->ihandle[i].url)==1){ 288 while (token != NULL){ 289 int length=strlen(token)+6; 290 char* tmp1=(char*)malloc(length*sizeof(char)); 291 snprintf(tmp1,6,"HTTP_"); 292 for(int i=0;token[i]!='\0';i++){ 293 if(token[i]!='-') 294 tmp1[5+i]=toupper(token[i]); 295 else 296 tmp1[5+i]='_'; 297 tmp1[5+i+1]='\0'; 298 } 299 fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,tmp1); 300 map* tmpMap = getMapFromMaps(conf,"renv",tmp1); 301 if(tmpMap!=NULL) 302 AddMissingHeaderEntry(&handle->ihandle[i],token,tmpMap->value); 303 free(tmp1); 304 if(handle->ihandle[i].header!=NULL) 305 curl_easy_setopt(handle->ihandle[i].handle,CURLOPT_HTTPHEADER,handle->ihandle[i].header); 306 cnt+=1; 307 token = strtok_r (NULL, ",", &saveptr); 308 } 309 } 310 } 311 free(tmp); 312 } 313 } 314 315 /** 221 316 * Close a HINTERNET connection and free allocated resources 222 317 * … … 241 336 if(handle.post!=NULL) 242 337 free(handle.post); 338 if(handle.url!=NULL) 339 free(handle.url); 243 340 free(handle.mimeType); 244 341 handle.mimeType = NULL; … … 270 367 hInternet->ihandle[hInternet->nb].hasCacheFile=0; 271 368 hInternet->ihandle[hInternet->nb].nDataAlloc = 0; 369 hInternet->ihandle[hInternet->nb].url = NULL; 272 370 hInternet->ihandle[hInternet->nb].mimeType = NULL; 273 371 hInternet->ihandle[hInternet->nb].nDataLen = 0; … … 340 438 341 439 curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle,CURLOPT_URL,lpszUrl); 440 hInternet->ihandle[hInternet->nb].url = zStrdup(lpszUrl); 342 441 343 442 curl_multi_add_handle(hInternet->handle,hInternet->ihandle[hInternet->nb].handle); -
trunk/zoo-project/zoo-kernel/ulinet.h
r630 r817 30 30 #include <fcntl.h> 31 31 #include <curl/curl.h> 32 #include "service.h" 32 33 #ifndef WIN32 33 34 #include <unistd.h> … … 84 85 FILE* file; //!< the file pointer 85 86 unsigned char *pabyData; //!< the downloaded content 87 char *url; //!< the url used to access the server 86 88 char *mimeType; //!< the mimeType returned by the server 87 89 char *post; //!< the potential POST XML content … … 134 136 HINTERNET InternetOpen(char*,int,char*,char*,int); 135 137 138 int isProtectedHost(const char*,const char*); 139 int AddMissingHeaderEntry(_HINTERNET*,const char*,const char*); 140 void AddHeaderEntries(HINTERNET*,maps*); 141 136 142 void InternetCloseHandle(HINTERNET*); 137 143 -
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r794 r817 2100 2100 addMapsToMaps (&m, tmpSess); 2101 2101 freeMaps (&tmpSess); 2102 free (tmpSess);2103 2102 } 2103 free (tmpSess); 2104 2104 } 2105 2105 }
Note: See TracChangeset
for help on using the changeset viewer.