bool HttpRequest::Perform(XBOX::VError* outError)
    {
        //On essaie de faire plusieurs send de suite, pas bien !
        if(!fHandle)
        {
            //XBOX::vThrowError(VE_CWRP_SEND_WITHOUT_OPEN_ERROR);
            return false;
        }

        SetOpts();

        CURLcode res_perf=curl_easy_perform(fHandle);

        if(res_perf!=CURLE_OK && outError)
            *outError=CurlCodeToVError(res_perf);

        //On recupere 2 ou 3 infos qui pourraient etre utiles plus tard
        long code=0;	//jmo - ACI0071188 : code est lu par cURL comme un long* (64bit) via var_arg
        CURLcode res_inf1=curl_easy_getinfo(fHandle, CURLINFO_RESPONSE_CODE, &code);

        if(code!=0)
            fHasValidResponseCode=true, fResponseCode=code;

        CURLcode res_inf2=curl_easy_getinfo(fHandle, CURLINFO_HTTP_CONNECTCODE, &code);

        if(code!=0)
            fHasValidProxyCode=true, fProxyCode=code;

        //Dans l'immediat, on n'a plus besoin des ressources utilisees par cURL
        curl_easy_cleanup(fHandle);
        fHandle=NULL;

        return res_perf==CURLE_OK && res_inf1==CURLE_OK && res_inf2==CURLE_OK;
    }
Example #2
0
int main(int argc, char **argv)
{
	FILE	*tmpfd;
	char	makeMacro[ BUFSIZ ];
	char	makefileMacro[ BUFSIZ ];

	program = argv[0];
	init();
	SetOpts(argc, argv);

	Imakefile = FindImakefile(Imakefile);
	CheckImakefileC(ImakefileC);
	if (Makefile)
		tmpMakefile = Makefile;
	else {
		tmpMakefile = Strdup(tmpMakefile);
		(void) mkstemp(tmpMakefile);
	}
	AddMakeArg("-f");
	AddMakeArg( tmpMakefile );
	sprintf(makeMacro, "MAKE=%s", program);
	AddMakeArg( makeMacro );
	sprintf(makefileMacro, "MAKEFILE=%s", Imakefile);
	AddMakeArg( makefileMacro );

	if ((tmpfd = fopen(tmpMakefile, "w+")) == NULL)
		LogFatal("Cannot create temporary file %s.", tmpMakefile);

	cleanedImakefile = CleanCppInput(Imakefile);
	cppit(cleanedImakefile, Template, ImakefileC, tmpfd, tmpMakefile);

	if (show) {
		if (Makefile == NULL)
			showit(tmpfd);
	} else
		makeit();
	wrapup();
	exit(0);
}