I 간단한 업로드 스크립트와 단지 사로 잡았 다음 일을 작성 :컬 (pycurl) FTP
단순화 된 코드 :
import pycurl
from os.path import getsize
c = pycurl.Curl()
c.setopt(pycurl.URL, 'ftp://<ftp_name>:21/asus.c')
c.setopt(pycurl.USERPWD, 'username:password')
c.setopt(pycurl.PROXY, '10.0.0.35')
c.setopt(pycurl.PROXYPORT, 3128)
c.setopt(pycurl.VERBOSE, 1)
f = open('asus.c')
c.setopt(pycurl.INFILE, f)
c.setopt(pycurl.INFILESIZE, getsize('asus.c'))
c.setopt(pycurl.HTTPPROXYTUNNEL, 1)
c.setopt(pycurl.UPLOAD, 1)
c.perform()
시도가
FTP 서버에
PUT을 할 말림
거의 동일한 코드가 아니라 몇 달 전에 작동했지만 :
* About to connect() to proxy <IP> port 3128 (#0)
* Trying <IP>... * connected
* Connected to <IP> (<IP>) port 3128 (#0)
* Establish HTTP proxy tunnel to <ftp_name>:21
* Server auth using Basic with user 'username'
> CONNECT <ftp_name>:21 HTTP/1.1
Host: <ftp_name>:21
User-Agent: PycURL/7.21.6
Proxy-Connection: Keep-Alive
< HTTP/1.0 200 Connection established
<
* Proxy replied OK to CONNECT request
* Server auth using Basic with user 'username'
> PUT /asus.c HTTP/1.1
Authorization: Basic _______________________________
User-Agent: PycURL/7.21.6
Host: <ftp_name>:21
Accept: */*
Content-Length: 2627
Expect: 100-continue
220 ProFTPD 1.3.3 Server (______ FTP Server) [<IP>]
500 PUT not understood
500 AUTHORIZATION: not understood
500 USER-AGENT: not understood
500 HOST: not understood
500 ACCEPT: not understood
500 CONTENT-LENGTH: not understood
500 EXPECT: not understood
500 Invalid command: try being more creative
와 동일한 응답 나는이 작업을 수행 할 때 쉘에서 :
curl --upload-file "asus.c" --proxy 10.0.0.35:3128 \
--proxytunnel -u username:password ftp://<ftp_name>/asus.c
왜? 나는 무엇을 놓쳤는가?
당신이 FTP 서버에 HTTP를 이야기하려고하는 것 같습니다 자세한. 프록시가 이러한 설정을 사용하여 FTP 프록시로 작동합니까 (예 : 브라우저 또는 알려진 FTP 클라이언트에서? – 9000
예. FileZilla는이 프록시 (구성된 오징어)를 통해 잘 연결 (업로드)합니다. –