cURL (pycurl) FTP-über-HTTP-proxy

Ich mit dem schreiben von einfachen Upload script und nur eingefangen nächste Sache: LOCKE versucht zu tun SETZEN auf eine ftp server:

Dem vereinfachten code:

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()

Fast gleichen code war auch vor einigen Monaten, aber:

* 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

Und die gleiche Antwort, wenn ich versuchen dies zu tun, von shell:

curl --upload-file "asus.c" --proxy 10.0.0.35:3128 \
--proxytunnel -u username:password ftp://<ftp_name>/asus.c

Warum? Was habe ich verpasst?

Es sieht aus wie Sie versuchen, zu sprechen HTTP -, einen FTP-server. Hat dein proxy funktioniert wie ein FTP-proxy mit diesen Einstellungen, z.B. über einen browser oder eine bekannte FTP-client?
Ja. FileZilla verbindet (und uploads) fein durch diesen proxy (squid konfiguriert).

InformationsquelleAutor mik_os | 2012-02-06

Schreibe einen Kommentar