|
From: Adrian S. <a3s...@us...> - 2005-06-26 21:52:20
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30692 Modified Files: cimXmlRequest.c cimXmlRequest.h httpAdapter.c httpComm.c Log Message: Added "TE: trailers" support. When not specified in XML requests chunking will not used in the reply. Improved tracing support in httpComm.c Index: httpComm.c =================================================================== RCS file: /cvsroot/sblim/sfcb/httpComm.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- httpComm.c 20 Jun 2005 13:09:44 -0000 1.2 +++ httpComm.c 26 Jun 2005 21:52:08 -0000 1.3 @@ -62,9 +62,19 @@ #ifdef SFCB_DEBUG if ((_sfcb_trace_mask & TRACE_XMLOUT) ) { - fprintf(stderr,"-#- xmlOut %d bytes:\n%*s",count,count,(char*)data); - if (*(((char*)data)+count-1)!='\n') fprintf(stderr,"\n"); - fprintf(stderr,"-#- xmlOut end\n"); + char *mp,*m=alloca(count*2),*d=(char*)data; + int i; + fprintf(stderr,"->> xmlOut %d bytes:\n",count); + for (mp=m,i=0; i<count; i++) + switch (d[i]) { + case '\r': *mp++='\\'; *mp++='r'; break; + case '\n': *mp++='\\'; *mp++='n'; break; + case ' ' : *mp++='~'; break; + default: *mp++=d[i]; + } + *mp=0; + fprintf(stderr,"%s\n",m); + fprintf(stderr,"-<< xmlOut end\n"); } #endif Index: httpAdapter.c =================================================================== RCS file: /cvsroot/sblim/sfcb/httpAdapter.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- httpAdapter.c 20 Jun 2005 13:09:34 -0000 1.12 +++ httpAdapter.c 26 Jun 2005 21:52:08 -0000 1.13 @@ -399,7 +399,7 @@ static char cach[] = {"Cache-Control: no-cache\r\n"}; static char op[] = {"CIMOperation: MethodResponse\r\n"}; static char tenc[] = {"Transfer-encoding: chunked\r\n"}; - static char trls[] = {"Trailers: CIMError, CIMStatusCode, CIMStatusCodeDescription\r\n"}; + static char trls[] = {"Trailer: CIMError, CIMStatusCode, CIMStatusCodeDescription\r\n"}; _SFCB_ENTER(TRACE_HTTPDAEMON, "writeChunkHeaders"); @@ -684,7 +684,7 @@ { CimXmlRequestContext ctx = - { inBuf.content, inBuf.principle, inBuf.host, len - hl, &conn_fd }; + { inBuf.content, inBuf.principle, inBuf.host, inBuf.trailers, len - hl, &conn_fd }; ctx.chunkFncs=&httpChunkFunctions; #ifdef SFCB_DEBUG Index: cimXmlRequest.h =================================================================== RCS file: /cvsroot/sblim/sfcb/cimXmlRequest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- cimXmlRequest.h 11 Apr 2005 23:13:41 -0000 1.2 +++ cimXmlRequest.h 26 Jun 2005 21:52:08 -0000 1.3 @@ -51,6 +51,7 @@ char *cimXmlDoc; char *principal; char *host; + int teTrailers; unsigned long cimXmlDocLength; struct commHndl *commHndl; struct chunkFunctions *chunkFncs; Index: cimXmlRequest.c =================================================================== RCS file: /cvsroot/sblim/sfcb/cimXmlRequest.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- cimXmlRequest.c 13 Jun 2005 23:37:31 -0000 1.12 +++ cimXmlRequest.c 26 Jun 2005 21:52:08 -0000 1.13 @@ -799,7 +799,8 @@ binCtx.type=CMPI_class; binCtx.xmlAs=binCtx.noResp=0; binCtx.chunkFncs=ctx->chunkFncs; - if (noChunking) + + if (noChunking || ctx->teTrailers==0) hdr->chunkedMode=binCtx.chunkedMode=0; else { sreq.flags|=FL_chunked; @@ -819,7 +820,7 @@ closeProviderContext(&binCtx); - if (noChunking) { + if (noChunking || ctx->teTrailers==0) { if (err == 0) _SFCB_RETURN(genResponses(&binCtx, resp, l)) _SFCB_RETURN(iMethodErrResponse(hdr, getErrSegment(resp[err-1]->rc, (char*)resp[err-1]->object[0].data))); @@ -1175,7 +1176,7 @@ binCtx.xmlAs=binCtx.noResp=0; binCtx.chunkFncs=ctx->chunkFncs; - if (noChunking) + if (noChunking || ctx->teTrailers==0) hdr->chunkedMode=binCtx.chunkedMode=0; else { sreq->flags|=FL_chunked; @@ -1195,7 +1196,7 @@ closeProviderContext(&binCtx); free(sreq); - if (noChunking) { + if (noChunking || ctx->teTrailers==0) { if (err == 0) _SFCB_RETURN(genResponses(&binCtx, resp, l)) _SFCB_RETURN(iMethodErrResponse(hdr, getErrSegment(resp[err-1]->rc, (char*)resp[err-1]->object[0].data))); @@ -1252,7 +1253,8 @@ binCtx.type=CMPI_instance; binCtx.xmlAs=XML_asObj; binCtx.noResp=0; binCtx.chunkFncs=ctx->chunkFncs; - if (noChunking) + + if (noChunking || ctx->teTrailers==0) hdr->chunkedMode=binCtx.chunkedMode=0; else { sreq.flags|=FL_chunked; @@ -1272,7 +1274,7 @@ _SFCB_TRACE(1, ("--- Back from Provider")); closeProviderContext(&binCtx); - if (noChunking) { + if (noChunking || ctx->teTrailers==0) { if (err == 0) _SFCB_RETURN(genResponses(&binCtx, resp, l)) _SFCB_RETURN(iMethodErrResponse(hdr, getErrSegment(resp[err-1]->rc, (char*)resp[err-1]->object[0].data))); @@ -1418,7 +1420,8 @@ binCtx.xmlAs=XML_asObj; binCtx.noResp=0; binCtx.pAs=NULL; binCtx.chunkFncs=ctx->chunkFncs; - if (noChunking) + + if (noChunking || ctx->teTrailers==0) hdr->chunkedMode=binCtx.chunkedMode=0; else { sreq->flags|=FL_chunked; @@ -1438,7 +1441,7 @@ closeProviderContext(&binCtx); free(sreq); - if (noChunking) { + if (noChunking || ctx->teTrailers==0) { if (err == 0) _SFCB_RETURN(genResponses(&binCtx, resp, l)) _SFCB_RETURN(iMethodErrResponse(hdr, getErrSegment(resp[err-1]->rc, (char*)resp[err-1]->object[0].data))); @@ -1579,7 +1582,8 @@ binCtx.xmlAs=XML_asObj; binCtx.noResp=0; binCtx.pAs=NULL; binCtx.chunkFncs=ctx->chunkFncs; - if (noChunking) + + if (noChunking || ctx->teTrailers==0) hdr->chunkedMode=binCtx.chunkedMode=0; else { sreq->flags|=FL_chunked; @@ -1598,7 +1602,7 @@ closeProviderContext(&binCtx); free(sreq); - if (noChunking) { + if (noChunking || ctx->teTrailers==0) { if (err == 0) _SFCB_RETURN(genResponses(&binCtx, resp, l)) _SFCB_RETURN(iMethodErrResponse(hdr, getErrSegment(resp[err-1]->rc, (char*)resp[err-1]->object[0].data))); |