Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgweb_mod.py @ 36814:f9078c6caeb6
hgweb: parse and store HTTP request headers
WSGI transmits HTTP request headers as HTTP_* environment variables.
We teach our parser about these and hook up a dict-like data
structure that supports case insensitive header manipulation.
Differential Revision: https://phab.mercurial-scm.org/D2742
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 08 Mar 2018 16:22:25 -0800 |
parents | 158d4ecc03c8 |
children | 1f7d9024674c |
comparison
equal
deleted
inserted
replaced
36813:5a3c83412f79 | 36814:f9078c6caeb6 |
---|---|
349 node = args.pop(0).replace('%2F', '/') | 349 node = args.pop(0).replace('%2F', '/') |
350 wsgireq.form['node'] = [node] | 350 wsgireq.form['node'] = [node] |
351 if args: | 351 if args: |
352 wsgireq.form['file'] = args | 352 wsgireq.form['file'] = args |
353 | 353 |
354 ua = wsgireq.env.get('HTTP_USER_AGENT', '') | 354 ua = req.headers.get('User-Agent', '') |
355 if cmd == 'rev' and 'mercurial' in ua: | 355 if cmd == 'rev' and 'mercurial' in ua: |
356 wsgireq.form['style'] = ['raw'] | 356 wsgireq.form['style'] = ['raw'] |
357 | 357 |
358 if cmd == 'archive': | 358 if cmd == 'archive': |
359 fn = wsgireq.form['node'][0] | 359 fn = wsgireq.form['node'][0] |