Commit Graph

87 Commits

Author SHA1 Message Date
Matt Mackall
944b7f7b5c pyflakes: clean up some import noise 2011-10-11 23:16:05 -05:00
Augie Fackler
5997cc6e9c hgweb: move remaining hasattr calls to safehasattr 2011-07-25 15:38:46 -05:00
Thomas Arendsen Hein
692a53d202 classes: fix class style problems found by 06e968819ac9
This makes test-wireprotocol.py work on Python 2.4
2011-06-29 15:00:00 +02:00
Steven Brown
c1075f3880 httprepo: long arguments support (issue2126)
Send the command arguments in the HTTP headers. The command is still part
of the URL. If the server does not have the 'httpheader' capability, the
client will send the command arguments in the URL as it did previously.

Web servers typically allow more data to be placed within the headers than
in the URL, so this approach will:
- Avoid HTTP errors due to using a URL that is too large.
- Allow Mercurial to implement a more efficient wire protocol.

An alternate approach is to send the arguments as part of the request body.
This approach has been rejected because it requires the use of POST
requests, so it would break any existing configuration that relies on the
request type for authentication or caching.

Extensibility:
- The header size is provided by the server, which makes it possible to
  introduce an hgrc setting for it.
- The client ignores the capability value after the first comma, which
  allows more information to be included in the future.
2011-05-01 01:04:37 +08:00
Augie Fackler
c986a6137a hgweb: add support for 100-continue as recommended by PEP 333. 2010-02-06 04:27:28 -06:00
Mads Kiilerich
c77a84761e serve: catch and log all Exceptions, not only StandardException
Other exceptions than StandardExceptions were left to the default error handler
which was muted when running in daemon mode.

Now all Exceptions are handled and logged to the log file.
2011-02-21 00:52:23 +01:00
Mads Kiilerich
edd19f159b hgweb: let HTTPS serve use more compatible and less secure encryption
PROTOCOL_SSLv3 on the server side doesn't work everywhere. Sometimes the client
reports "EOF occurred in violation of protocol" (for example on Mac and Solaris).

The more compatible PROTOCOL_SSLv23 is now used instead. It works but is less
"secure" for some OpenSSL versions as it can fall back to weak encryption.
2010-10-21 03:18:52 +02:00
Mads Kiilerich
affe4fdcad hgweb: use Pythons ssl module for HTTPS serve when using Python 2.6 or later
pyOpenSSL apparently doesn't work for Python 2.7 and isn't very actively
maintained.

The built-in ssl module seems like a long-term winner, so we now use that with
Python 2.6 and higher.
2010-10-20 20:19:34 +02:00
Mads Kiilerich
1edb529392 hgweb: refactor all pyOpenSSL references into one class 2010-10-20 20:19:32 +02:00
Mads Kiilerich
c627f511ce serve: fix https mode and add test
The https mode failed in super because BaseRequestHandler is an old-style
class.

This introduces the first test of https client/server functionality - and
"hghave ssl". The test is currently only run on Python 2.6.
2010-10-17 04:13:35 +02:00
Brodie Rao
d1905b7d87 mail/hgweb: support service names for ports (issue2350)
This adds util.getport(port) which tries to parse port as an int, and
failing that, looks it up using socket.getservbyname(). Thus, the
following will work:

    [smtp]
    port = submission

    [web]
    port = http

