Dnia 2021-07-19, o godz. 03:38:27 Venkat Maddisetti via curl-library <curl-library@cool.haxx.se> napisał(a):
> To give some background, I am able to authenticate and able to work with the > box with the blocked call ( without CURLOPT_CONNECT_ONLY option) with no > control over the curl connection. The problem is, since the response from the > box is a stream of data there is no way for me to stop the stream and send an > another request. So from the documentation I figured out > “CURLOPT_CONNECT_ONLY” is the way to go, and using the socket handle I can > manage the communication to the box but after adding “CURLOPT_CONNECT_ONLY” > option, I am not receiving the data stream as expected, I guess my request > went through as there are no errors thrown, but looking closely I did not see > authentication happening – I assume that is the problem, I am not doing > anything fancy here just basic authentication only. Searched the web but > could not get an answer and I am stuck. What am I missing here, does this > option go in tandem with some other option I could not figure out or is there > a different approach to authenticate while using this option. > Hi, I think you should avoid using CURLOPT_CONNECT_ONLY and instead just use CURLOPT_WRITEFUNCTION to register a callback and process received data in it. You can "stop the stream" (abort the connection) by returning a value different from the amount of data passed to the callback (according to https://curl.se/libcurl/c/CURLOPT_WRITEFUNCTION.html). -- ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.html