cURL cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] #1464 FTP transfer fails on Windows Embedded Compact 7 (November 2014 Update)

From: Nikolay Vakhlyarskiy <nvakhlyarskiy_at_users.sf.net>
Date: Mon, 15 Dec 2014 10:52:04 +0000

Hi, Daniel.
Please take a look at library version 7.39.0 file '/lib/ftp.c' function 'ftp_done' lines '3307' and '3331'.To avoid the reset of unsent socket buffers, I had inserted the ollowing line before invocation of 'shutdown' function :

    setsockopt( conn->sock[SECONDARYSOCKET],
                 SOL_SOCKET,SO_LINGER,(const char*)&linstr,sizeof(linstr));

where listr is set with onoff field equal to 1 and timeout field to 3600 seconds.
    After that, the function 'Curl_closesocket' in line '3331' started to return -1, because of unfinished transfer. I had wrapped this function into the loop, to wait transfer completion.
    I doubt that simple spinning in the loop is a good solution, may be a call to some
user assigned or default monitoring call back function would be much much better.

Thanks, Nikolay Vakhlyarskiy.
 
 

    

---
** [bugs:#1464] FTP transfer fails on Windows Embedded Compact 7 (November 2014 Update)**
**Status:** open
**Created:** Fri Dec 12, 2014 10:59 AM UTC by Nikolay Vakhlyarskiy
**Last Updated:** Sat Dec 13, 2014 11:21 PM UTC
**Owner:** Daniel Stenberg
FTP transfer fails on Windows Embedded Compact 7 November 2014 Update, 
when library is built without USE_BLOCKING_SOCKETS.
CURL library version is 7.23.1
The bug is caused due to change in behavior of Windows Sockets, which has been introduced
in November 2014.
When library is compiled without USE_BLOCKING_SOCKET define, the sequence of function calls:
shutdown(...);
closesocket(...);
drops underlying socket data buffers and file transfer is interrupted. FTP server responds
with code 450 on shuch client behavior.
Previously (before Windows Update), the underlying socket data buffers was not dropped by
function call sequence mentoned above.
For non-blocking socket the BUG can be fixed with setting SO_LINGER option with non-zero
timeout, but in this case 'closesocket' function returns -1 and some loop should be
introduced to wait for successful call to 'closesocket'.
Lines in 'ftp.c' file where "the bug lives":
// these lines close access to socket from application
3165: #ifdef _WIN32_WCE
3166:   shutdown(conn->sock[SECONDARYSOCKET],2);  /* SD_BOTH */
3167: #endif
// socket buffers are dropped by this call
3188: Curl_closesocket(conn, conn->sock[SECONDARYSOCKET]);
Thanks, Nikolay Vakhlyarskiy.
---
Sent from sourceforge.net because curl-tracker@cool.haxx.se is subscribed to https://sourceforge.net/p/curl/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/curl/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
Received on 2014-12-15

These mail archives are generated by hypermail.