Rebrand the Rust client crate (coven/ → hh/, package+binary "hack-house"), README, CLI strings, and branch (coven → hack-house). Gitea repo renamed cmd-chat → hack-house to match. Crypto/server logic unchanged; selftest + golden-vector test still green, binary is now `hack-house`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
from ...exceptions import InitError
|
|
from ..base import Extension
|
|
from .cors import add_cors
|
|
from .methods import add_auto_handlers, add_http_methods
|
|
|
|
|
|
class HTTPExtension(Extension):
|
|
name = "http"
|
|
|
|
def startup(self, _) -> None:
|
|
self.all_methods: bool = self.config.HTTP_ALL_METHODS
|
|
self.auto_head: bool = self.config.HTTP_AUTO_HEAD
|
|
self.auto_options: bool = self.config.HTTP_AUTO_OPTIONS
|
|
self.auto_trace: bool = self.config.HTTP_AUTO_TRACE
|
|
self.cors: bool = self.config.CORS
|
|
|
|
if self.all_methods:
|
|
add_http_methods(self.app, ["CONNECT", "TRACE"])
|
|
|
|
if self.auto_head or self.auto_options or self.auto_trace:
|
|
add_auto_handlers(
|
|
self.app, self.auto_head, self.auto_options, self.auto_trace
|
|
)
|
|
|
|
if self.cors:
|
|
add_cors(self.app)
|
|
else:
|
|
return
|
|
|
|
if self.app.ctx.cors.automatic_options and not self.auto_options:
|
|
raise InitError(
|
|
"Configuration mismatch. If CORS_AUTOMATIC_OPTIONS is set to "
|
|
"True, then you must run SanicExt with auto_options=True"
|
|
)
|