Ignore:
Timestamp:
Feb 6, 2020, 3:12:42 PM (5 months ago)
Author:
knut
Message:

Added function for allocating memory for map values (allocateMapValue). Fixed issue with getting attributes from input data node. Added code to support MIME subtype attributes in key-value pairs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/request_parser.c

    r946 r957  
    416416      while (pToken != NULL)
    417417        {
    418           outputs_as_text[i] =
     418/*        outputs_as_text[i] =
    419419            (char *) malloc ((strlen (pToken) + 1) * sizeof (char));
    420420          if (outputs_as_text[i] == NULL)
     
    427427                    pToken);
    428428          pToken = strtok (NULL, ";");
    429           i++;
     429          i++; */
     430         
     431          // knut : rewrite above fragment to enable parsing of mimetype;subtype strings in key-value pairs:
     432         
     433          char* _token = zStrdup(pToken);
     434          pToken = strtok (NULL, ";");
     435         
     436          if (pToken != NULL && strncmp(pToken, "subtype=", 8) == 0)
     437          {
     438                 size_t _length = strlen(pToken) + strlen(_token) + 2;
     439                 outputs_as_text[i] = (char *) malloc(_length * sizeof (char));
     440                 snprintf(outputs_as_text[i], _length, "%s;%s", _token, pToken);
     441                 pToken = strtok (NULL, ";");
     442          }
     443          else
     444          {
     445                 outputs_as_text[i] = (char *) malloc((strlen(_token) + 1) * sizeof (char));
     446                 snprintf (outputs_as_text[i], strlen(_token) + 1, "%s", _token);               
     447          }
     448          free(_token);
     449          i++;   
    430450        }
    431451      for (j = 0; j < i; j++)
     
    862882                    for (l = 0; l < 3; l++){
    863883                      xmlChar *val =
    864                           xmlGetProp (cur4, BAD_CAST coms[l]);
     884                          //xmlGetProp (cur4, BAD_CAST coms[l]);
     885                          xmlGetProp (cur2, BAD_CAST coms[l]);   // knut : get attributes from the Data xml element, not it's children (the content)
    865886                        if (val != NULL && strlen ((char *) val) > 0){
    866887                          if (tmpmaps->content != NULL)
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