aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
AgeCommit message (Collapse)Author
2012-12-28build: make use of 76 lib/*.h renamed filesYang Tse
76 private header files renamed to use our standard naming scheme. This change affects 322 files in libcurl's source tree.
2012-12-14setup_once.h: refactor inclusion of <unistd.h> and <sys/socket.h>Yang Tse
Inclusion of top two most included header files now done in setup_once.h
2012-11-12ftp: EPSV-disable fix over SOCKSAnton Malov
Bug: http://curl.haxx.se/bug/view.cgi?id=3586338
2012-11-05ftp_readresp: fix build without krb4 supportDaniel Stenberg
Oops, my previous commit broke builds with krb support.
2012-11-04FTP: prevent the multi interface from blockingDaniel Stenberg
As pointed out in Bug report #3579064, curl_multi_perform() would wrongly use a blocking mechanism internally for some commands which could lead to for example a very long block if the LIST response never showed. The solution was to make sure to properly continue to use the multi interface non-blocking state machine. The new test 1501 verifies the fix. Bug: http://curl.haxx.se/bug/view.cgi?id=3579064 Reported by: Guido Berhoerster
2012-08-16ftp: active conn, place calling sockopt callback at the end of functionGokhan Sengun
Commit b91d29a28e170c16d65d956db79f2cd3a82372d2 introduces a bug and breaks Curl_closesocket function. sock_accepted flag for the second socket should be tagged as TRUE before the sockopt callback is called because in case the callback returns an error, Curl_closesocket function is going to call the - fclosesocket - callback for the accept()ed socket
2012-08-16ftp: active conn, allow application to set sockopt after accept() callGokhan Sengun
For active FTP connections, applications may need setting the sockopt after accept() call returns successful. This fix gives a call to the callback registered with CURL_SOCKOPTFUNCTION option. Also a new sock type - CURLSOCKTYPE_ACCEPT - is added. This type is to be passed to application callbacks with - purpose - parameter. Applications may use this parameter to distinguish between socket types.
2012-07-13ftp_do_more: add missing check of return codeDaniel Stenberg
Spotted by clang-analyzer. The return code was never checked, just stored.
2012-06-12Revert "connect.c/ftp.c: Fixed dereferencing pointer breakin strict-aliasing"Yang Tse
This reverts commit 9c94236e6cc078a0dc5a78b6e2fefc1403e5375e. It didn't server its purpose, so lets go back to long-time working code.
2012-06-11connect.c/ftp.c: Fixed dereferencing pointer breakin strict-aliasingMarc Hoersken
Fixed warning: dereferencing pointer does break strict-aliasing rules by using a union instead of separate pointer variables. Internal union sockaddr_u could probably be moved to generic header. Thanks to Paul Howarth for the hint about using unions for this. Important for winbuild: Separate declaration of sockaddr_u pointer. The pointer variable *sock cannot be declared and initialized right after the union declaration. Therefore it has to be a separate statement.
2012-04-04ftp.c: ftplistparser related OOM handling fixYang Tse
2012-03-16fix some compiler warningsYang Tse
2012-03-08CONNECT: made generically not per-protocolDaniel Stenberg
Curl_protocol_connect() now does the tunneling through the HTTP proxy if requested instead of letting each protocol specific connection function do it.
2012-01-16add LF termination to infof() trace stringYang Tse
2012-01-09FTP: CURLE_PARTIAL_FILE should not cause control connection to be closedgsengun
Test 161 updated accordingly
2011-12-24ftp_do_more: don't return success until all is doneDaniel Stenberg
ftp_do_more() returns after accepting the server connect however it needs to fall through and set "*complete" to TRUE before exit from the function. Bug: http://curl.haxx.se/mail/lib-2011-12/0250.html Reported by: Gokhan Sengun
2011-12-20timeleft_accept: ack global timeout, moved to ftp.cDaniel Stenberg
First off the timeout for accepting a server connect back must of course respect a global timeout. Then the timeleft function is only used by ftp code so it was moved to ftp.c and made static.
2011-12-20FTP: move FTP-specific struct field to ftpc_connDaniel Stenberg
"wait_data_conn" was added to the connectionbits in commit c834213ad5 for handling active FTP connections but as it is purely FTP specific and now only ever accessed by ftp.c I moved it into the FTP connection struct.
2011-12-20non-blocking active FTP: cleanup multi state usageDaniel Stenberg
Backpedaled out the funny double-change of state in the multi state machine by adding a new argument to the do_more() function to signal completion. This way it can remain in the DO_MORE state properly until done. Long term, the entire DO_MORE logic should be moved into the FTP code and be hidden from the multi code as the logic is only used for FTP.
2011-12-20FTP: perform active connections non-blockingGokhan Sengun
1- Two new error codes are introduced. CURLE_FTP_ACCEPT_FAILED to be set whenever ACCEPTing fails because of FTP server connected. CURLE_FTP_ACCEPT_TIMEOUT to be set whenever ACCEPTing timeouts. Neither of these errors are considered fatal and control connection remains OK because it could just be a firewall blocking server to connect to the client. 2- One new setopt option was introduced. CURLOPT_ACCEPTTIMEOUT_MS It sets the maximum amount of time FTP client is going to wait for a server to connect. Internal default accept timeout is 60 seconds.
2011-12-05FTP: close callback fixDaniel Stenberg
Keep track of which sockets that are the result of accept() calls and refuse to call the closesocket callback for those sockets. Test case 596 now verifies that the open socket callback is called the same number of times as the closed socket callback for active FTP connections. Bug: http://curl.haxx.se/mail/lib-2011-12/0018.html Reported by: Gokhan Sengun
2011-12-05FTP: call opensocket callback properlyDaniel Stenberg
When the new socket is created for an active connection, it is now done using the open socket callback. Test case 596 was modified to run fine, although it hides the fact that the close callback is still called too many times, as it also gets called for closing sockets that were created with accept().
2011-11-24query-part: ignore the URI part for given protocolsJonas Schnelli
By setting PROTOPT_NOURLQUERY in the protocol handler struct, the protocol will get the "query part" of the URL cut off before the data is handled by the protocol-specific code. This makes libcurl adhere to RFC3986 section 2.2. Test 1220 is added to verify a file:// URL with query-part.
2011-11-06ftp PORT: don't hang if bind() failsDaniel Stenberg
When the user requests PORT with a specific port or port range, the code could lock up in an endless loop. There's now an extra conditional that makes sure to special treat the error and try the local address only once so a second failure will abort the loop correctly. Bug: http://curl.haxx.se/bug/view.cgi?id=3433968 Reported by: Gokhan Sengun
2011-11-03rename ftp_ssl: the struct field is used for many protocolsDaniel Stenberg
Now called 'use_ssl' instead, which better matches the current CURLOPT name and since the option is used for all pingpong protocols (at least) it makes sense to not use 'ftp' in the name.
2011-10-24ftp.c: some OOM handling fixesYang Tse
2011-10-21curl_multi_fdset: correct fdset with FTP PORT useDaniel Stenberg
After a PORT has been issued, and the multi handle would switch to the CURLM_STATE_DO_MORE state (which is unique for FTP), libcurl would return the wrong fdset to wait for when curl_multi_fdset() is called. The code would blindly assume that it was waiting for a connect of the second connection, while that isn't true immediately after the PORT command. Also, the function multi.c:domore_getsock() was highly FTP-centric and therefore ugly to keep in protocol-agnostic code. I solved this problem by introducing a new function pointer in the Curl_handler struct called domore_getsock() which is only called during the DOMORE state for protocols that set that pointer. The new ftp.c:ftp_domore_getsock() function now returns fdset info about the control connection's command/response handling while such a state is in use, and goes over to waiting for a writable second connection first once the commands are done. The original problem could be seen by running test 525 and checking the time stamps in the FTP server log. I can verify that this fix at least fixes this problem. Bug: http://curl.haxx.se/mail/lib-2011-10/0250.html Reported by: Gokhan Sengun
2011-10-12OOM handling/cleanup slight adjustmentsYang Tse
2011-10-04ftp: improved the failed PORT host name resolved error messageDaniel Stenberg
2011-09-14ftp.c: add a couple of failure messagesYang Tse
2011-09-12ftp.c: fix socket leak torture tests detected 2011-08-30Yang Tse
Also fix inappropriate error handling when sending ftp EPRT or PORT commands.
2011-09-10ftp.c: fix ftp active connects which got broken with commit fdf157abdfYang Tse
2011-09-07ftp_state_use_port: minor code indent fixDaniel Stenberg
2011-09-05fix bool variables checking and assignmentYang Tse
2011-09-03fix a bunch of MSVC compiler warningsYang Tse
2011-09-01ftp.c: fix some leaks torture tests detected 2011-08-30 - follow-upYang Tse
follow-up for commit d20408e8
2011-08-31ftp.c: fix some leaks torture tests detected 2011-08-30 - follow-upYang Tse
follow-up for commit c06de200
2011-08-31fix some leaks torture tests detected 2011-08-30Yang Tse
2011-08-31fix some leaks torture tests detected 2011-08-30Yang Tse
2011-08-18FTP: fix proxy connect race conditionDaniel Stenberg
When using the multi interface, a SOCKS proxy, and a connection that wouldn't immediately consider itself connected (which my Linux tests do by default), libcurl would be tricked into doing _two_ connects to the SOCKS proxy when it setup the data connection and then of course the second attempt would fail miserably and cause error. This problem is a regression that was introduced by commit 4a42e5cdaa344755 that was introduced in the 7.21.7 release. Bug: http://curl.haxx.se/mail/lib-2011-08/0199.html Reported by: Fabian Keil
2011-08-08ftp_doing: bail out on error properlyDaniel Stenberg
When a failure has been detected we must abort immdiately. Bug: http://curl.haxx.se/mail/lib-2011-07/0177.html Reported by: "Spoon Man"
2011-07-26stdio.h, stdlib.h, string.h, stdarg.h and ctype.h inclusion done in setup_once.hYang Tse
2011-07-04code style: space between close paren and open braceDaniel Stenberg
2011-06-04Curl_socket_ready: make timeout a 'long'Daniel Stenberg
It was mostly typecasted to int all over the code so switching to long instead all over should be a net gain.
2011-06-02compiler warning: fixYang Tse
Fix compiler warning: cast increases required alignment
2011-05-18CLOSESOCKETFUNCTION: addedDaniel Stenberg
Introduced the initial setup to allow closesocket callbacks by making sure sclose() is only ever called from one place in the libcurl source and still run all test cases fine.
2011-05-05set_userpass: convert from protocol-specific to genericDaniel Stenberg
The protocol handler's flags field now can set that the protocol requires a password, so that the set_userpass function doesn't have to have the specific knowledge of which protocols that do.
2011-05-05RTSP: convert protocol-specific checks to genericDaniel Stenberg
Add a 'readwrite' function to the protocol handler struct and use that for the extra readwrite functionality RTSP needs.
2011-05-05SSL: check for SSL, not specific protocolsDaniel Stenberg
Code cleanup to check less for protocols and more for the specific relevant feature. Like if SSL is required.
2011-04-28proxy: allow socks:// prefix in proxy stringDaniel Stenberg
Inspired by a patch from OB.Conseil. Added test case 708 to verify.