Ignore:
Timestamp:
Oct 7, 2015, 8:41:43 AM (9 years ago)
Author:
david
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/request_parser.c

    r654 r741  
    9292                       _("The maximum allowed occurrences for <%s> (%i) was exceeded."),
    9393                       mi->name, atoi (testMap->value));
    94               errorException (m, emsg, "InternalError", NULL);
     94              errorException (m, emsg, "InternalError", NULL,NULL);
    9595              return -1;
    9696            }
     
    113113                           ("ZOO-Kernel was unable to load your data for %s position %s."),
    114114                           mi->name, tmpMap->value);
    115                   errorException (m, emsg, "InternalError", NULL);
     115                  errorException (m, emsg, "InternalError", NULL,NULL);
    116116                  return -1;
    117117                }
     
    124124                       ("The maximum allowed occurrences for <%s> is one."),
    125125                       mi->name);
    126               errorException (m, emsg, "InternalError", NULL);
     126              errorException (m, emsg, "InternalError", NULL,NULL);
    127127              return -1;
    128128            }
     
    213213        free(cursor_input);
    214214        return errorException (*main_conf, _("Unable to allocate memory."),
    215                                "InternalError", NULL);
     215                               "InternalError", NULL,NULL);
    216216      }
    217217    int i = 0;
     
    224224            free(cursor_input);
    225225            return errorException (*main_conf, _("Unable to allocate memory."),
    226                                    "InternalError", NULL);
     226                                   "InternalError", NULL,NULL);
    227227          }
    228228        snprintf (inputs_as_text[i], strlen (pToken) + 1, "%s", pToken);
     
    261261                    return errorException (*main_conf,
    262262                                           _("Unable to allocate memory."),
    263                                            "InternalError", NULL);
     263                                           "InternalError", NULL,NULL);
    264264                  }
    265265                tmpmaps->name = zStrdup (tmpn);
     
    316316                                 tmpv1 + 1);
    317317                        free(cursor_input);
    318                         return errorException (*main_conf, emsg, "InternalError", NULL);
     318                        return errorException (*main_conf, emsg, "InternalError", NULL,NULL);
    319319                      }
    320320                    addToMap (tmpmaps->content, tmpn1, tmpx2);
    321                     {
    322321                      if (loadRemoteFile
    323322                          (&*main_conf, &tmpmaps->content, hInternet, tmpx2) < 0)
    324323                        {
    325324                          free(cursor_input);
    326                           return errorException (*main_conf, "Unable to fetch any ressource", "InternalError", NULL);
     325                          return errorException (*main_conf, "Unable to fetch any ressource", "InternalError", NULL,NULL);
    327326                        }
    328                       }
     327                     
    329328                    free (tmpx2);
    330329                    addIntToMap (tmpmaps->content, "Order", hInternet->nb);
     
    350349                          {
    351350                            free(cursor_input);
    352                             return errorException (*main_conf, "Unable to append maps", "InternalError", NULL);
     351                            return errorException (*main_conf, "Unable to append maps", "InternalError", NULL,NULL);
    353352                          }
    354353                      }
     
    402401          free(cursor_output);
    403402          return errorException (*main_conf, _("Unable to allocate memory"),
    404                                  "InternalError", NULL);
     403                                 "InternalError", NULL,NULL);
    405404        }
    406405      int i = 0;
     
    413412              free(cursor_output);
    414413              return errorException (*main_conf, _("Unable to allocate memory"),
    415                                      "InternalError", NULL);
     414                                     "InternalError", NULL,NULL);
    416415            }
    417416          snprintf (outputs_as_text[i], strlen (pToken) + 1, "%s",
     
    440439                                                 _
    441440                                                 ("Unable to allocate memory."),
    442                                                  "InternalError", NULL);
     441                                                 "InternalError", NULL,NULL);
    443442                        }
    444443                      tmp_output->name = zStrdup (tmpc);
     
    536535                                                 _
    537536                                                 ("Unable to allocate memory."),
    538                                                  "InternalError", NULL);
     537                                                 "InternalError", NULL,NULL);
    539538                        }
    540539                      tmpmaps->name = zStrdup ((char *) val);
     
    561560                                                 _
    562561                                                 ("Unable to allocate memory."),
    563                                                  "InternalError", NULL);
     562                                                 "InternalError", NULL,NULL);
    564563                        }
    565564                      tmpmaps->name = zStrdup ("missingIndetifier");
     
    613612                                                             _("Unable to add a request in the queue."),
    614613                                                             "InternalError",
    615                                                              NULL);
     614                                                             NULL,NULL);
    616615                                    }
    617616                                  addIntToMap (tmpmaps->content, "Order", hInternet->nb);
     
    665664                                                             ("Unable to allocate memory."),
    666665                                                             "InternalError",
    667                                                              NULL);
     666                                                             NULL,NULL);
    668667                                    }
    669668                                  snprintf (has,
     
    675674                              xmlFree (val);
    676675                            }
    677                           hInternet->ihandle[hInternet->nb].header = NULL;
    678                           hInternet->ihandle[hInternet->nb].header =
    679                             curl_slist_append (hInternet->ihandle
    680                                                [hInternet->nb].header,
    681                                                has);
    682                           if (has != NULL)
    683                             free (has);
     676                if (has != NULL){
     677                            hInternet->ihandle[hInternet->nb].header = NULL;
     678                            hInternet->ihandle[hInternet->nb].header =
     679                              curl_slist_append (hInternet->ihandle
     680                                                 [hInternet->nb].header,
     681                                                 has);
     682                            free (has);
     683                }
    684684                        }
    685685                      else
     
    781781                                                           ("Unable to allocate memory."),
    782782                                                           "InternalError",
    783                                                            NULL);
     783                                                           NULL,NULL);
    784784                                  }
    785785                                size_t bRead;
     
    951951                                  xmlDocDumpFormatMemoryEnc (doc1, &mv,
    952952                                                             &buffersize,
    953                                                              "utf-8", 1);
     953                                                             "utf-8", 0);
    954954                                  char size[1024];
    955955                                  sprintf (size, "%d", buffersize);
     
    966966                                    xmlDocDumpFormatMemoryEnc (doc1, &mv,
    967967                                                               &buffersize,
    968                                                                "utf-8", 1);
    969                                     char size[1024];
    970                                     sprintf (size, "%d", buffersize);
    971                                     addToMap (tmpmaps->content, "size",
    972                                               size);
    973                                     xmlFreeDoc (doc2);
     968                                                               "utf-8", 0);
     969                                    addIntToMap(tmpmaps->content, "size",buffersize);
     970                    xmlFreeDoc (doc2);
    974971                                    xmlFreeDoc (doc1);
    975972                                  }
     
    10241021                                               _("Unable to append maps to maps."),
    10251022                                               "InternalError",
    1026                                                NULL);
     1023                                               NULL,NULL);
    10271024                      }
    10281025                  }
     
    11131110            {
    11141111              return errorException (*main_conf, _("Unable to allocate memory."),
    1115                                      "InternalError", NULL);
     1112                                     "InternalError", NULL,NULL);
    11161113            }
    11171114          tmpmaps->name = zStrdup ("unknownIdentifier");
     
    12051202                                     _
    12061203                                     ("Unable to allocate memory."),
    1207                                      "InternalError", NULL);
     1204                                     "InternalError", NULL,NULL);
    12081205            }
    12091206            tmpmaps->name = zStrdup ("unknownIdentifier");
     
    12921289                                     _
    12931290                                     ("Duplicate <Output> elements in WPS Execute request"),
    1294                                      "InternalError", NULL);
     1291                                     "InternalError", NULL,NULL);
    12951292            }
    12961293            else {
     
    13201317 * @return 0 on success, -1 on failure
    13211318 */
    1322 int xmlParseRequest(maps** main_conf,const char* post,map** request_inputs,service* s,maps** inputs,maps** outputs,HINTERNET* hInternet){
     1319int xmlParseRequest(maps** main_conf,const char* post,map** request_inputs,service* s,maps** inputs,maps** outputs,HINTERNET* hInternet,struct cgi_env *cgi){
    13231320
    13241321  map* version=getMapFromMaps(*main_conf,"main","rversion");
     
    13261323
    13271324  xmlInitParser ();
    1328   xmlDocPtr doc = xmlParseMemory (post, cgiContentLength);
     1325  xmlDocPtr doc = xmlParseMemory (post, cgi->cgiContentLength);
    13291326
    13301327  /**
     
    14281425 * @see kvpParseOutputs,kvpParseInputs,xmlParseRequest
    14291426 */
    1430 int parseRequest(maps** main_conf,map** request_inputs,service* s,maps** inputs,maps** outputs,HINTERNET* hInternet){
     1427int parseRequest(maps** main_conf,map** request_inputs,service* s,maps** inputs,maps** outputs,HINTERNET* hInternet,struct cgi_env *cgi){
    14311428  map *postRequest = NULL;
    14321429  postRequest = getMap (*request_inputs, "xrequest");
     
    14431440    {
    14441441      //Parse XML request
    1445       if(xmlParseRequest(main_conf,postRequest->value,request_inputs,s,inputs,outputs,hInternet)<0){
     1442      if(xmlParseRequest(main_conf,postRequest->value,request_inputs,s,inputs,outputs,hInternet,cgi)<0){
    14461443        return -1;
    14471444      }
     
    14651462 * @see runHttpRequests
    14661463 */
    1467 int validateRequest(maps** main_conf,service* s,map* original_request, maps** request_inputs,maps** request_outputs,HINTERNET* hInternet){
    1468 
     1464int validateRequest(maps** main_conf,service* s,map* original_request, maps** request_inputs,maps** request_outputs,HINTERNET* hInternet,struct cgi_env * cgi){
     1465  fprintf(stderr,"STEP 1 VALIDATE \n");
     1466 
    14691467  runHttpRequests (main_conf, request_inputs, hInternet);
     1468fprintf(stderr,"STEP 2 VALIDATE \n");
     1469 
    14701470  InternetCloseHandle (hInternet);
    1471 
     1471  fprintf(stderr,"STEP 3 VALIDATE \n");
     1472               
    14721473  map* errI=NULL;
    14731474  char *dfv = addDefaultValues (request_inputs, s->inputs, *main_conf, 0,&errI);
     
    14911492              addToMap (tmpe, "locator", ptr->name);
    14921493              addToMap (tmpe, "text", tmps);
    1493               printExceptionReportResponse (*main_conf, tmpe);
     1494              printExceptionReportResponse (*main_conf, tmpe,NULL);
    14941495              freeMap (&tmpe);
    14951496              free (tmpe);
     
    14991500      ptr = ptr->next;
    15001501    }
    1501 
     1502fprintf(stderr,"STEP 4 VALIDATE \n");
     1503  dumpMaps(*request_outputs);
    15021504  map* errO=NULL;
    15031505  char *dfv1 =
    15041506    addDefaultValues (request_outputs, s->outputs, *main_conf, 1,&errO);
     1507    fprintf(stderr,"STEP 4 - 1 VALIDATE \n");
     1508 
    15051509  if (strcmp (dfv1, "") != 0 || strcmp (dfv, "") != 0)
    15061510    {
     
    15261530          }
    15271531        }
     1532    fprintf(stderr,"STEP 4 - 2 VALIDATE \n");
     1533 
    15281534      if (strcmp (dfv1, "") != 0)
    15291535        {
     
    15531559          }
    15541560        }
    1555       printExceptionReportResponse (*main_conf, tmpe);
     1561    fprintf(stderr,"STEP 4 - 3 VALIDATE \n");
     1562 
     1563      printExceptionReportResponse (*main_conf, tmpe,NULL);
    15561564      if(errI!=NULL){
    15571565        freeMap(&errI);
     
    15671575    }
    15681576  maps *tmpReqI = *request_inputs;
     1577  fprintf(stderr,"STEP 5 VALIDATE \n");
     1578 
    15691579  while (tmpReqI != NULL)
    15701580    {
     
    15721582      if (getMap (tmpReqI->content, "isFile") != NULL)
    15731583        {
    1574           if (cgiFormFileName (tmpReqI->name, name, sizeof (name)) ==
     1584          if (cgiFormFileName (tmpReqI->name, name, sizeof (name),&cgi) ==
    15751585              cgiFormSuccess)
    15761586            {
     
    15861596              int got, t;
    15871597              map *path = getMapFromMaps (*main_conf, "main", "tmpPath");
    1588               cgiFormFileSize (tmpReqI->name, &size);
     1598              cgiFormFileSize (tmpReqI->name, &size,&cgi);
    15891599              cgiFormFileContentType (tmpReqI->name, contentType,
    1590                                       sizeof (contentType));
    1591               if (cgiFormFileOpen (tmpReqI->name, &file) == cgiFormSuccess)
     1600                                      sizeof (contentType),&cgi);
     1601              if (cgiFormFileOpen (tmpReqI->name, &file,&cgi) == cgiFormSuccess)
    15921602                {
    15931603                  t = -1;
     
    16431653      tmpReqI = tmpReqI->next;
    16441654    }
    1645 
     1655fprintf(stderr,"STEP FINAL VALIDATE \n");
     1656 
    16461657  ensureDecodedBase64 (request_inputs);
    16471658  return 1;
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