8 def __init__(self, mnt, req):
16 params = errstr[errstr.index("needkey ")+8:]
17 if params.find("!password?") < 0:
19 if os.spawnl(os.P_WAIT, "/boot/factotum", "getkey", "-g", params) != 0:
24 def open(self, mnt, req):
28 self.url = req.get_full_url()
29 if self.url[0:5] == 'file:':
31 while path[0:2] == '//':
33 self.dir = '/dev/null'
34 self.body = open(path, 'r', 0)
36 ctl = open(mnt+'/clone', 'r+', 0)
38 self.dir = mnt+'/'+ctl.readline().rstrip('\n')
40 ctl.write('url '+self.url)
41 m = 'User-Agent: mercurial/proto-1.0\r\n';
43 m += h+': '+req.headers[h]+'\r\n'
45 ctl.write('headers '+m)
48 post = open(self.dir+'/postbody', 'w', 0);
58 self.body = open(self.dir+'/body', 'r', 0)
62 def read(self, amt=4096):
63 return self.body.read(amt);
73 def getheader(self, key):
74 name = re.sub(r'[^a-z]+', '', key.lower())
76 f = open(self.dir+'/'+name, 'r', 0)
89 def add_handler(self, handler):
92 def open(self, req, data=None):
93 return Webconn('/mnt/web', req)
99 def webopener(ui, authinfo=None):
102 mercurial.url.has_https = 1
103 mercurial.url.opener = webopener