cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-429760 ] bad httpPost->contents

From: <noreply_at_sourceforge.net>
Date: Sun, 03 Jun 2001 02:37:49 -0700

Bugs item #429760, was updated on 2001-06-03 02:37
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=429760&group_id=976

Category: libcurl
Group: wrong behaviour
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: bad httpPost->contents

Initial Comment:
libcurl 7.7.3-1 on red hat 7.1 (linux 2.4.2-2).

I frequently recieve this as a response from a post:
99-10000curlZIf0uVBoGxcTMvjRGY+Sb0ArCit is not a valid
case.
when i "peek" at httpPost->contents, it is correct.
(see "peek" comment below)
is the calloc maybe causing problems?
am i doing something incorrectly?

i have tried several variations and they all result in
similar results.

john baxter

char tmpCase[1024];
sprintf(tmpCase, "%s%d", "case_num=99-", x);
curl_formparse(tmpCase, &post, &last);
curl_formparse("SortDate=Fil", &post, &last);
curl_formparse("PublicDkt=y", &post, &last);
curl_formparse("TermParty=y", &post, &last);
curl_formparse("SortAscDsc=Rev", &post, &last);
curl_formparse("button1=Run Report", &post, &last);

curlHandle = curl_easy_init();

curl_easy_setopt(curlHandle, CURLOPT_HTTPPOST, post);

/* peek at formparse post string */
printf("%s:%s\n", court, post->contents);

curl_easy_setopt(curlHandle, CURLOPT_VERBOSE, OFF);
curl_easy_setopt(curlHandle, CURLOPT_NOPROGRESS, ON);
curl_easy_setopt(curlHandle, CURLOPT_MUTE, ON);
curl_easy_setopt(curlHandle, CURLOPT_FOLLOWLOCATION,
ON);
curl_easy_setopt(curlHandle, CURLOPT_POST, ON);
curl_easy_setopt(curlHandle, CURLOPT_WRITEFUNCTION,
buildHttpData);
curl_easy_setopt(curlHandle, CURLOPT_COOKIEFILE,
cookFilename);
curl_easy_setopt(curlHandle, CURLOPT_WRITEHEADER,
headFile);
curl_easy_setopt(curlHandle, CURLOPT_FILE, bodyFile);
curl_easy_setopt(curlHandle, CURLOPT_COOKIE,
loginCookie);

tmpUrl[0] = '\0';
strcpy(tmpUrl, url);
strcat(tmpUrl, "/cgi-bin/DktRpt.pl?");
strcat(tmpUrl, randomUrl);
curl_easy_setopt(curlHandle, CURLOPT_URL, tmpUrl);

/* initialize httpData, assigned by buildHttpData
function */
if((httpData = (char *)calloc((sizeof(char)), BYTE)) ==
NULL)
{
   printf("%s-Error: Failed to allocate initial
httpData\n", binaryName);
   exit(ERROR);
}
else httpData[0] = '\0';

curl_easy_perform(curlHandle);

----------------------------------------------------------------------

You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=100976&aid=429760&group_id=976
Received on 2001-06-03