Mercurial > mplayer.hg
annotate stream/stream_ftp.c @ 33928:27b1c4df84bd
Remove pointless pointer indirection for shader program strings.
author | reimar |
---|---|
date | Fri, 26 Aug 2011 19:35:46 +0000 |
parents | b39155e98ac3 |
children | 701e78689c07 |
rev | line source |
---|---|
30426
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
1 /* |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
2 * This file is part of MPlayer. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
3 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
7 * (at your option) any later version. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
8 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
12 * GNU General Public License for more details. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
13 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30376
diff
changeset
|
17 */ |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
18 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
19 #include "config.h" |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
20 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
21 #include <stdlib.h> |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
22 #include <stdio.h> |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
23 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
24 #include <sys/types.h> |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
25 #include <sys/stat.h> |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
26 #include <fcntl.h> |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
27 #include <unistd.h> |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
28 #include <errno.h> |
28402 | 29 #if !HAVE_WINSOCK2_H |
27472
c0b233cd30ca
Revert moving closesocket definition and network headers to network.h.
diego
parents:
27464
diff
changeset
|
30 #include <sys/socket.h> |
c0b233cd30ca
Revert moving closesocket definition and network headers to network.h.
diego
parents:
27464
diff
changeset
|
31 #else |
c0b233cd30ca
Revert moving closesocket definition and network headers to network.h.
diego
parents:
27464
diff
changeset
|
32 #include <winsock2.h> |
c0b233cd30ca
Revert moving closesocket definition and network headers to network.h.
diego
parents:
27464
diff
changeset
|
33 #endif |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
34 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
35 #include "mp_msg.h" |
27473
ae5da477539e
Move '#define closesocket close' preprocessor directive to a common place
diego
parents:
27472
diff
changeset
|
36 #include "network.h" |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
37 #include "stream.h" |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
38 #include "help_mp.h" |
17012 | 39 #include "m_option.h" |
40 #include "m_struct.h" | |
19335
2a9d669e5ff6
isolated tcp socket code from network.c to a dedicated file
ben
parents:
19271
diff
changeset
|
41 #include "tcp.h" |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
42 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
43 static struct stream_priv_s { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
44 char* user; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
45 char* pass; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
46 char* host; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
47 int port; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
48 char* filename; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
49 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
50 char *cput,*cget; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
51 int handle; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
52 int cavail,cleft; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
53 char *buf; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
54 } stream_priv_dflts = { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
55 "anonymous","no@spam", |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
56 NULL, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
57 21, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
58 NULL, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
59 NULL, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
60 NULL, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
61 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
62 0, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
63 0,0, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
64 NULL |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
65 }; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
66 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
67 #define BUFSIZE 2048 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
68 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
69 #define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f) |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
70 /// URL definition |
25242 | 71 static const m_option_t stream_opts_fields[] = { |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
72 {"username", ST_OFF(user), CONF_TYPE_STRING, 0, 0 ,0, NULL}, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
73 {"password", ST_OFF(pass), CONF_TYPE_STRING, 0, 0 ,0, NULL}, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
74 {"hostname", ST_OFF(host), CONF_TYPE_STRING, 0, 0 ,0, NULL}, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
75 {"port", ST_OFF(port), CONF_TYPE_INT, 0, 0 ,65635, NULL}, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
76 {"filename", ST_OFF(filename), CONF_TYPE_STRING, 0, 0 ,0, NULL}, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
77 { NULL, NULL, 0, 0, 0, 0, NULL } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
78 }; |
25691 | 79 static const struct m_struct_st stream_opts = { |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
80 "ftp", |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
81 sizeof(struct stream_priv_s), |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
82 &stream_priv_dflts, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
83 stream_opts_fields |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
84 }; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
85 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
86 #define TELNET_IAC 255 /* interpret as command: */ |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
87 #define TELNET_IP 244 /* interrupt process--permanently */ |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
88 #define TELNET_SYNCH 242 /* for telfunc calls */ |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
89 |
17854
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
90 // Check if there is something to read on a fd. This avoid hanging |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
91 // forever if the network stop responding. |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
92 static int fd_can_read(int fd,int timeout) { |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
93 fd_set fds; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
94 struct timeval tv; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
95 |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
96 FD_ZERO(&fds); |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
97 FD_SET(fd,&fds); |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
98 tv.tv_sec = timeout; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
99 tv.tv_usec = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
100 |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25691
diff
changeset
|
101 return select(fd+1, &fds, NULL, NULL, &tv) > 0; |
17854
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
102 } |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
103 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
104 /* |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
105 * read a line of text |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
106 * |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
107 * return -1 on error or bytecount |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
108 */ |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
109 static int readline(char *buf,int max,struct stream_priv_s *ctl) |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
110 { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
111 int x,retval = 0; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
112 char *end,*bp=buf; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
113 int eof = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
114 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
115 do { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
116 if (ctl->cavail > 0) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
117 x = (max >= ctl->cavail) ? ctl->cavail : max-1; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
118 end = memccpy(bp,ctl->cget,'\n',x); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
119 if (end != NULL) |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
120 x = end - bp; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
121 retval += x; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
122 bp += x; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
123 *bp = '\0'; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
124 max -= x; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
125 ctl->cget += x; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
126 ctl->cavail -= x; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
127 if (end != NULL) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
128 bp -= 2; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
129 if (strcmp(bp,"\r\n") == 0) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
130 *bp++ = '\n'; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
131 *bp++ = '\0'; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
132 --retval; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
133 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
134 break; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
135 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
136 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
137 if (max == 1) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
138 *buf = '\0'; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
139 break; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
140 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
141 if (ctl->cput == ctl->cget) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
142 ctl->cput = ctl->cget = ctl->buf; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
143 ctl->cavail = 0; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
144 ctl->cleft = BUFSIZE; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
145 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
146 if(eof) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
147 if (retval == 0) |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
148 retval = -1; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
149 break; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
150 } |
17854
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
151 |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
152 if(!fd_can_read(ctl->handle, 15)) { |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
153 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] read timed out\n"); |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
154 retval = -1; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
155 break; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
156 } |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
157 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
158 if ((x = recv(ctl->handle,ctl->cput,ctl->cleft,0)) == -1) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
159 mp_msg(MSGT_STREAM,MSGL_ERR, "[ftp] read error: %s\n",strerror(errno)); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
160 retval = -1; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
161 break; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
162 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
163 if (x == 0) |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
164 eof = 1; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
165 ctl->cleft -= x; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
166 ctl->cavail += x; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
167 ctl->cput += x; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
168 } while (1); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
169 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
170 return retval; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
171 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
172 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
173 /* |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
174 * read a response from the server |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
175 * |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
176 * return 0 if first char doesn't match |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
177 * return 1 if first char matches |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
178 */ |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
179 static int readresp(struct stream_priv_s* ctl,char* rsp) |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
180 { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
181 static char response[256]; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
182 char match[5]; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
183 int r; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
184 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
185 if (readline(response,256,ctl) == -1) |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
186 return 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
187 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
188 r = atoi(response)/100; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
189 if(rsp) strcpy(rsp,response); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
190 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
191 mp_msg(MSGT_STREAM,MSGL_V, "[ftp] < %s",response); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
192 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
193 if (response[3] == '-') { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
194 strncpy(match,response,3); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
195 match[3] = ' '; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
196 match[4] = '\0'; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
197 do { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
198 if (readline(response,256,ctl) == -1) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
199 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] Control socket read failed\n"); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
200 return 0; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
201 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
202 mp_msg(MSGT_OPEN,MSGL_V, "[ftp] < %s",response); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
203 } while (strncmp(response,match,4)); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
204 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
205 return r; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
206 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
207 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
208 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
209 static int FtpSendCmd(const char *cmd, struct stream_priv_s *nControl,char* rsp) |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
210 { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
211 int l = strlen(cmd); |
16761
1eeb10c3e534
Make FtpSendCmd() function more user friendly by making it append the necessary "\r\n" line break (instead of the caller)
gpoirier
parents:
16750
diff
changeset
|
212 int hascrlf = cmd[l - 2] == '\r' && cmd[l - 1] == '\n'; |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
213 |
17854
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
214 if(hascrlf && l == 2) mp_msg(MSGT_STREAM,MSGL_V, "\n"); |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
215 else mp_msg(MSGT_STREAM,MSGL_V, "[ftp] > %s",cmd); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
216 while(l > 0) { |
31500 | 217 int s = send(nControl->handle,cmd,l,DEFAULT_SEND_FLAGS); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
218 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
219 if(s <= 0) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
220 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] write error: %s\n",strerror(errno)); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
221 return 0; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
222 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
223 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
224 cmd += s; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
225 l -= s; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
226 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
227 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
228 if (hascrlf) |
16761
1eeb10c3e534
Make FtpSendCmd() function more user friendly by making it append the necessary "\r\n" line break (instead of the caller)
gpoirier
parents:
16750
diff
changeset
|
229 return readresp(nControl,rsp); |
1eeb10c3e534
Make FtpSendCmd() function more user friendly by making it append the necessary "\r\n" line break (instead of the caller)
gpoirier
parents:
16750
diff
changeset
|
230 else |
1eeb10c3e534
Make FtpSendCmd() function more user friendly by making it append the necessary "\r\n" line break (instead of the caller)
gpoirier
parents:
16750
diff
changeset
|
231 return FtpSendCmd("\r\n", nControl, rsp); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
232 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
233 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
234 static int FtpOpenPort(struct stream_priv_s* p) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
235 int resp,fd; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
236 char rsp_txt[256]; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
237 char* par,str[128]; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
238 int num[6]; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
239 |
16761
1eeb10c3e534
Make FtpSendCmd() function more user friendly by making it append the necessary "\r\n" line break (instead of the caller)
gpoirier
parents:
16750
diff
changeset
|
240 resp = FtpSendCmd("PASV",p,rsp_txt); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
241 if(resp != 2) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
242 mp_msg(MSGT_OPEN,MSGL_WARN, "[ftp] command 'PASV' failed: %s\n",rsp_txt); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
243 return 0; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
244 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
245 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
246 par = strchr(rsp_txt,'('); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
247 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
248 if(!par || !par[0] || !par[1]) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
249 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] invalid server response: %s ??\n",rsp_txt); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
250 return 0; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
251 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
252 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
253 sscanf(par+1,"%u,%u,%u,%u,%u,%u",&num[0],&num[1],&num[2], |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
254 &num[3],&num[4],&num[5]); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
255 snprintf(str,127,"%d.%d.%d.%d",num[0],num[1],num[2],num[3]); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
256 fd = connect2Server(str,(num[4]<<8)+num[5],0); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
257 |
17854
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
258 if(fd < 0) |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
259 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] failed to create data connection\n"); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
260 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
261 return fd; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
262 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
263 |
30376
3365a4658320
Fix ftp support to properly support large files > 2GB.
reimar
parents:
29263
diff
changeset
|
264 static int FtpOpenData(stream_t* s,off_t newpos) { |
17854
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
265 struct stream_priv_s* p = s->priv; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
266 int resp; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
267 char str[256],rsp_txt[256]; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
268 |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
269 // Open a new connection |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
270 s->fd = FtpOpenPort(p); |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
271 |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
272 if(s->fd < 0) return 0; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
273 |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
274 if(newpos > 0) { |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
275 snprintf(str,255,"REST %"PRId64, (int64_t)newpos); |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
276 |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
277 resp = FtpSendCmd(str,p,rsp_txt); |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
278 if(resp != 3) { |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
279 mp_msg(MSGT_OPEN,MSGL_WARN, "[ftp] command '%s' failed: %s\n",str,rsp_txt); |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
280 newpos = 0; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
281 } |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
282 } |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
283 |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
284 // Get the file |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
285 snprintf(str,255,"RETR %s",p->filename); |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
286 resp = FtpSendCmd(str,p,rsp_txt); |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
287 |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
288 if(resp != 1) { |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
289 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] command '%s' failed: %s\n",str,rsp_txt); |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
290 return 0; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
291 } |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
292 |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
293 s->pos = newpos; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
294 return 1; |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
295 } |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
296 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
297 static int fill_buffer(stream_t *s, char* buffer, int max_len){ |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
298 int r; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
299 |
17854
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
300 if(s->fd < 0 && !FtpOpenData(s,s->pos)) |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
301 return -1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
302 |
17854
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
303 if(!fd_can_read(s->fd, 15)) { |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
304 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] read timed out\n"); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
305 return -1; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
306 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
307 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
308 r = recv(s->fd,buffer,max_len,0); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
309 return (r <= 0) ? -1 : r; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
310 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
311 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
312 static int seek(stream_t *s,off_t newpos) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
313 struct stream_priv_s* p = s->priv; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
314 int resp; |
17854
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
315 char rsp_txt[256]; |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
316 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
317 if(s->pos > s->end_pos) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
318 s->eof=1; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
319 return 0; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
320 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
321 |
23873 | 322 // Check to see if the server did not already terminate the transfer |
17854
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
323 if(fd_can_read(p->handle, 0)) { |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
324 if(readresp(p,rsp_txt) != 2) |
23873 | 325 mp_msg(MSGT_OPEN,MSGL_WARN, "[ftp] Warning the server didn't finished the transfer correctly: %s\n",rsp_txt); |
10627 | 326 closesocket(s->fd); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
327 s->fd = -1; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
328 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
329 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
330 // Close current download |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
331 if(s->fd >= 0) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
332 static const char pre_cmd[]={TELNET_IAC,TELNET_IP,TELNET_IAC,TELNET_SYNCH}; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
333 //int fl; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
334 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
335 // First close the fd |
10627 | 336 closesocket(s->fd); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
337 s->fd = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
338 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
339 // Send send the telnet sequence needed to make the server react |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
340 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
341 // Dunno if this is really needed, lftp have it. I let |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
342 // it here in case it turn out to be needed on some other OS |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
343 //fl=fcntl(p->handle,F_GETFL); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
344 //fcntl(p->handle,F_SETFL,fl&~O_NONBLOCK); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
345 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
346 // send only first byte as OOB due to OOB braindamage in many unices |
31500 | 347 send(p->handle,pre_cmd,1,MSG_OOB|DEFAULT_SEND_FLAGS); |
348 send(p->handle,pre_cmd+1,sizeof(pre_cmd)-1,DEFAULT_SEND_FLAGS); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
349 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
350 //fcntl(p->handle,F_SETFL,fl); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
351 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
352 // Get the 426 Transfer aborted |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
353 // Or the 226 Transfer complete |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
354 resp = readresp(p,rsp_txt); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
355 if(resp != 4 && resp != 2) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
356 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] Server didn't abort correctly: %s\n",rsp_txt); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
357 s->eof = 1; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
358 return 0; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
359 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
360 // Send the ABOR command |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
361 // Ignore the return code as sometimes it fail with "nothing to abort" |
16761
1eeb10c3e534
Make FtpSendCmd() function more user friendly by making it append the necessary "\r\n" line break (instead of the caller)
gpoirier
parents:
16750
diff
changeset
|
362 FtpSendCmd("ABOR",p,rsp_txt); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
363 } |
17854
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
364 return FtpOpenData(s,newpos); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
365 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
366 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
367 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
368 static void close_f(stream_t *s) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
369 struct stream_priv_s* p = s->priv; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
370 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
371 if(!p) return; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
372 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
373 if(s->fd > 0) { |
10627 | 374 closesocket(s->fd); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
375 s->fd = 0; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
376 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
377 |
16761
1eeb10c3e534
Make FtpSendCmd() function more user friendly by making it append the necessary "\r\n" line break (instead of the caller)
gpoirier
parents:
16750
diff
changeset
|
378 FtpSendCmd("QUIT",p,NULL); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
379 |
10627 | 380 if(p->handle) closesocket(p->handle); |
32511
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
31500
diff
changeset
|
381 free(p->buf); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
382 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
383 m_struct_free(&stream_opts,p); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
384 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
385 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
386 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
387 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
388 static int open_f(stream_t *stream,int mode, void* opts, int* file_format) { |
30376
3365a4658320
Fix ftp support to properly support large files > 2GB.
reimar
parents:
29263
diff
changeset
|
389 int resp; |
3365a4658320
Fix ftp support to properly support large files > 2GB.
reimar
parents:
29263
diff
changeset
|
390 int64_t len = 0; |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
391 struct stream_priv_s* p = (struct stream_priv_s*)opts; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
392 char str[256],rsp_txt[256]; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
393 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
394 if(mode != STREAM_READ) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
395 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] Unknown open mode %d\n",mode); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
396 m_struct_free(&stream_opts,opts); |
24257 | 397 return STREAM_UNSUPPORTED; |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
398 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
399 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
400 if(!p->filename || !p->host) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
401 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] Bad url\n"); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
402 m_struct_free(&stream_opts,opts); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
403 return STREAM_ERROR; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
404 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
405 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
406 // Open the control connection |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
407 p->handle = connect2Server(p->host,p->port,1); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
408 |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
409 if(p->handle < 0) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
410 m_struct_free(&stream_opts,opts); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
411 return STREAM_ERROR; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
412 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
413 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
414 // We got a connection, let's start serious things |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
415 stream->fd = -1; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
416 stream->priv = p; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
417 p->buf = malloc(BUFSIZE); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
418 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
419 if (readresp(p, NULL) == 0) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
420 close_f(stream); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
421 m_struct_free(&stream_opts,opts); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
422 return STREAM_ERROR; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
423 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
424 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
425 // Login |
16761
1eeb10c3e534
Make FtpSendCmd() function more user friendly by making it append the necessary "\r\n" line break (instead of the caller)
gpoirier
parents:
16750
diff
changeset
|
426 snprintf(str,255,"USER %s",p->user); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
427 resp = FtpSendCmd(str,p,rsp_txt); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
428 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
429 // password needed |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
430 if(resp == 3) { |
16761
1eeb10c3e534
Make FtpSendCmd() function more user friendly by making it append the necessary "\r\n" line break (instead of the caller)
gpoirier
parents:
16750
diff
changeset
|
431 snprintf(str,255,"PASS %s",p->pass); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
432 resp = FtpSendCmd(str,p,rsp_txt); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
433 if(resp != 2) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
434 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] command '%s' failed: %s\n",str,rsp_txt); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
435 close_f(stream); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
436 return STREAM_ERROR; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
437 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
438 } else if(resp != 2) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
439 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] command '%s' failed: %s\n",str,rsp_txt); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
440 close_f(stream); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
441 return STREAM_ERROR; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
442 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28402
diff
changeset
|
443 |
23873 | 444 // Set the transfer type |
16761
1eeb10c3e534
Make FtpSendCmd() function more user friendly by making it append the necessary "\r\n" line break (instead of the caller)
gpoirier
parents:
16750
diff
changeset
|
445 resp = FtpSendCmd("TYPE I",p,rsp_txt); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
446 if(resp != 2) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
447 mp_msg(MSGT_OPEN,MSGL_WARN, "[ftp] command 'TYPE I' failed: %s\n",rsp_txt); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
448 close_f(stream); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
449 return STREAM_ERROR; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
450 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
451 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
452 // Get the filesize |
16761
1eeb10c3e534
Make FtpSendCmd() function more user friendly by making it append the necessary "\r\n" line break (instead of the caller)
gpoirier
parents:
16750
diff
changeset
|
453 snprintf(str,255,"SIZE %s",p->filename); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
454 resp = FtpSendCmd(str,p,rsp_txt); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
455 if(resp != 2) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
456 mp_msg(MSGT_OPEN,MSGL_WARN, "[ftp] command '%s' failed: %s\n",str,rsp_txt); |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
457 } else { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
458 int dummy; |
30376
3365a4658320
Fix ftp support to properly support large files > 2GB.
reimar
parents:
29263
diff
changeset
|
459 sscanf(rsp_txt,"%d %"SCNd64,&dummy,&len); |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
460 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
461 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
462 if(len > 0) { |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
463 stream->seek = seek; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
464 stream->end_pos = len; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
465 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
466 |
17854
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
467 // The data connection is really opened only at the first |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
468 // read/seek. This must be done when the cache is used |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
469 // because the connection would stay open in the main process, |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
470 // preventing correct abort with many servers. |
a63fa57ecbd7
Fix seeking with cache enabled on systems using fork().
albeu
parents:
17012
diff
changeset
|
471 stream->fd = -1; |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
472 stream->priv = p; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
473 stream->fill_buffer = fill_buffer; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
474 stream->close = close_f; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
475 |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
476 return STREAM_OK; |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
477 } |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
478 |
25211 | 479 const stream_info_t stream_info_ftp = { |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
480 "File Transfer Protocol", |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
481 "ftp", |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
482 "Albeu", |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
483 "reuse a bit of code from ftplib written by Thomas Pfau", |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
484 open_f, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
485 { "ftp", NULL }, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
486 &stream_opts, |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
487 1 // Urls are an option string |
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
diff
changeset
|
488 }; |