Hi all,

I'm using the multi interface, and I'm seeing two problems when using FTP, 
which may well be related to each other. 

I believe, although I'm not certain, that both problems occur more often when 
using CURLOPT_PREQUOTE or CURLOPT_POSTQUOTE.

What seems to be happening is that curl is getting confused with the multiple 
responses coming back from the server.

Sometimes this leads to us hitting this line in ftp.c:

      failf(data, "server did not report OK, got %d", ftpcode);

In this case, the code that it's complaining about is generally a legitimate 
code returned from some part of the conversation with the server.

That's the good scenario. In the bad scenario, we end up crashing when calling 
out from Curl_client_write. 

The problem in this case is that the calculations at the top of 
Curl_pp_readresp are going wrong.

The calculation of perline is taking the difference of two buffer pointers.

perline = (ssize_t)(ptr-pp->linestart_resp);


In the case where it crashes, these two buffers appear to be completely 
different. Examining them, they both contain different responses from the FTP 
server.

However, they are far apart in memory, resulting in a large (and often 
negative) value for perline.

When we later call out to a user-registered function, this large/negative value 
is passed along, causing the called code to die horribly.

It may be a coincidence, but at some level both problems appear to be caused by 
the curl internals getting confused about which response it's supposed to be 
processing. This leads me to suspect that the underlying issue may be the same.

Does anyone have any ideas?

I believe that I have the threading set up correctly.

I'm on OS X, using GCD, with all accesses to the multi handle protected by a 
single serial queue, so that no two operations on the multi should ever occur 
simultaneously. Easy handles are potentially set up on other threads, but 
aren't touched once they are handed off to the multi.

This problem is a real blocker for us!


sam deane / @samdeane | elegantchaos.com / @elegantchaoscom | mac and ios 
software development


-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to