From: Dave H. <hel...@us...> - 2013-07-19 16:54:46
|
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 87e189a4a2d69057c482fe03092d5e39114b857b (commit) from 3001ff9bc963f6d71353c474102de43306e0a1cb (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 87e189a4a2d69057c482fe03092d5e39114b857b Author: Dave Heller <hel...@us...> Date: Fri Jul 19 12:47:31 2013 -0400 [sfcb-tix:#64] Support maxObjCount for HTTP chunking ----------------------------------------------------------------------- Summary of changes: control.c | 5 +++-- httpAdapter.c | 9 +++++++-- result.c | 13 +++++++++++++ sfcBroker.c | 6 ------ sfcb.cfg.pre.in | 6 ++++++ 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/control.c b/control.c index 5f6e1c0..eb6c8f9 100644 --- a/control.c +++ b/control.c @@ -96,8 +96,9 @@ Control init[] = { {"doBasicAuth", CTL_BOOL, NULL, {.b=0}}, {"doUdsAuth", CTL_BOOL, NULL, {.b=0}}, - {"useChunking", CTL_BOOL, NULL, {.b=1}}, + {"useChunking", CTL_STRING, "true", {0}}, {"chunkSize", CTL_LONG, NULL, {.slong=50000}}, + {"maxChunkObjCount", CTL_ULONG, NULL, {.ulong=0}}, {"trimWhitespace", CTL_BOOL, NULL, {.b=1}}, @@ -167,7 +168,7 @@ sunsetControl() } static int -getUNum(char* str, unsigned long *val, unsigned int max) { +getUNum(char* str, unsigned long *val, unsigned long max) { if (isdigit(str[0])) { unsigned long tmp = strtoul(str, NULL, 0); diff --git a/httpAdapter.c b/httpAdapter.c index d1ddea3..950905e 100644 --- a/httpAdapter.c +++ b/httpAdapter.c @@ -2155,8 +2155,13 @@ httpDaemon(int argc, char *argv[], int sslMode, char *ipAddr, char* chunkStr; if (getControlChars("useChunking", &chunkStr) == 0) { - if (strcmp(chunkStr, "false") == 0) chunkMode = CHUNK_NEVER; - else if (strcmp(chunkStr, "always") == 0) chunkMode = CHUNK_FORCE; + if (strcmp(chunkStr, "false") == 0) { + chunkMode = CHUNK_NEVER; + mlogf(M_INFO, M_SHOW, "--- HTTP chunking disabled\n"); + } else if (strcmp(chunkStr, "always") == 0) { + mlogf(M_INFO, M_SHOW, "--- HTTP chunking always\n"); + chunkMode = CHUNK_FORCE; + } } name = argv[0]; diff --git a/result.c b/result.c index ade2f20..d894e41 100644 --- a/result.c +++ b/result.c @@ -38,6 +38,7 @@ extern int spRcvAck(int from); extern int getConstClassSerializedSize(CMPIConstClass *); extern void getSerializedConstClass(CMPIConstClass * cl, void *area); extern int getControlNum(char *id, long *val); +extern int getControlULong(char *id, unsigned long *val); extern int spSendResult2(int *to, int *from, void *d1, unsigned long s1, void *d2, unsigned long s2); @@ -155,6 +156,18 @@ nextResultBufferPos(NativeResult * nr, int type, unsigned long length) if (nr->data == NULL) prepResultBuffer(nr, length); + unsigned long maxChunkObjCount; + if (getControlULong("maxChunkObjCount", &maxChunkObjCount)) + maxChunkObjCount = 0; + if (maxChunkObjCount && nr->sNext > maxChunkObjCount && nr->requestor) { + /* + * hit maxChunkObjCount, send what we have + */ + xferResultBuffer(nr, nr->requestor, 1, 1, length); + nr->dNext = 0; + nr->sNext = 0; + } + /* * if there won't be enough room, send it off or make nr->data bigger */ diff --git a/sfcBroker.c b/sfcBroker.c index 92b659f..bc07632 100644 --- a/sfcBroker.c +++ b/sfcBroker.c @@ -610,7 +610,6 @@ main(int argc, char *argv[]) #endif int enableHttp = 0, enableHttps = 0, - useChunking = 0, doBa = 0, enableInterOp = 0, httpLocalOnly = 0; @@ -826,11 +825,6 @@ main(int argc, char *argv[]) sslMode = 0; #endif - if (getControlBool("useChunking", &useChunking)) - useChunking = 0; - if (useChunking == 0) - mlogf(M_INFO, M_SHOW, "--- Chunking disabled\n"); - if (getControlBool("doBasicAuth", &doBa)) doBa = 0; if (!doBa) diff --git a/sfcb.cfg.pre.in b/sfcb.cfg.pre.in index 5806b96..325d83d 100644 --- a/sfcb.cfg.pre.in +++ b/sfcb.cfg.pre.in @@ -77,6 +77,12 @@ useChunking: true ## Default is 50000 #chunkSize: 50000 +## Maximum number of objects to return per chunk. Note the actual number of +## objects returned may be limited by chunkSize. If 0, the maximum number of +## objects is unlimited. +## Default is 0 +#maxChunkObjCount: 0 + ## Maximum ContentLength of an HTTP request allowed. ## Default is 100000000 #httpMaxContentLength: 100000000 hooks/post-receive -- sfcb - Small Footprint CIM Broker |