Ignore:
Timestamp:
Jan 8, 2013, 3:54:57 PM (11 years ago)
Author:
djay
Message:

Fix issue in JS support and for binary RawDataOutput?. Add Content-Length and Content-Disposition (optional) to response header. Add support to JS ZOO-API for sending headers and handling multi-valued inputs.

File:
1 edited

Legend:

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

    r379 r383  
    17451745  xmlNodePtr n;
    17461746
     1747  printHeaders(m);
    17471748  doc = xmlNewDoc(BAD_CAST "1.0");
    17481749  maps* tmpMap=getMaps(m,"main");
     
    18991900          // mimeType information if present here. Maybe we can add more formats
    19001901          // here.
    1901           // If mimeType was not found, we then set txt as the default extension.
     1902          // If mimeType was not found, we then set txt as the default extension
    19021903          map* mtype=getMap(tmpI->content,"mimeType");
    19031904          if(mtype!=NULL){
     
    19191920        file_name=(char*)malloc((strlen(tmp1->value)+strlen(s->name)+strlen(ext->value)+strlen(tmpI->name)+13)*sizeof(char));
    19201921        sprintf(file_name,"%s/%s_%s_%i.%s",tmp1->value,s->name,tmpI->name,cpid+100000,ext->value);
    1921         FILE *ofile=fopen(file_name,"w");
     1922        FILE *ofile=fopen(file_name,"wb");
    19221923        if(ofile==NULL)
    19231924          fprintf(stderr,"Unable to create file on disk implying segfault ! \n");
     
    20002001          return;
    20012002        }
     2003        map* fname=getMapFromMaps(tmpI,tmpI->name,"filename");
     2004        if(fname!=NULL)
     2005          printf("Content-Disposition: attachment; filename=\"%s\"\r\n",fname->value);
     2006        map* rs=getMapFromMaps(tmpI,tmpI->name,"size");
     2007        if(rs!=NULL)
     2008          printf("Content-Length: %s\r\n",rs->value);
     2009
    20022010        char mime[1024];
    20032011        map* mi=getMap(tmpI->content,"mimeType");
     
    20202028            sprintf(mime,"Content-Type: text/plain; charset=utf-8\r\nStatus: 200 OK\r\n\r\n");
    20212029        printf("%s",mime);
    2022         if(mi!=NULL && strncmp(mi->value,"image",5)==0){
    2023           map* rs=getMapFromMaps(tmpI,tmpI->name,"size");
     2030        if(rs!=NULL)
    20242031          fwrite(toto->value,atoi(rs->value),1,stdout);
    2025         }
    20262032        else
    2027           printf("%s",toto->value);
     2033          fwrite(toto->value,strlen(toto->value),1,stdout);
    20282034#ifdef DEBUG
    20292035        dumpMap(toto);
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