mercurial/hgweb/server.py
changeset 51696 7f0cb9ee0534
parent 51686 493034cc3265
child 51699 ca7bde5dbafb
equal deleted inserted replaced
51695:bd1483fd7088 51696:7f0cb9ee0534
    64         for msg in seq:
    64         for msg in seq:
    65             self.handler.log_error("HG error:  %s", encoding.strfromlocal(msg))
    65             self.handler.log_error("HG error:  %s", encoding.strfromlocal(msg))
    66 
    66 
    67 
    67 
    68 class _httprequesthandler(httpservermod.basehttprequesthandler):
    68 class _httprequesthandler(httpservermod.basehttprequesthandler):
       
    69 
    69     url_scheme = b'http'
    70     url_scheme = b'http'
    70 
    71 
    71     @staticmethod
    72     @staticmethod
    72     def preparehttpserver(httpserver, ui):
    73     def preparehttpserver(httpserver, ui):
    73         """Prepare .socket of new HTTPServer instance"""
    74         """Prepare .socket of new HTTPServer instance"""
   355         return open(opt, b'ab')
   356         return open(opt, b'ab')
   356     return default
   357     return default
   357 
   358 
   358 
   359 
   359 class MercurialHTTPServer(_mixin, httpservermod.httpserver, object):
   360 class MercurialHTTPServer(_mixin, httpservermod.httpserver, object):
       
   361 
   360     # SO_REUSEADDR has broken semantics on windows
   362     # SO_REUSEADDR has broken semantics on windows
   361     if pycompat.iswindows:
   363     if pycompat.iswindows:
   362         allow_reuse_address = 0
   364         allow_reuse_address = 0
   363 
   365 
   364     def __init__(self, ui, app, addr, handler, **kwargs):
   366     def __init__(self, ui, app, addr, handler, **kwargs):
   392             raise error.RepoError(_(b'IPv6 is not available on this system'))
   394             raise error.RepoError(_(b'IPv6 is not available on this system'))
   393         super(IPv6HTTPServer, self).__init__(*args, **kwargs)
   395         super(IPv6HTTPServer, self).__init__(*args, **kwargs)
   394 
   396 
   395 
   397 
   396 def create_server(ui, app):
   398 def create_server(ui, app):
       
   399 
   397     if ui.config(b'web', b'certificate'):
   400     if ui.config(b'web', b'certificate'):
   398         handler = _httprequesthandlerssl
   401         handler = _httprequesthandlerssl
   399     else:
   402     else:
   400         handler = _httprequesthandler
   403         handler = _httprequesthandler
   401 
   404