From 8e48a0eeefa82fb613c76677c6cff6ecbf924052 Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Tue, 16 Dec 2008 17:49:30 -0700
Subject: [PATCH] uri: generalize regexp that recognizes tahoe URLs to work for
 any host and port

---
 src/allmydata/uri.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/allmydata/uri.py b/src/allmydata/uri.py
index 8994cce7..6b0e0666 100644
--- a/src/allmydata/uri.py
+++ b/src/allmydata/uri.py
@@ -16,10 +16,11 @@ BASE32STR_256bits = '(%s{51}%s)' % (base32.BASE32CHAR, base32.BASE32CHAR_1bits)
 
 SEP='(?::|%3A)'
 NUMBER='([0-9]+)'
+NUMBER_IGNORE='(?:[0-9]+)'
 
 # URIs (soon to be renamed "caps") are always allowed to come with a leading
 # 'http://127.0.0.1:(8123|3456)/uri/' that will be ignored.
-OPTIONALHTTPLEAD=r'(?:https?://(?:127.0.0.1|localhost):(?:8123|3456)/uri/)?'
+OPTIONALHTTPLEAD=r'(?:https?://(?:[^:/]+)(?::%s)?/uri/)?' % NUMBER_IGNORE
 
 
 class _BaseURI:
-- 
2.45.2