From: Chris B. <buc...@us...> - 2012-03-08 19:38:12
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "SFCB - Small Footprint CIM Broker". The branch, master has been updated via 727cf3bdd65a052d974edb2743b396b43f2eadd0 (commit) via 8bfabeb46c06f2bd713ca1b9beb7fa0fb644eb60 (commit) from c5daa606337010b51fc2e6700be6db08fabd5c2f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 727cf3bdd65a052d974edb2743b396b43f2eadd0 Merge: 8bfabeb c5daa60 Author: buccella <buc...@li...> Date: Thu Mar 8 14:37:59 2012 -0500 ChangeLog merge commit 8bfabeb46c06f2bd713ca1b9beb7fa0fb644eb60 Author: buccella <buc...@li...> Date: Thu Mar 8 14:36:19 2012 -0500 [ 3440300 ] Allow forced chunked responses [ 3492362 ] Problem with whitespace trimming if local connect only ----------------------------------------------------------------------- Summary of changes: diff --git a/ChangeLog b/ChangeLog index 44c8b6c..47af6ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-03-08 Chris Buccella <buc...@li...> + + * httpAdapter.c, cimRequest.c, sfcBroker.c: + [ 3440300 ] Allow forced chunked responses + [ 3492362 ] Problem with whitespace trimming if local connect only + 2012-03-07 Dave Heller <hel...@us...> * httpAdapter.c: diff --git a/NEWS b/NEWS index ba548c8..10427f1 100644 --- a/NEWS +++ b/NEWS @@ -94,6 +94,7 @@ New Features: - 3493493 Add sfcbsem - 3498932 Implement ModifyInstance for CIM_ListenerDestination +- 3440300 Allow forced chunked responses Bugs Fixed: @@ -112,6 +113,7 @@ Bugs Fixed: - 3497950 SFCB Semaphore Handling Improvements - 3498275 Remove __Namespace - 3426027 cimAccountPassThrough does not set return code +- 3492362 Problem with whitespace trimming if local connect only Changes in 1.3.13 ================= diff --git a/cimRequest.c b/cimRequest.c index fddc810..0b63bb1 100644 --- a/cimRequest.c +++ b/cimRequest.c @@ -58,11 +58,6 @@ #define SFCB_ASM(x) #endif -#ifdef LOCAL_CONNECT_ONLY_ENABLE -// from httpAdapter.c -int noChunking = 0; -#endif // LOCAL_CONNECT_ONLY_ENABLE - typedef struct handler { RespSegments(*handler) (CimRequestContext *, RequestHdr * hdr); } Handler; @@ -71,7 +66,6 @@ typedef struct scanner { RequestHdr (*scan) (CimRequestContext*, char*,int*); } Scanner; -extern int noChunking; extern CMPIBroker *Broker; //extern UtilStringBuffer *newStringBuffer(int s); @@ -828,7 +822,7 @@ enumClasses(CimRequestContext * ctx, RequestHdr * hdr) BinResponseHdr **resp; _SFCB_ENTER(TRACE_CIMXMLPROC, "enumClasses"); - if (noChunking || ctx->teTrailers == 0) + if (ctx->teTrailers == 0) hdr->chunkedMode = hdr->binCtx->chunkedMode = 0; else { hdr->binCtx->bHdr->flags |= FL_chunked; @@ -850,7 +844,7 @@ enumClasses(CimRequestContext * ctx, RequestHdr * hdr) closeProviderContext(hdr->binCtx); - if (noChunking || ctx->teTrailers == 0) { + if (ctx->teTrailers == 0) { if (err == 0) { rs = genResponses(hdr->binCtx, resp, l); } else { @@ -1088,8 +1082,9 @@ enumInstances(CimRequestContext * ctx, RequestHdr * hdr) err = 0; BinResponseHdr **resp; - if (noChunking || ctx->teTrailers == 0) + if (ctx->teTrailers == 0) { hdr->chunkedMode = hdr->binCtx->chunkedMode = 0; + } else { hdr->binCtx->bHdr->flags |= FL_chunked; hdr->chunkedMode = hdr->binCtx->chunkedMode = 1; @@ -1109,7 +1104,7 @@ enumInstances(CimRequestContext * ctx, RequestHdr * hdr) _SFCB_TRACE(1, ("--- Back from Providers")); closeProviderContext(hdr->binCtx); - if (noChunking || ctx->teTrailers == 0) { + if (ctx->teTrailers == 0) { if (err == 0) { rs = genResponses(hdr->binCtx, resp, l); } else { @@ -1147,7 +1142,7 @@ execQuery(CimRequestContext * ctx, RequestHdr * hdr) hdr->binCtx->commHndl = ctx->commHndl; hdr->binCtx->chunkFncs = ctx->chunkFncs; - if (noChunking || ctx->teTrailers == 0) + if (ctx->teTrailers == 0) hdr->chunkedMode = hdr->binCtx->chunkedMode = 0; else { hdr->binCtx->bHdr->flags |= FL_chunked; @@ -1166,7 +1161,7 @@ execQuery(CimRequestContext * ctx, RequestHdr * hdr) _SFCB_TRACE(1, ("--- Back from Provider")); closeProviderContext(hdr->binCtx); - if (noChunking || ctx->teTrailers == 0) { + if (ctx->teTrailers == 0) { if (err == 0) { rs = genResponses(hdr->binCtx, resp, l); } else { @@ -1244,7 +1239,7 @@ associators(CimRequestContext * ctx, RequestHdr * hdr) hdr->binCtx->commHndl = ctx->commHndl; hdr->binCtx->chunkFncs = ctx->chunkFncs; - if (noChunking || ctx->teTrailers == 0) + if (ctx->teTrailers == 0) hdr->chunkedMode = hdr->binCtx->chunkedMode = 0; else { hdr->binCtx->bHdr->flags |= FL_chunked; @@ -1263,7 +1258,7 @@ associators(CimRequestContext * ctx, RequestHdr * hdr) closeProviderContext(hdr->binCtx); - if (noChunking || ctx->teTrailers == 0) { + if (ctx->teTrailers == 0) { if (err == 0) { rs = genResponses(hdr->binCtx, resp, l); } else { @@ -1342,7 +1337,7 @@ references(CimRequestContext * ctx, RequestHdr * hdr) hdr->binCtx->commHndl = ctx->commHndl; hdr->binCtx->chunkFncs = ctx->chunkFncs; - if (noChunking || ctx->teTrailers == 0) + if (ctx->teTrailers == 0) hdr->chunkedMode = hdr->binCtx->chunkedMode = 0; else { hdr->binCtx->bHdr->flags |= FL_chunked; @@ -1360,7 +1355,7 @@ references(CimRequestContext * ctx, RequestHdr * hdr) _SFCB_TRACE(1, ("--- Back from Provider")); closeProviderContext(hdr->binCtx); - if (noChunking || ctx->teTrailers == 0) { + if (ctx->teTrailers == 0) { if (err == 0) { rs = genResponses(hdr->binCtx, resp, l); } else { diff --git a/httpAdapter.c b/httpAdapter.c index f9d2830..4602878 100644 --- a/httpAdapter.c +++ b/httpAdapter.c @@ -82,7 +82,12 @@ static int doBa; static int doUdsAuth; #endif static int doFork = 0; -int noChunking = 0; + +#define CHUNK_NEVER 0 +#define CHUNK_ALLOW 1 +#define CHUNK_FORCE 2 +int chunkMode = CHUNK_ALLOW; + int sfcbSSLMode = 0; /* used as a global sslMode */ int httpLocalOnly = 0; /* 1 = only listen on loopback * interface */ @@ -95,7 +100,6 @@ static long keepaliveMaxRequest = 10; static long numRequest; static long selectTimeout = 5; /* default 5 sec. timeout for select() before read() */ struct timeval httpSelectTimeout = { 0, 0 }; -int trimws; #if defined USE_SSL static SSL_CTX *ctx; @@ -1110,7 +1114,9 @@ doHttpRequest(CommHndl conn_fd) ctx.cimDoc = inBuf.content; ctx.principal = inBuf.principal; ctx.host = inBuf.host; - ctx.teTrailers = inBuf.trailers; + /* override based on sfcb.cfg value */ + ctx.teTrailers = (chunkMode == CHUNK_FORCE) ? 1 : inBuf.trailers; + if (chunkMode == CHUNK_NEVER) ctx.teTrailers = 0; ctx.cimDocLength = len - hl; ctx.commHndl = &conn_fd; ctx.contentType = inBuf.content_type; @@ -1878,12 +1884,11 @@ httpDaemon(int argc, char *argv[], int sslMode) if (getControlNum("keepaliveMaxRequest", &keepaliveMaxRequest)) keepaliveMaxRequest = 10; - if (getControlBool("useChunking", &noChunking)) - noChunking = 0; - noChunking = noChunking == 0; - - if (getControlBool("trimWhitespace", &trimws)) - trimws = 0; + char* chunkStr; + if (getControlChars("useChunking", &chunkStr) == 0) { + if (strcmp(chunkStr, "false") == 0) chunkMode = CHUNK_NEVER; + else if (strcmp(chunkStr, "always") == 0) chunkMode = CHUNK_FORCE; + } /* * grab commandline options diff --git a/sfcBroker.c b/sfcBroker.c index b755fe5..dcf7412 100644 --- a/sfcBroker.c +++ b/sfcBroker.c @@ -93,6 +93,8 @@ static int adaptersStopped = 0, extern char *configfile; +int trimws = 1; + typedef struct startedAdapter { struct startedAdapter *next; int stopped; @@ -781,6 +783,11 @@ main(int argc, char *argv[]) "--- Max provider process number adjusted to %d\n", pSockets); } + /* Check for whitespace trimming option */ + if (getControlBool("trimWhitespace", &trimws)) { + trimws = 0; + } + if ((enableHttp || enableHttps) && dSockets > 0) { startHttp = 1; } hooks/post-receive -- SFCB - Small Footprint CIM Broker |