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:18:12
|
Hello Robert,
I have my changes working now, although I want to test them a bit more
before letting them out. I'm having one problem, though. In the
application I'm testing, the very first URL is a POST request using a
FORM_STRING.
This seems to cause a failure in loader.c, setup_curl_handle_appl().
The code is copied below.
When this code is called, cctx->post_data has been allocated but not
initialized, so it's an empty string. This causes the condition "else
if (cctx->post_data && cctx->post_data[0])" to fail, and we drop
through to the "post_data is NULL" error.
I've fixed this by commenting out the second condition:
else if (cctx->post_data /* && cctx->post_data[0] */)
So far this seems to work for me, but I wonder if I'm missing
something that might cause an error somewhere else.
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
|