Skip to content
Snippets Groups Projects
Commit ef3a24a0 authored by Gregory Szorc's avatar Gregory Szorc
Browse files

wireprotoserver: rename hgweb.protocol to wireprotoserver (API)

The HTTP wire protocol server / response handler is currently defined
in the hgweb sub-package. That only kind of makes sense. hgweb does
contain most of the HTTP server code. However, hgweb is more tailored
for providing HTTP server and WSGI scaffolding and serving hgweb
requests. The wire protocol is kind of its own beast.

In addition, the code for HTTP and SSH wire protocol handling is
actually pretty small and it needs to stay in sync to ensure parity
between the transport implementations.

We rename mercurial/hgweb/protocol.py to mercurial/wireprotoserver.py.
The new module will eventually become the home of the SSH handler
as well.

.. api::

   Content from mercurial.hgweb.protocol has been moved to
   mercurial.wireprotoserver.

Differential Revision: https://phab.mercurial-scm.org/D1965
parent 69d7fcd9
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@
templater,
ui as uimod,
util,
wireprotoserver,
)
from . import (
......@@ -39,7 +40,6 @@
)
from . import (
protocol,
webcommands,
webutil,
wsgicgi,
......@@ -362,9 +362,9 @@
# and the clients always use the old URL structure
cmd = pycompat.sysbytes(req.form.get(r'cmd', [r''])[0])
if protocol.iscmd(cmd):
if wireprotoserver.iscmd(cmd):
try:
if query:
raise ErrorResponse(HTTP_NOT_FOUND)
if cmd in perms:
self.check_perm(rctx, req, perms[cmd])
......@@ -366,9 +366,9 @@
try:
if query:
raise ErrorResponse(HTTP_NOT_FOUND)
if cmd in perms:
self.check_perm(rctx, req, perms[cmd])
return protocol.call(rctx.repo, req, cmd)
return wireprotoserver.call(rctx.repo, req, cmd)
except ErrorResponse as inst:
# A client that sends unbundle without 100-continue will
# break if we respond early.
......@@ -379,7 +379,7 @@
req.drain()
else:
req.headers.append((r'Connection', r'Close'))
req.respond(inst, protocol.HGTYPE,
req.respond(inst, wireprotoserver.HGTYPE,
body='0\n%s\n' % inst)
return ''
......
#
# Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
#
......@@ -10,6 +9,6 @@
import cgi
import struct
from .common import (
from .hgweb.common import (
HTTP_OK,
)
......@@ -14,9 +13,8 @@
HTTP_OK,
)
from .. import (
from . import (
error,
pycompat,
util,
wireproto,
)
......@@ -18,8 +16,9 @@
error,
pycompat,
util,
wireproto,
)
stringio = util.stringio
urlerr = util.urlerr
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment