From: Narasimha S. <nsh...@us...> - 2012-05-21 21:22:44
|
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 0e2196798140db45b8f9f35aa3da636ae8f6153c (commit) from 87f9c4a243f5040f7dbe778c036df6d738c85061 (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 0e2196798140db45b8f9f35aa3da636ae8f6153c Author: Narasimha Sharoff <nsh...@us...> Date: Mon May 21 14:21:19 2012 -0700 [ 3527920 ] RI and http response codes Signed-off-by: Narasimha Sharoff <nsh...@us...> ----------------------------------------------------------------------- Summary of changes: diff --git a/ChangeLog b/ChangeLog index 1aa3f86..28a0d37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-05-21 Narasimha Sharoff <nsh...@us...> + + * indCIMXMLExport.c, indCIMXMLHander.c: + [ 3527920 ] RI and http response codes + 2012-05-18 Chris Buccella <buc...@li...> * objectImpl.c: diff --git a/NEWS b/NEWS index 3dfeb98..b6112fe 100644 --- a/NEWS +++ b/NEWS @@ -97,6 +97,7 @@ New Features: - 3501314 Add dynamic logging and syslog output to sfcb trace - 3517530 Implement mark, release routines in CMPIBrokerMemFT - 3513390 Enforce LD and subscription limits +- 3527920 RI and http responsecodes Bugs Fixed: - 3514627 unsupported sfcb.cfg param - use exit call diff --git a/indCIMXMLExport.c b/indCIMXMLExport.c index 1c00e0d..dbaa4b3 100644 --- a/indCIMXMLExport.c +++ b/indCIMXMLExport.c @@ -325,15 +325,29 @@ getResponse(CurlData * cd, char **msg) // Use CURLINFO_HTTP_CODE instead of CURLINFO_RESPONSE_CODE // (more portable to older versions of curl) curl_easy_getinfo(cd->mHandle, CURLINFO_HTTP_CODE, &responseCode); - if (responseCode == 401) { - error = (cd->mUserPass) ? "Invalid username/password." : - "Username/password required."; - *msg = strdup(error); - rc = 3; - } else { - rc = 4; - *msg = getErrorMessage(rv); - } + switch(responseCode) { + case 200: + rc = 0; /* HTTP 200 is OK. set rc to 0 */ + break; + case 400: + *msg = strdup("Bad Request"); + rc = 400; + break; + case 401: + error = (cd->mUserPass) ? "Invalid username/password." : + "Username/password required."; + *msg = strdup(error); + rc = 401; + break; + case 501: + *msg = strdup("Not Implemented"); + rc = 501; + break; + default: + *msg = getErrorMessage(rv); + rc = (int)responseCode; + break; + } return rc; } diff --git a/indCIMXMLHandler.c b/indCIMXMLHandler.c index a2dd6c1..300c5a3 100644 --- a/indCIMXMLHandler.c +++ b/indCIMXMLHandler.c @@ -603,6 +603,7 @@ deliverInd(const CMPIObjectPath * ref, const CMPIArgs * in, CMPIInstance * ind) static int id = 1; char *resp; char *msg; + int rc = 0; if ((hci = internalProviderGetInstance(ref, &st)) == NULL) { setStatus(&st, CMPI_RC_ERR_NOT_FOUND, NULL); @@ -615,9 +616,10 @@ deliverInd(const CMPIObjectPath * ref, const CMPIArgs * in, CMPIInstance * ind) sprintf(strId, "%d", id++); xs = exportIndicationReq(ind, strId); sb = segments2stringBuffer(xs.segments); - if (exportIndication - ((char *) dest->hdl, (char *) sb->ft->getCharPtr(sb), &resp, &msg)) { - setStatus(&st, CMPI_RC_ERR_FAILED, NULL); + rc = exportIndication((char*)dest->hdl, + (char*)sb->ft->getCharPtr(sb), &resp, &msg); + if (rc != 0) { + setStatus(&st,rc,NULL); } RespSegment rs = xs.segments[5]; UtilStringBuffer *usb = (UtilStringBuffer *) rs.txt; @@ -1104,8 +1106,14 @@ IndCIMXMLHandlerInvokeMethod(CMPIMethodMI * mi, // Now send the indication st = deliverInd(ref, in, ind); - if (st.rc != 0) { - if (RIEnabled){ + + switch (st.rc) { + case 0: /* Success */ + case 400: /* Bad Request XML */ + case 501: /* Not Implemented */ + break; + default: + if (RIEnabled){ _SFCB_TRACE(1,("--- Indication delivery failed, adding to retry queue")); // Indication delivery failed, send to retry queue // build an element @@ -1140,6 +1148,7 @@ IndCIMXMLHandlerInvokeMethod(CMPIMethodMI * mi, } CMRelease(ctxLocal); } + break; } CMRelease(ind); } hooks/post-receive -- SFCB - Small Footprint CIM Broker |