Your message dated Wed, 4 Jun 2008 13:09:24 +0100
with message-id <[EMAIL PROTECTED]>
and subject line This patch is pointless
has caused the Debian Bug report #484108,
regarding Support changing the port in HTTP/HTTPS uploads
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [EMAIL PROTECTED]
immediately.)


-- 
484108: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=484108
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
Package: dput
Version: 0.9.2.32
Severity: wishlist

Hi,

Specifying the port to upload on when using the http/https method in
doesn't work as it's simply not handled in http.py.

I attach a patch to enable changing the HTTP port by using "fqdn:port"
for the fqdn config variable.

Thanks,

-- 
Jonny Lamb, UK                                   [EMAIL PROTECTED]
http://jonnylamb.com                                     GPG: 0x2E039402
diff -Nruad -Nruad dput-0.9.2.32.orig/dput dput-0.9.2.32/dput
--- dput-0.9.2.32.orig/dput     2008-05-04 10:58:54.000000000 +0100
+++ dput-0.9.2.32/dput  2008-06-02 15:20:42.000000000 +0100
@@ -876,6 +876,19 @@
                   print "D: ssh config options:\n  "+'\n  
'.join(ssh_config_options)
                 upload_methods[method](fqdn, login, incoming, \
                     files_to_upload, debug, scp_compress, ssh_config_options)
+            elif method.startswith('http'):
+                if ':' in fqdn:
+                    fqdn, port = fqdn.rsplit(':',1)
+                else:
+                    if method == 'https':
+                        port = 443
+                    else:
+                        port = 80
+                if debug:
+                    print "D: HTTP port: %s" % port
+                upload_methods[method](
+                    fqdn, login, incoming, \
+                    files_to_upload, debug, 0, progress=progress, port=port)
             else:
                 upload_methods[method](fqdn, login, incoming, \
                     files_to_upload, debug, 0, progress=progress)
diff -Nruad -Nruad dput-0.9.2.32.orig/http.py dput-0.9.2.32/http.py
--- dput-0.9.2.32.orig/http.py  2008-05-01 19:56:34.000000000 +0100
+++ dput-0.9.2.32/http.py       2008-06-02 15:14:44.000000000 +0100
@@ -56,7 +56,7 @@
     return self.headers
   
 # Upload the files via WebDAV
-def upload(fqdn, login, incoming, files_to_upload, debug, dummy, progress=0, 
protocol="http"):
+def upload(fqdn, login, incoming, files_to_upload, debug, dummy, progress=0, 
protocol="http", port=80):
     # EXCEPTION HANDLING!
     if protocol == 'https':
       connclass = httplib.HTTPSConnection
@@ -92,7 +92,7 @@
        url = "%s://%s%s" % (protocol,fqdn,url_path)
         if debug:
           print "D: HTTP-PUT to URL: %s"%url
-       conn = connclass(fqdn)
+       conn = connclass(fqdn, port=int(port))
        conn.putrequest("PUT", url_path, skip_accept_encoding=True)
        # Host: should be automatic
        conn.putheader('User-Agent','dput')
@@ -120,6 +120,6 @@
            print "Upload failed as unauthorized: %s"%res.reason
            print "  Maybe wrong username or password?"
          else:
-           print "Upload failed: %d %d"%res.status, res.reason
+           print "Upload failed: %d %s" % (res.status, res.reason)
          sys.exit(1)
        res.read() # must be done, but we're not interested
diff -Nruad -Nruad dput-0.9.2.32.orig/https.py dput-0.9.2.32/https.py
--- dput-0.9.2.32.orig/https.py 2008-05-01 19:56:34.000000000 +0100
+++ dput-0.9.2.32/https.py      2008-06-02 15:20:49.000000000 +0100
@@ -3,5 +3,5 @@
 exec open("/usr/share/dput/http.py") in d
 real_upload = d["upload"]
 
-def upload(fqdn, login, incoming, files_to_upload, debug, dummy, progress=0):
-    return real_upload(fqdn, login, incoming, files_to_upload, debug, dummy, 
progress, protocol="https")
+def upload(fqdn, login, incoming, files_to_upload, debug, dummy, progress=0, 
port=443):
+    return real_upload(fqdn, login, incoming, files_to_upload, debug, dummy, 
progress, protocol="https", port=port)

Attachment: signature.asc
Description: Digital signature


--- End Message ---
--- Begin Message ---
Hi,

So, I obviously didn't do enough testing. It seems that the following
two statements are the same:

    >>> httplib.HTTPConnection('localhost', port=5000)

    >>> httplib.HTTPConnection('localhost:5000')

So using "fqdn = localhost:5000" in dput.cf does indeed already work.
(I missed this originally because I thought of using a "port" field in
dput.cf and then switched to the "server:port" syntax..)

This patch is quite pointless now then as the feature in dput already
exists. I'm closing this bug.

Thanks,

-- 
Jonny Lamb, UK                                   [EMAIL PROTECTED]
http://jonnylamb.com                                     GPG: 0x2E039402

Attachment: signature.asc
Description: Digital signature


--- End Message ---

Reply via email to