Show More
@@ -49,6 +49,19 b' BUNDLESPEC' | |||
|
49 | 49 | The actual value doesn't impact client behavior beyond filtering: |
|
50 | 50 | clients will still sniff the bundle type from the header of downloaded |
|
51 | 51 | files. |
|
52 | ||
|
53 | REQUIRESNI | |
|
54 | Whether Server Name Indication (SNI) is required to connect to the URL. | |
|
55 | SNI allows servers to use multiple certificates on the same IP. It is | |
|
56 | somewhat common in CDNs and other hosting providers. Older Python | |
|
57 | versions do not support SNI. Defining this attribute enables clients | |
|
58 | with older Python versions to filter this entry. | |
|
59 | ||
|
60 | If this is defined, it is important to advertise a non-SNI fallback | |
|
61 | URL or clients running old Python releases may not be able to clone | |
|
62 | with the clonebundles facility. | |
|
63 | ||
|
64 | Value should be "true". | |
|
52 | 65 | """ |
|
53 | 66 | |
|
54 | 67 | from mercurial import ( |
@@ -12,6 +12,7 b' import util, scmutil, changegroup, base8' | |||
|
12 | 12 | import discovery, phases, obsolete, bookmarks as bookmod, bundle2, pushkey |
|
13 | 13 | import lock as lockmod |
|
14 | 14 | import streamclone |
|
15 | import sslutil | |
|
15 | 16 | import tags |
|
16 | 17 | import url as urlmod |
|
17 | 18 | |
@@ -1670,6 +1671,11 b' def filterclonebundleentries(repo, entri' | |||
|
1670 | 1671 | 'spec: %s\n' % (entry['URL'], str(e))) |
|
1671 | 1672 | continue |
|
1672 | 1673 | |
|
1674 | if 'REQUIRESNI' in entry and not sslutil.hassni: | |
|
1675 | repo.ui.debug('filtering %s because SNI not supported\n' % | |
|
1676 | entry['URL']) | |
|
1677 | continue | |
|
1678 | ||
|
1673 | 1679 | newentries.append(entry) |
|
1674 | 1680 | |
|
1675 | 1681 | return newentries |
@@ -227,3 +227,37 b' Automatic fallback when all entries are ' | |||
|
227 | 227 | adding manifests |
|
228 | 228 | adding file changes |
|
229 | 229 | added 2 changesets with 2 changes to 2 files |
|
230 | ||
|
231 | URLs requiring SNI are filtered in Python <2.7.9 | |
|
232 | ||
|
233 | $ cp full.hg sni.hg | |
|
234 | $ cat > server/.hg/clonebundles.manifest << EOF | |
|
235 | > http://localhost:$HGPORT1/sni.hg REQUIRESNI=true | |
|
236 | > http://localhost:$HGPORT1/full.hg | |
|
237 | > EOF | |
|
238 | ||
|
239 | #if sslcontext | |
|
240 | Python 2.7.9+ support SNI | |
|
241 | ||
|
242 | $ hg clone -U http://localhost:$HGPORT sni-supported | |
|
243 | applying clone bundle from http://localhost:$HGPORT1/sni.hg | |
|
244 | adding changesets | |
|
245 | adding manifests | |
|
246 | adding file changes | |
|
247 | added 2 changesets with 2 changes to 2 files | |
|
248 | finished applying clone bundle | |
|
249 | searching for changes | |
|
250 | no changes found | |
|
251 | #else | |
|
252 | Python <2.7.9 will filter SNI URLs | |
|
253 | ||
|
254 | $ hg clone -U http://localhost:$HGPORT sni-unsupported | |
|
255 | applying clone bundle from http://localhost:$HGPORT1/full.hg | |
|
256 | adding changesets | |
|
257 | adding manifests | |
|
258 | adding file changes | |
|
259 | added 2 changesets with 2 changes to 2 files | |
|
260 | finished applying clone bundle | |
|
261 | searching for changes | |
|
262 | no changes found | |
|
263 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now