Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: =?UTF-8?Q?Radek_Hol=C3=BD?= Newsgroups: comp.lang.python Subject: HTTPServer and SSL Date: Sun, 17 Apr 2016 16:56:57 +0200 Lines: 27 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de zL2U68+6A48hy39y8XB4nAagh4nrefAATK60Pzdgc3zA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'handler': 0.04; 'anymore.': 0.09; 'https': 0.09; 'python': 0.10; '2.7': 0.13; '2014': 0.16; 'handler)': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:SSL': 0.16; 'attribute': 0.18; 'explicit': 0.22; 'not.': 0.27; 'wonder': 0.27; 'message- id:@mail.gmail.com': 0.27; 'http': 0.33; 'safely': 0.33; 'similar': 0.33; 'server': 0.34; 'list': 0.34; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'so,': 0.35; "isn't": 0.35; 'supports': 0.35; 'but': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'method': 0.37; 'received:209': 0.38; 'received:209.85.220': 0.38; 'test': 0.39; 'to:addr:python.org': 0.40; 'hello,': 0.40; 'some': 0.40; 'questions': 0.40; 'combining': 0.66; 'approach.': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=holych-org.20150623.gappssmtp.com; s=20150623; h=mime-version:date:message-id:subject:from:to; bh=uzmAQFd90WrO6u9qXxpGoG4P4on63nekOAl9M0yMIJQ=; b=d3YiBoXg+A+PXnN1dxHNkUjo6lmtc8tj3kNsFoegSsV9PBrq8lBsIAJKW/ZXm2mY4T B+l+r1GwOYSn9ztLAvKdrtRkVja4IFi6OfX0mMwsWesIlC0MGYVTlnQzwjJ8OqDG8WWe Mpqw+t23xJz9fqdUV9T54fpacb3vzfIGuqzI37HCxb9TnHvvek564MujBKUJ5CP5ioLl pY8V28dd2xd8y9x/ufTBxGAtDrauNs+VbEcVjBcO7eBdHVTeRL9F6e7B47/TCTtsO00q G0wzQ4LRC2RfP4aD5iV1ooIqoZozchuimFR+rNA56KNjG5LabkgDpg5PSqGg1noCTeOS AGFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=uzmAQFd90WrO6u9qXxpGoG4P4on63nekOAl9M0yMIJQ=; b=S8isASJvFTRRO5Vka0ZrvwzwqigPN+AEMckvaVNVtYbD2XGNeLw1F7eR0DJbBSKHE4 udXsBaDk5CmNFtiULTFpQ84sSHaDPOzjc/Q0d0GkaeLlCOiHM0AiVPnZ+u8FunC3cPzh dLfKqAAAKC8PkoqEmPvvvPzF/JBXusr8B6DgYl8UG95R94SW5qpQ4Z1l0o3ZlG6ML8nL RjETIFMXLrTK8zk9pLHXAHYsgILFbHfykt8A5QlvI2uDGRNNolDoXE74VVgmpFb63i/K Q8op45HxkQVc2PbCPOrvmjTAoqnoWGCKYImU7M3a7zHdmz19c9XSdOMx8kCi/tK9N7Ov fbkQ== X-Gm-Message-State: AOPr4FUhOPN7ycreUhUt/9qNxhrdeKcRJ+IAV3vcFvT7H2x5LrC/uNYePDFiNRLpOVlq3v2ElSAOIAL9AlOQVA== X-Received: by 10.66.227.229 with SMTP id sd5mr43833692pac.115.1460905017154; Sun, 17 Apr 2016 07:56:57 -0700 (PDT) X-Originating-IP: [37.188.236.218] X-Mailman-Approved-At: Sun, 17 Apr 2016 12:40:58 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com comp.lang.python:107180 Hello, some people recommend following implementation of a simple HTTP server that supports SSL: Handler = http.server.BaseHTTPRequestHandlerhttpd = http.server.HTTPServer(("", 4443), Handler) httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True) httpd.serve_forever() I wonder whether this usage is *supported* or not. The documentation is not explicit about whether the httpd.socket attribute can be safely reassigned. Also there were some questions regarding a simple HTTPS server on this list already and none of the answerers mentioned this approach. Also there used to be a HTTPSServer in the test suite of Python 2.7 in 2014 that did a similar thing but in the "get_request" method but it isn't there anymore. So, is there a *supported* way of combining http.server.HTTPServer and ssl? Best regards -- Radek