3232except ImportError :
3333 static_root_key = None # type: ignore[assignment]
3434
35- LIVE_RELOAD_HOST_SNIPPET = '\n <script src="http ://{}:{}/livereload.js"></script>\n '
35+ LIVE_RELOAD_HOST_SNIPPET = '\n <script src="{} ://{}:{}/livereload.js"></script>\n '
3636LIVE_RELOAD_LOCAL_SNIPPET = b'\n <script src="/livereload.js"></script>\n '
3737
3838LAST_RELOAD = web .AppKey ("LAST_RELOAD" , List [float ])
@@ -84,7 +84,7 @@ async def on_prepare(request: web.Request, response: web.StreamResponse) -> None
8484 or request .path .startswith ("/_debugtoolbar" )
8585 or "text/html" not in response .content_type ):
8686 return
87- lr_snippet = LIVE_RELOAD_HOST_SNIPPET .format (get_host (request ), config .aux_port )
87+ lr_snippet = LIVE_RELOAD_HOST_SNIPPET .format (config . protocol , get_host (request ), config .aux_port )
8888 dft_logger .debug ("appending live reload snippet '%s' to body" , lr_snippet )
8989 response .body += lr_snippet .encode ()
9090 response .headers [CONTENT_LENGTH ] = str (len (response .body ))
@@ -105,7 +105,7 @@ async def no_cache_middleware(request: web.Request, handler: Handler) -> web.Str
105105 # we set the app key even in middleware to make the switch to production easier and for backwards compat.
106106 @web .middleware
107107 async def static_middleware (request : web .Request , handler : Handler ) -> web .StreamResponse :
108- static_url = 'http ://{}:{}/{}' .format (get_host (request ), config .aux_port , static_path )
108+ static_url = '{} ://{}:{}/{}' .format (config . protocol , get_host (request ), config .aux_port , static_path )
109109 dft_logger .debug ('setting app static_root_url to "%s"' , static_url )
110110 _change_static_url (request .app , static_url )
111111 return await handler (request )
@@ -126,7 +126,7 @@ def shutdown() -> NoReturn:
126126 config .protocol , config .host , config .main_port , path ))
127127
128128 if config .static_path is not None :
129- static_url = 'http ://{}:{}/{}' .format (config .host , config .aux_port , static_path )
129+ static_url = '{} ://{}:{}/{}' .format (config . protocol , config .host , config .aux_port , static_path )
130130 dft_logger .debug ('settings app static_root_url to "%s"' , static_url )
131131 _set_static_url (app , static_url )
132132
0 commit comments