Merge lp:~mwhudson/launchpad/ssl-imports-bug-512763 into lp:launchpad

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Aaron Bentley
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~mwhudson/launchpad/ssl-imports-bug-512763
Merge into: lp:launchpad
Diff against target: 32 lines (+15/-0)
1 file modified
scripts/code-import-worker.py (+15/-0)
To merge this branch: bzr merge lp:~mwhudson/launchpad/ssl-imports-bug-512763
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Review via email: mp+18479@code.launchpad.net

Commit message

Force bzrlib to use the urllib transport for code imports, which doesn't choke on self signed certificates

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

This branch forces bzrlib to use the urllib transport for code imports, which has the happy consequence of not failing on self-signed certificates.

Revision history for this message
Aaron Bentley (abentley) wrote :

Please provide the comment on force_bzr_to_use_urllib as a docstring. Otherwise, this looks good to land.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'scripts/code-import-worker.py'
--- scripts/code-import-worker.py 2010-01-31 23:48:38 +0000
+++ scripts/code-import-worker.py 2010-02-03 20:40:32 +0000
@@ -31,6 +31,20 @@
31from canonical.launchpad import scripts31from canonical.launchpad import scripts
3232
3333
34def force_bzr_to_use_urllib():
35 """Prevent bzr from using pycurl to connect to http: urls.
36
37 We want this because pycurl rejects self signed certificates, which
38 prevents a significant number of import branchs from updating. Also see
39 https://bugs.edge.launchpad.net/bzr/+bug/516222.
40 """
41 from bzrlib.transport import register_lazy_transport
42 register_lazy_transport('http://', 'bzrlib.transport.http._urllib',
43 'HttpTransport_urllib')
44 register_lazy_transport('https://', 'bzrlib.transport.http._urllib',
45 'HttpTransport_urllib')
46
47
34class CodeImportWorker:48class CodeImportWorker:
3549
36 def __init__(self):50 def __init__(self):
@@ -40,6 +54,7 @@
40 self.logger = scripts.logger(options, 'code-import-worker')54 self.logger = scripts.logger(options, 'code-import-worker')
4155
42 def main(self):56 def main(self):
57 force_bzr_to_use_urllib()
43 source_details = CodeImportSourceDetails.fromArguments(self.args)58 source_details = CodeImportSourceDetails.fromArguments(self.args)
44 if source_details.rcstype == 'git':59 if source_details.rcstype == 'git':
45 load_optional_plugin('git')60 load_optional_plugin('git')