This does not apply to ports in URLs used in clone, pull, etc.
2010-08-28 12:31:07 -04:00
Nicolas Dumazet
7f1a963829 pylint, pyflakes: remove unused or duplicate imports 2010-04-14 17:58:10 +09:00
Dirkjan Ochtman
ccdb890cae server: initialize wsgi app in command, then wrap server around it 2010-03-11 13:33:29 +01:00
Dirkjan Ochtman
00a94fdb4f server: unnest server classes into module namespace 2010-03-11 13:32:43 +01:00
Dirkjan Ochtman
5515b56ded server: pass wsgi application to server (no need for non-local var) 2010-03-11 13:32:26 +01:00
Dirkjan Ochtman
a9255ccde6 server: abstract setup of ipv6 vs. normal server 2010-03-11 13:31:37 +01:00
Dirkjan Ochtman
d8ccfe3fad server: handle server-internal config setup inside server class 2010-03-11 13:30:52 +01:00
Dirkjan Ochtman
b779820610 server: externalize and streamline mixin setup 2010-03-11 13:28:39 +01:00
Dirkjan Ochtman
4f2c2edfe6 server: externalize application creation 2010-03-11 11:21:48 +01:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Alejandro Santos
5eb00dc7df compat: remove unnecessary diamond-shaped multiple inheritance 2009-07-05 11:06:41 +02:00
Martin Geisler
3f7c86dc69 wrap string literals in error messages 2009-05-31 01:30:16 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Dirkjan Ochtman
ed04819e2f hgweb: pre-init mimetypes module (fixes ugly bug in python-2.6.2 mimetypes)
The ugly initialization hack in mimetypes' initialization procedure can make
hg serve hit the maximum recursion depth when in threaded mode.
2009-04-27 16:29:26 +02:00
Martin Geisler
b5e430c97b hgweb: better English in IPv6 error message 2009-03-31 22:48:16 +02:00
Brodie Rao
cb9a8632f9 hgweb: fix undefined name RepoError 2009-03-27 11:17:46 -04:00
Matt Mackall
e0735a1762 error: move repo errors
rename NoCapability to CapabilityError
2009-01-12 10:42:31 -06:00
Benoit Boissinot
ea7fe6dacc remove unused variables 2008-10-28 19:25:26 +01:00
Martin Geisler
da335e4675 i18n: import _ instead of gettext 2008-10-21 17:47:49 +02:00
Martin Geisler
28fb695e9a i18n: mark strings for translation in Mercurial 2008-08-31 16:12:02 +02:00
Dirkjan Ochtman
d50a34e7a6 hgweb: all protocol functions have become generators
Using the write() callable supplied by the start_response() call is
frowned upon by the WSGI spec, returning an iterable over the content chunks
is the recommended way. Be aware, though: returning many small chunks will
slow down responses, because the server has to flush each chunk separately.
2008-06-29 15:23:09 +02:00
Benoit Boissinot
f193be73bd hgweb: remove dead code 2008-03-29 21:15:34 +01:00
Stephen Deasey
b6ba89dcec hgweb: clarify which address and port can/cannot be bound at startup (bug 769)
The error message at startup when the address/port could not be bound
was confusing:

    hg serve
    abort: cannot start server: Address already in use

Be more explicit:

    $ hg serve -a localhost
    abort: cannot start server at 'localhost:8000': Address already in use

Also be more explicit on success, showing hostname and ip address/port:

    $ hg -v serve -a localhost -p 80
    listening at http://localhost/ (127.0.0.1:80)


We are careful to handle a missconfigured machine whose hostname does not
resolve, falling back to the address given at the command line.

Remove a dead-code error message.
2008-03-10 19:25:34 +00:00
Joel Rosdahl
c26213193c Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg 2008-03-06 22:51:16 +01:00
Joel Rosdahl
4f8012378a Remove unused imports 2008-03-06 22:23:41 +01:00
Michele Cella
095d8aff18 hgweb: fixes to make hg serve prefix handling more robust 2008-01-22 22:13:29 +01:00
Michele Cella
0e20a92c0f adding "prefix" option to "hg serve" (command line and [web] section)
allows "hg serve" to serve from a different path than '/' (server root)
2008-01-09 11:15:00 +01:00
Mirko Friedenhagen
2a87bfec34 server: append to logfiles 2007-12-24 17:21:40 +01:00
Dirkjan Ochtman
a20c52b449 Use SCRIPT_NAME and PATH_INFO instead of REQUEST_URI. This is required by WSGI (fixes issue846). 2007-12-01 19:19:08 +01:00
Dirkjan Ochtman
eb63af80e4 Less indirection in the WSGI web interface. This simplifies some code, and makes it more compliant with WSGI. 2007-11-30 18:23:18 +01:00
Patrick Mezard
7d72f53113 hgweb.server: flush log files after every access 2007-11-27 23:55:03 +01:00
Benoit Boissinot
5c3e74025c merge with -stable 2007-08-09 01:07:11 +02:00
Benoit Boissinot
25ee8ea56b unobfuscate part of fec055ae35cc 2007-08-09 01:04:27 +02:00
Benoit Boissinot
258f71b5a3 merge with -stable 2007-08-08 23:00:01 +02:00
Eric Hopper
e7f6d77433 Fix hgwebdir after aaaee74b883fc144cc3472c81c61157bc69374b6 broke it. 2007-08-08 22:47:30 +02:00
Thomas Arendsen Hein
d9d3256252 removed trailing whitespace 2007-07-21 10:30:51 +02:00
Brendan Cully
a0b3ae0fbb cosmetics 2007-07-12 22:44:16 -07:00
Wesley J. Landaker
90ae651c49 Make hg serve set the wsgi.url_scheme property correctly.
This fixes the bug where hg serve with SSL will always detect the wrong
urlbase for templates. This is also part of unifying the CGI interface
and hg serve interface to both use standard wsgi.
2007-07-12 13:58:36 -06:00
Alexis S. L. Carvalho
05dd580e30 merge with crew-stable 2007-07-11 20:15:03 -03:00
Alexis S. L. Carvalho
3b07689b6a serve: respect settings from .hg/hgrc
create_server was looking only at the root ui object, ignoring any
settings from .hg/hgrc.  To keep respecting command-line arguments,
commands.serve must also call repo.ui.setconfig.
2007-07-11 19:56:16 -03:00