mercurial/hgweb/hgweb_mod.py
changeset 35856 ef3a24a023ec
parent 35037 da5d5ea7d696
child 35857 a42455b3dbf8
equal deleted inserted replaced
35855:69d7fcd91696 35856:ef3a24a023ec
    34     repoview,
    34     repoview,
    35     templatefilters,
    35     templatefilters,
    36     templater,
    36     templater,
    37     ui as uimod,
    37     ui as uimod,
    38     util,
    38     util,
       
    39     wireprotoserver,
    39 )
    40 )
    40 
    41 
    41 from . import (
    42 from . import (
    42     protocol,
       
    43     webcommands,
    43     webcommands,
    44     webutil,
    44     webutil,
    45     wsgicgi,
    45     wsgicgi,
    46 )
    46 )
    47 
    47 
   360         # process this if it's a protocol request
   360         # process this if it's a protocol request
   361         # protocol bits don't need to create any URLs
   361         # protocol bits don't need to create any URLs
   362         # and the clients always use the old URL structure
   362         # and the clients always use the old URL structure
   363 
   363 
   364         cmd = pycompat.sysbytes(req.form.get(r'cmd', [r''])[0])
   364         cmd = pycompat.sysbytes(req.form.get(r'cmd', [r''])[0])
   365         if protocol.iscmd(cmd):
   365         if wireprotoserver.iscmd(cmd):
   366             try:
   366             try:
   367                 if query:
   367                 if query:
   368                     raise ErrorResponse(HTTP_NOT_FOUND)
   368                     raise ErrorResponse(HTTP_NOT_FOUND)
   369                 if cmd in perms:
   369                 if cmd in perms:
   370                     self.check_perm(rctx, req, perms[cmd])
   370                     self.check_perm(rctx, req, perms[cmd])
   371                 return protocol.call(rctx.repo, req, cmd)
   371                 return wireprotoserver.call(rctx.repo, req, cmd)
   372             except ErrorResponse as inst:
   372             except ErrorResponse as inst:
   373                 # A client that sends unbundle without 100-continue will
   373                 # A client that sends unbundle without 100-continue will
   374                 # break if we respond early.
   374                 # break if we respond early.
   375                 if (cmd == 'unbundle' and
   375                 if (cmd == 'unbundle' and
   376                     (req.env.get('HTTP_EXPECT',
   376                     (req.env.get('HTTP_EXPECT',
   377                                  '').lower() != '100-continue') or
   377                                  '').lower() != '100-continue') or
   378                     req.env.get('X-HgHttp2', '')):
   378                     req.env.get('X-HgHttp2', '')):
   379                     req.drain()
   379                     req.drain()
   380                 else:
   380                 else:
   381                     req.headers.append((r'Connection', r'Close'))
   381                     req.headers.append((r'Connection', r'Close'))
   382                 req.respond(inst, protocol.HGTYPE,
   382                 req.respond(inst, wireprotoserver.HGTYPE,
   383                             body='0\n%s\n' % inst)
   383                             body='0\n%s\n' % inst)
   384                 return ''
   384                 return ''
   385 
   385 
   386         # translate user-visible url structure to internal structure
   386         # translate user-visible url structure to internal structure
   387 
   387