On Sun, Aug 16, 2009 at 6:55 PM, tatebn <[email protected]> wrote:

>
> It looks at this point like everything is find if the URL option isn't
> set.  Any idea why that would be?  I don't know enough about incoming/
> outgoing connection setttings to know how to check whether or not the
> cgi is allowed to connect to anything.  My current guess is that it's
> not, and that's why it dies with an outgoing connection.  Any insight
> or helpful advice?
>

can you send the "ldd" output for your cgi, curlpp and libcurl?
if you don't know what is ldd, type this on the command line:

man ldd


>
> Thanks,
> Brandon
>
> On Aug 16, 12:17 am, tatebn <[email protected]> wrote:
> > So it looks like the curlpp examples are working, but the program I
> > need to work still isn't.  Here's the code, what in here would make
> > perform() die?
> >
> > Note: perform() also dies if I comment out all the options except
> > host.
> >
> > //--------------------------------------------------------------------
> > // Includes
> > //--------------------------------------------------------------------
> > #include "verisign_io.h"
> > #include "file_io.h"
> > #include "error_lib.h"
> > #include "logging.h"
> > #include "toolkit.h"
> > #include "parm.h"
> >
> > //using current time in seconds and credit card number for unique
> > transaction id
> > #include <time.h>
> > #include <string>
> > #include <sstream>
> > #include <iostream>
> >
> > //#include "curl/curl.h"
> > #include <curlpp/cURLpp.hpp>
> > #include <curlpp/Easy.hpp>
> > #include <curlpp/Options.hpp>
> > #include <curlpp/Exception.hpp>
> >
> > #ifdef CGI_VERSION
> >         #include "cgic.h"
> > #endif
> >
> > //
> > *********************************************************************
> > // Global Functions
> > //
> > *********************************************************************
> >
> > //--------------------------------------------------------------------
> > // GetValueFromResponseString
> > //--------------------------------------------------------------------
> > bool GetValueFromResponseString (const char* key,
> >
> > TString& value,
> >
> > TString responseString)
> > {
> >         char*           startPtr        = NULL;
> >         char*           endPtr          = NULL;
> >         size_t          offset          = 0;
> >         size_t          length          = 0;
> >
> >         value = "";
> >
> >         startPtr = responseString.Find (key);
> >         if (startPtr)
> >         {
> >                 startPtr += strlen(key);
> >                 offset = responseString.PointerToOffset (startPtr);
> >                 endPtr = responseString.Find ("&", true, offset);
> >                 if (endPtr)
> >                         length = endPtr - startPtr;
> >                 else
> >                         length = strlen(startPtr);
> >
> >                 value = responseString.SubString(offset,length);
> >         }
> >
> >         return (startPtr != NULL);
> >
> > }
> >
> > //--------------------------------------------------------------------
> > // CallVerisign
> > //--------------------------------------------------------------------
> > bool CallVerisign (const TDBSplitReport* dbObjPtr,
> >                                          TString creditCardNumber,
> >                                          TString expirationDate,
> >                                          float amount,
> >                                          TString customerZipCode,
> >                                          TString customerAddress,
> >                                          TString authorizationCode,
> >                                          TString transactionType,
> >                                          TString comment,
> >                                          TString& answerText,
> >                                          TString& referenceID)
> > {
> >         bool                    success = false;
> >         bool                    isTest = false;
> >         //int                           verisignContext;
> >         int                             resultCode;
> >         TString                 localAmount;
> >         TString                 verisignArgs;
> >         TString                 responseMessage;
> >         //TString                       referenceID;
> >         TString                 tmpString;
> >         TString                 responseString;
> >         TString                 logEntry;
> >         //char                  *responseBuffer;
> >
> > AddLogEntry(dbObjPtr, "INFO\tVerisign.cc\tAbout to setup
> > environment");
> >
> >         // Setup the environment so it can find the certificate
> >         setenv("PFPRO_CERT_PATH", "/usr/local/verisign/payflowpro/
> > linux/certs", 1);
> >
> >         // Nullify the answer text
> >         answerText = "";
> >         // Adjust some arguments
> >         creditCardNumber.NumbersOnly();
> >         expirationDate.NumbersOnly();
> >         customerZipCode.NumbersOnly();
> >         if (customerZipCode.IsEmpty())
> >                 customerZipCode = "99999";
> >         customerZipCode = customerZipCode.SubString(0,5);
> >         if (comment.IsEmpty())
> >                 comment = "---";
> >         comment = comment.SubString(0,18);
> >         localAmount.CopyFrom(amount,2);
> >         // convert expiration from YYYY to MMYY format
> >         tmpString = expirationDate;
> >         expirationDate = tmpString.SubString(4,2);
> >         expirationDate += tmpString.SubString(2,2);
> >
> >         // setup the log entry
> >         logEntry = "Verisign Transaction\t";
> >         logEntry += transactionType;
> >         logEntry += "\t";
> >         logEntry += comment;
> >         logEntry += "\t";
> >         logEntry += localAmount;
> >         logEntry += "\t";
> >         tmpString = creditCardNumber.SubString(0,1);
> >         tmpString += "-";
> >         tmpString += creditCardNumber.SubString(0,4,true);
> >         logEntry += tmpString;
> >         logEntry += "\t";
> >         logEntry += expirationDate;
> >         logEntry += "\t";
> >
> > AddLogEntry(dbObjPtr, "INFO\tVerisign.cc\tEntering Try");
> >
> > try{
> >         if (strcasecmp(creditCardNumber,kTestCreditCardNumber) == 0)
> >         {
> >                 isTest = true;
> >                 //answerText = kApprovedPrefixString;
> >                 answerText += "987654321";
> >         }
> >         else
> >         {
> > AddLogEntry(dbObjPtr, "INFO\tVerisign.cc\tNot A Test");
> >                 // Build up the application's piped arguments
> >                 verisignArgs += "TRXTYPE=";
> >                 verisignArgs += transactionType;
> >                 verisignArgs += "&TENDER=C";
> >                 verisignArgs += "&PARTNER=";
> >                 verisignArgs += kVerisignPartner;
> >                 verisignArgs += "&VENDOR=";
> >                 verisignArgs += kVerisignVendor;
> >                 verisignArgs += "&USER=";
> >                 verisignArgs += kVerisignUser;
> >                 verisignArgs += "&PWD=";
> >                 verisignArgs += kVerisignPassword;
> >                 verisignArgs += "&ACCT=";
> >                 verisignArgs += creditCardNumber;
> >                 verisignArgs += "&EXPDATE=";
> >                 verisignArgs += expirationDate;
> >                 verisignArgs += "&AMT=";
> >                 verisignArgs += localAmount;
> >                 verisignArgs += "&COMMENT1[";
> >                 verisignArgs += comment.GetLength();
> >                 verisignArgs += "]=";
> >                 verisignArgs += comment;
> >                 verisignArgs += "&STREET[";
> >                 verisignArgs += customerAddress.GetLength();
> >                 verisignArgs += "]=";
> >                 verisignArgs += customerAddress;
> >                 verisignArgs += "&ZIP=";
> >                 verisignArgs += customerZipCode;
> >                 verisignArgs += "\r\n";
> > AddLogEntry(dbObjPtr, "INFO\tVerisign.cc\tArgs Set Up");
> >
> >                 //Using credit card number and time in seconds to
> > create unique id
> >                 char uniqueID[64];
> >                 strcpy(uniqueID, creditCardNumber);
> >                 sprintf(uniqueID, "%s%ld", uniqueID, time(NULL));
> > AddLogEntry(dbObjPtr, "INFO\tVerisign.cc\tBuilt Unique ID");
> >
> >                 //set the headers.
> >                 std::list<std::string> headers;
> >                 headers.push_back("Content-Type: text/namevalue");
> >                 headers.push_back("Content-Length: " +
> > verisignArgs.GetLength());
> >                 headers.push_back("X-VPS-Timeout: 45");
> >                 headers.push_back("X-VPS-Request_ID:" + std::string
> > (uniqueID));
> >
> > AddLogEntry(dbObjPtr, "INFO\tVerisign.cc\tRest Of Headers Set");
> >
> > AddLogEntry(dbObjPtr, "INFO\tVerisign.cc\tInit Curl");
> >                 cURLpp::Cleanup myCleanup;
> >                 cURLpp::Easy myRequest;
> >                 myRequest.setOpt(new cURLpp::Options::Url
> > (kVerisignHost));
> >                 myRequest.setOpt(new cURLpp::Options::Port
> > (kVerisignPort));
> >                 myRequest.setOpt(new cURLpp::Options::Timeout
> > (kVerisignTimeout));
> >                 myRequest.setOpt(new cURLpp::Options::Header(1));
> >                 myRequest.setOpt(new cURLpp::Options::FollowLocation
> > (0));
> >                 myRequest.setOpt(new cURLpp::Options::SslVerifyPeer
> > (0));
> >                 myRequest.setOpt(new cURLpp::Options::SslVerifyHost
> > (2));
> >                 myRequest.setOpt(new cURLpp::Options::ForbidReuse
> > (true));
> >                 myRequest.setOpt(new cURLpp::Options::Post(1));
> >                 myRequest.setOpt(new cURLpp::Options::HttpHeader
> > (headers));
> >                 myRequest.setOpt(new cURLpp::Options::PostFields
> > (std::string(verisignArgs)));
> >                 myRequest.setOpt(new cURLpp::Options::UserAgent
> > ("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/
> > 20070725 Firefox/2.0.0.6"));
> >                 //myRequest.setOpt(new cURLpp::Options::Verbose
> > (true));
> >
> >                 std::ostringstream responseBuffer;
> > //AddLogEntry(dbObjPtr, "INFO\tVerisign.cc\tSet up output stream.
> > About to perform shorthand version");
> >                 //responseBuffer << myRequest;
> >
> >                 cURLpp::Options::WriteStream ws(&responseBuffer);
> >                 myRequest.setOpt(ws);
> > AddLogEntry(dbObjPtr, "INFO\tVerisign.cc\tSet up output stream.  About
> > to perform");
> > //                cout << "Content-type: text/plain" << endl << endl;
> >                 myRequest.perform();
> >
> > AddLogEntry(dbObjPtr, "INFO\tVerisign.cc\tPerformed request");
> >                 const char* temp = responseBuffer.str().c_str();
> >                 responseString.CopyFrom(temp);
> > AddLogEntry(dbObjPtr, "INFO\tVerisign.cc\tSet Response String");
> >
> >                                 if (! responseString.IsEmpty())
> >                                 {
> >                                         // get the reponse code
> >                                         if ( GetValueFromResponseString
> > (kVSResponseFieldResult,tmpString, responseString) )
> >                                         {
> >                                                 resultCode =
> > tmpString.AsSInt();
> > ...
> >
> > read more ยป
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"curlpp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/curlpp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to