Discussion:
Cached CURL handle causing problems with PUT Data?
kent williams via curl-library
2021-04-20 19:08:04 UTC
Permalink
Ran into this.

I implemented using the same CURL handle across separate HTTP requests,
but it appears to screw things up in the case where I use it after a
PUT, if I've used CURLOPT_READDATA and CURLOPT_READFUNCTION.

How do I reset those options so that a subsequent GET request doesn't
try and use that put data?

Also if I set CURLOPT_CUSTOMREQUEST, how do I reset it?


-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etique
kent williams via curl-library
2021-04-20 19:16:28 UTC
Permalink
It looks like calling curl_easy_reset before setting up the curl options
for a particular curl_easy_perform
Post by kent williams via curl-library
Ran into this.
I implemented using the same CURL handle across separate HTTP
requests, but it appears to screw things up in the case where I use it
after a PUT, if I've used CURLOPT_READDATA and CURLOPT_READFUNCTION.
How do I reset those options so that a subsequent GET request doesn't
try and use that put data?
Also if I set CURLOPT_CUSTOMREQUEST, how do I reset it?
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etique
Daniel Stenberg via curl-library
2021-04-20 22:00:06 UTC
Permalink
I implemented using the same CURL handle across separate HTTP requests, but
it appears to screw things up in the case where I use it after a PUT, if
I've used CURLOPT_READDATA and CURLOPT_READFUNCTION.
How do I reset those options so that a subsequent GET request doesn't try
and use that put data?
Set CURLOPT_READFUNCTION to NULL to reset it - as mentioned in the man page.
But also, if you reset it to do a GET (with CURLOPT_HTTPGET) it won't use the
read callback anyway.
Also if I set CURLOPT_CUSTOMREQUEST, how do I reset it?
For ordinary PUT you don't need CURLOPT_CUSTOMREQUEST, but you set it to NULL
to reset it. As documented.
--
/ daniel.haxx.se
| Commercial curl support up to 24x7 is available!
| Private help, bug fixes, support, ports, new features
| https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Eti
Loading...