Re: Is it possible to use data from the response header to a POST in a subsequent GET?
Status: Alpha
Brought to you by:
coroberti
|
From: Gary F. <ga...@in...> - 2008-10-27 18:38:47
|
Thanks for replying, Robert.
> Actually, when cctx->post_data is allocated,
> it should be set zero to the first char, like
> cctx->post_data[0] = '\0';
Yes, cctx->post_data[0] is set to zero, and that's the problem. This
causes the condition "else if (cctx->post_data && cctx->post_data[0])"
to fail, and to drop through to the "post_data is NULL" error, which
aborts the batch run.
When I comment out the second part: "else if (cctx->post_data /* &&
cctx->post_data[0] */)", we call init_client_url_post_data, and this
seems to work.
if (url->req_type == HTTP_REQ_TYPE_POST)
{
/*
Make POST, using post buffer, if requested.
*/
if (url->upload_file && url->upload_file_ptr && (!cctx-
>post_data || !cctx->post_data[0]))
{
curl_easy_setopt(handle, CURLOPT_POST, 1);
}
else if (cctx->post_data && cctx->post_data[0])
{
/*
Sets POST as the HTTP request method using either:
- POST-fields;
- multipart form-data as in RFC 1867;
*/
if (init_client_url_post_data (cctx, url) == -1)
{
fprintf (stderr,
"%s - error: init_client_url_post_data() failed.
\n",
__func__);
return -1;
}
}
else
{
fprintf (stderr, "%s - error: post_data is NULL.\n", __func__);
return -1;
}
}
Thanks,
Gary
|