Changeset 797 for trunk/zoo-project


Ignore:
Timestamp:
Jan 10, 2017, 5:21:45 PM (3 years ago)
Author:
djay
Message:

Return an ExceptionReport? in case any inpts failed to be downloaded.

Location:
trunk/zoo-project/zoo-kernel
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/Makefile.in

    r794 r797  
    7777        g++ -c ${XML2CFLAGS} ${PHPCFLAGS} ${CFLAGS}  ${PHP_ENABLED} service_internal_php.c
    7878
     79service_internal_php7.o: service_internal_php7.c service.h
     80        g++ -c ${XML2CFLAGS} ${PHPCFLAGS} ${CFLAGS}  ${PHP_ENABLED} service_internal_php7.c
     81
    7982service_internal_perl.o: service_internal_perl.c service.h
    8083        gcc -c ${XML2CFLAGS} ${PERLCFLAGS} ${CFLAGS}  ${PERL_ENABLED} service_internal_perl.c
  • trunk/zoo-project/zoo-kernel/caching.c

    r790 r797  
    154154 * @param index the input index
    155155 * @param hInternet the internet connection
    156  * @return 0 in case of success, 4 in case of failure
    157  */
    158 int readCurrentInput(maps** m,maps** in,int* index,HINTERNET* hInternet){
     156 * @param error the error map pointer
     157 * @return 0 in case of success, -1 in case of failure
     158 */
     159int readCurrentInput(maps** m,maps** in,int* index,HINTERNET* hInternet,map** error){
    159160  map* tmp1;
    160161  char sindex[5];
     
    207208     
    208209      if(getMap(content->content,icname)==NULL){
    209        
    210210        fcontent=(char*)malloc((hInternet->ihandle[*index].nDataLen+1)*sizeof(char));
    211211        if(fcontent == NULL){
    212           return errorException(*m, _("Unable to allocate memory"), "InternalError",NULL);
     212          errorException(*m, _("Unable to allocate memory"), "InternalError",NULL);
     213          return -1;
    213214        }
    214215        size_t dwRead;
     
    231232        }
    232233        memcpy(tmpMap->value,fcontent,(fsize+1)*sizeof(char));
     234        if(hInternet->ihandle[*index].code!=200){
     235          char *error_rep_str=_("Unable to download the file for the input <%s>, response code was : %d.");
     236          char *error_msg=(char*)malloc((strlen(error_rep_str)+strlen(content->name)+4)*sizeof(char));
     237          sprintf(error_msg,error_rep_str,content->name,hInternet->ihandle[*index].code);
     238          if(*error==NULL){
     239            *error=createMap("text",error_msg);
     240            addToMap(*error,"locator",content->name);
     241            addToMap(*error,"code","InvalidParameterValue");
     242          }else{
     243            int nb=1;
     244            map* tmpMap=getMap(*error,"length");
     245            if(tmpMap!=NULL)
     246              nb=atoi(tmpMap->value);
     247            setMapArray(*error,"text",nb,error_msg);
     248            setMapArray(*error,"locator",nb,content->name);
     249            setMapArray(*error,"code",nb,"InvalidParameterValue");
     250          }
     251          return -1;
     252        }
    233253       
    234254        char ltmp1[256];
     
    266286 *  per default based on the zcfg file)
    267287 * @param hInternet the HINTERNET pointer
    268  * @return 0 on success
    269  */
    270 int runHttpRequests(maps** m,maps** inputs,HINTERNET* hInternet){
     288 * @param error the error map pointer
     289 * @return 0 on success, -1 on failure
     290 */
     291int runHttpRequests(maps** m,maps** inputs,HINTERNET* hInternet,map** error){
     292  int hasAFailure=0;
    271293  if(hInternet!=NULL && hInternet->nb>0){
    272294    processDownloads(hInternet);
     
    277299        maps* cursor=content->child;
    278300        while(cursor!=NULL){
    279           readCurrentInput(m,&cursor,&index,hInternet);
     301          int red=readCurrentInput(m,&cursor,&index,hInternet,error);
     302          if(red<0)
     303            hasAFailure=red;
    280304          cursor=cursor->next;
    281305        }
    282306      }
    283       else
    284         readCurrentInput(m,&content,&index,hInternet);
     307      else{
     308        int red=readCurrentInput(m,&content,&index,hInternet,error);
     309        if(red<0)
     310          hasAFailure=red;
     311      }
    285312      content=content->next;
    286     } 
    287   }
    288   return 0;
     313    }
     314  }
     315  return hasAFailure;
    289316}
    290317
  • trunk/zoo-project/zoo-kernel/caching.h

    r642 r797  
    3232  void addToCache(maps*,char*,char*,char*,int,char*,size_t);
    3333  char* isInCache(maps*,char*);
    34   int runHttpRequests(maps**,maps**,HINTERNET*);
     34  int runHttpRequests(maps**,maps**,HINTERNET*,map**);
    3535  void addRequestToQueue(maps**,HINTERNET*,const char*,bool);
    3636  int loadRemoteFile(maps**,map**,HINTERNET*,char*);
  • trunk/zoo-project/zoo-kernel/configure.ac

    r794 r797  
    422422        if test  "$PYTHON_PATH" = "yes"
    423423        then
    424                 # PHP was not specified, so search within the current path
     424                # PYTHON was not specified, so search within the current path
    425425                PYTHONCFG_PATH=`which python${PYTHON_VERS}-config`
    426426                if test -z "${PYTHONCFG_PATH}" ; then
     
    529529        [PHP_PATH="$withval"; PHP_ENABLED="-DUSE_PHP"], [PHP_ENABLED=""])
    530530
     531AC_ARG_WITH([php-version],
     532        [AS_HELP_STRING([--with-phpvers=NUM], [To use a specific php version])],
     533        [PHP_VERS="$withval"], [PHP_VERS=""])
     534
    531535
    532536if test -z "$PHP_ENABLED"
     
    535539else
    536540        PHPCONFIG="$PHP_PATH/bin/php-config"
    537         PHP_FILE="service_internal_php.o"
     541        if test "x$PHP_VERS" = "x7"
     542        then
     543                PHP_FILE="service_internal_php7.o"
     544        else
     545                PHP_FILE="service_internal_php.o"
     546        fi
    538547        if test  "$PHP_PATH" = "yes"
    539548        then
     
    545554
    546555        # Extract the linker and include flags
    547         PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5"
     556        if test "x$PHP_VERS" = "x7"
     557        then
     558                PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib64 -lphp7"
     559        else
     560                PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5"
     561        fi
    548562        PHP_CPPFLAGS=`$PHPCONFIG --includes`
    549563
     
    558572        LIBS="$PHP_LDFLAGS"
    559573        # Shouldn't we get php here rather than php5 :) ??
    560         AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
     574        if test "x$PHP_VERS" = "x7"
     575        then
     576                echo $LIBS
     577                #AC_CHECK_LIB([php7], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
     578        else
     579                AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
     580        fi
    561581        LIBS="$LIBS_SAVE"
    562582        AC_SUBST([PHP_CPPFLAGS])
  • trunk/zoo-project/zoo-kernel/request_parser.c

    r794 r797  
    15151515int validateRequest(maps** main_conf,service* s,map* original_request, maps** request_inputs,maps** request_outputs,HINTERNET* hInternet){
    15161516
    1517   runHttpRequests (main_conf, request_inputs, hInternet);
     1517  map* errI0=NULL;
     1518  runHttpRequests (main_conf, request_inputs, hInternet,&errI0);
     1519  if(errI0!=NULL){
     1520    printExceptionReportResponse (*main_conf, errI0);
     1521    InternetCloseHandle (hInternet);
     1522    return -1;
     1523  }
    15181524  InternetCloseHandle (hInternet);
     1525
    15191526
    15201527  map* errI=NULL;
  • trunk/zoo-project/zoo-kernel/response_print.c

    r790 r797  
    22062206 *
    22072207 * @param m the maps containing the settings of the main.cfg file
    2208  * @param s the map containing the text,code,locator keys
     2208 * @param s the map containing the text,code,locator keys (or a map array of the same keys)
    22092209 */
    22102210void printExceptionReportResponse(maps* m,map* s){
  • trunk/zoo-project/zoo-kernel/ulinet.c

    r781 r797  
    9292#endif
    9393    sscanf((char*)buffer,"%s; path=%s; domain=%s",env,path,domain);
    94     tmp=strcat(env,CCookie[0]);
     94    _HINTERNET *psInternet=(_HINTERNET *)data;
     95    tmp=strcat(env,CCookie[psInternet->id][0]);
    9596#ifdef MSG_LAF_OUT
    9697    printf("\n**Cookie env : [%s] , path : [%s], domain : [%s]**\n",env,path,domain);
    9798    printf("buffer : %d (%s) (%s) (%s)\n",(buffer==NULL),buffer,tmp,CCookie);
    9899#endif
    99     strcpy(CCookie[0],tmp);
     100    strcpy(CCookie[psInternet->id][0],tmp);
    100101  }
    101102  return size * nmemb;//write_data_into(buffer,size,nmemb,data,HEADER);
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png