On 9 August 2013 17:11, Daniel Stenberg wrote: > On Fri, 9 Aug 2013, Václav Zeman wrote: > >> I am in a situation where I am using proxy authentication but I need only >> the last response. I suspect this is true for most people who do HTTP over >> proxy. Now, it is fairly hard to distinguish the response boundaries because >> of the possibility of chunked encoding of the response and the Trailer >> header. > > > Why is that hard? libcurl should only deliver the (non-407) response body > when you've set it to use http proxy auth. > > >> It would be much nicer if libcurl could let me know about the response >> boundaries using a callback instead, so that I can discard all the response >> data I have collected from previous response at each response-start >> callback. > > > Sorry but I don't understand your use case. What boundaries are you talking > about?
We are using libcurl as a transport backend for gSOAP because libcurl has better proxy authentication capabilities. When I send a HTTP request through proxy with authentication, my CURLOPT_WRITEFUNCTION callback is receiving all headers, even headers from proxy authentication negotiation. My CURLOPT_WRITEFUNCTION callback is basically gathering all the data it receives and gSOAP then reads the whole response at once. Because of this, my buffers are concatenation of (1) the headers of the 407 response, (2) headers of the final 200 response and (3) body of the final response. gSOAP then reads all three parts and sees the first 407 response and considers the request failed. To work around this, to find the boundary between the 407 response and the final response, I am looking for the "HTTP/" string in CURLOPT_HEADERFUNCTION callback. But the documentation states that the HTTP/1.1 chunked response can contain the trailer that is the same as the status line. While I can probably insert enough logic into the code to distinguish the trailer from the status line (as per the clues in CURLOPT_HEADERFUNCTION docs), I would rather have libcurl letting me know when it is starting a new HTTP request. -- VZ ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
