|
From: Gareth S B. <bes...@us...> - 2005-06-23 22:54:22
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19213 Modified Files: client.c test.c Log Message: added temp fix for http://sourceforge.net/tracker/index.php?func=detail&aid=1226647&group_id=128809&atid=712784 Index: client.c =================================================================== RCS file: /cvsroot/sblim/sfcc/client.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- client.c 20 Jun 2005 15:04:18 -0000 1.14 +++ client.c 23 Jun 2005 22:54:11 -0000 1.15 @@ -122,7 +122,6 @@ UtilStringBuffer *sb=newStringBuffer(1024); char userPwd[256]; char method[256]="CIMMethod: "; - if (!con->mHandle) return "Unable to initialize curl interface."; @@ -134,23 +133,23 @@ con->mUri->ft->reset(con->mUri); con->mUri->ft->append6Chars(con->mUri,cld->scheme,"://",cld->hostName,":",cld->port,"/cimom"); - sb->ft->appendChars(sb,"CIMObject: "); - //url.ns.toStringBuffer(sb,"%2F"); + // HACK - fix this to instead parse cop to obtain namespace components and put them in CIMObject + sb->ft->appendChars(sb, "CIMObject: root%2Fcimv2"); - /* Initialize curl with the url */ + /* Initialize curl with the url */ rv = curl_easy_setopt(con->mHandle, CURLOPT_URL, con->mUri->ft->getCharPtr(con->mUri)); - /* Disable progress output */ + /* Disable progress output */ rv = curl_easy_setopt(con->mHandle, CURLOPT_NOPROGRESS, 1); - /* This will be a HTTP post */ + /* This will be a HTTP post */ rv = curl_easy_setopt(con->mHandle, CURLOPT_POST, 1); - /* Disable SSL verification */ + /* Disable SSL verification */ rv = curl_easy_setopt(con->mHandle, CURLOPT_SSL_VERIFYHOST, 0); rv = curl_easy_setopt(con->mHandle, CURLOPT_SSL_VERIFYPEER, 0); - /* Set username and password */ + /* Set username and password */ if (cld->user) { strcpy(userPwd,cld->user); if (cld->pwd) { @@ -159,33 +158,32 @@ } } - // Initialize default headers - con->ft->initializeHeaders(con); - - // Add CIMMethod header - strcat(method,op); - con->mHeaders = curl_slist_append(con->mHeaders, method); + // Initialize default headers + con->ft->initializeHeaders(con); - // Add CIMObject header - con->mHeaders = curl_slist_append(con->mHeaders, sb->ft->getCharPtr(sb)); + // Add CIMMethod header + strcat(method,op); + con->mHeaders = curl_slist_append(con->mHeaders, method); + // Add CIMObject header + con->mHeaders = curl_slist_append(con->mHeaders, sb->ft->getCharPtr(sb)); - // Set all of the headers for the request - rv = curl_easy_setopt(con->mHandle, CURLOPT_HTTPHEADER, con->mHeaders); + // Set all of the headers for the request + rv = curl_easy_setopt(con->mHandle, CURLOPT_HTTPHEADER, con->mHeaders); - // Set up the callbacks to store the response - rv = curl_easy_setopt(con->mHandle, CURLOPT_WRITEFUNCTION, writeCb); + // Set up the callbacks to store the response + rv = curl_easy_setopt(con->mHandle, CURLOPT_WRITEFUNCTION, writeCb); - // Use CURLOPT_FILE instead of CURLOPT_WRITEDATA - more portable - rv = curl_easy_setopt(con->mHandle, CURLOPT_FILE, con->mResponse); + // Use CURLOPT_FILE instead of CURLOPT_WRITEDATA - more portable + rv = curl_easy_setopt(con->mHandle, CURLOPT_FILE, con->mResponse); - // Fail if we receive an error (HTTP response code >= 300) - rv = curl_easy_setopt(con->mHandle, CURLOPT_FAILONERROR, 1); + // Fail if we receive an error (HTTP response code >= 300) + rv = curl_easy_setopt(con->mHandle, CURLOPT_FAILONERROR, 1); - // Turn this on to enable debugging - rv = curl_easy_setopt(con->mHandle, CURLOPT_VERBOSE, 1); + // Turn this on to enable debugging + rv = curl_easy_setopt(con->mHandle, CURLOPT_VERBOSE, 1); - return NULL; + return NULL; } /* --------------------------------------------------------------------------*/ Index: test.c =================================================================== RCS file: /cvsroot/sblim/sfcc/test.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- test.c 20 Jun 2005 15:17:02 -0000 1.11 +++ test.c 23 Jun 2005 22:54:12 -0000 1.12 @@ -110,13 +110,13 @@ if (objectpath) CMRelease(objectpath); } - if (0) { + if (1) { /* Test enumClasses() */ printf("\n----------------------------------------------------------\n"); printf("Testing enumClasses() ...\n"); objectpath = newCMPIObjectPath("root/cimv2", NULL, NULL); enumeration = cc->ft->enumClasses(cc, objectpath, 0, &status); - + /* Print the results */ printf("enumClasses() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); if (!status.rc) { @@ -130,11 +130,11 @@ if (objectpath) CMRelease(objectpath); } - if (1) { + if (0) { /* Test getClass() */ printf("\n----------------------------------------------------------\n"); printf("Testing getClass() ...\n"); - objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + objectpath = newCMPIObjectPath("root/cimv2", "CIM_ComputerSystem", NULL); class = cc->ft->getClass(cc, objectpath, 0, NULL, &status); /* Print the results */ @@ -151,7 +151,7 @@ /* Test enumInstanceNames() */ printf("\n----------------------------------------------------------\n"); printf("Testing enumInstanceNames() ...\n"); - objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + objectpath = newCMPIObjectPath("root/cimv2", "CIM_ComputerSystem", NULL); enumeration = cc->ft->enumInstanceNames(cc, objectpath, &status); /* Print the results */ @@ -171,7 +171,7 @@ /* Test enumInstances() */ printf("\n----------------------------------------------------------\n"); printf("Testing enumInstances() ...\n"); - objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); + objectpath = newCMPIObjectPath("root/cimv2", "CIM_ComputerSystem", NULL); enumeration = cc->ft->enumInstances(cc, objectpath, 0, NULL, &status); /* Print the results */ @@ -191,8 +191,8 @@ /* Test getInstance() */ printf("\n----------------------------------------------------------\n"); printf("Testing getInstance() ...\n"); - objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); - CMAddKey(objectpath, "CreationClassName", "Linux_ComputerSystem", CMPI_chars); + objectpath = newCMPIObjectPath("root/cimv2", "CIM_ComputerSystem", NULL); + CMAddKey(objectpath, "CreationClassName", "CIM_ComputerSystem", CMPI_chars); CMAddKey(objectpath, "Name", _HOSTNAME, CMPI_chars); instance = cc->ft->getInstance(cc, objectpath, 0, NULL, &status); |