From 25ac2c0b19adf571e9a301fc6bbbe442102246f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yingyi=20/=20=E9=A2=96=E9=80=B8?= <49649786+Zuoqiu-Yingyi@users.noreply.github.com> Date: Tue, 23 Apr 2024 17:06:39 +0800 Subject: [PATCH] :art: Support for H2C (HTTP/2 over cleartext) (#11116) --- kernel/server/serve.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/server/serve.go b/kernel/server/serve.go index acb9e8561fd..77d7e98b38b 100644 --- a/kernel/server/serve.go +++ b/kernel/server/serve.go @@ -50,6 +50,7 @@ var cookieStore = cookie.NewStore([]byte("ATN51UlxVq1Gcvdf")) func Serve(fastMode bool) { gin.SetMode(gin.ReleaseMode) ginServer := gin.New() + ginServer.UseH2C = true ginServer.MaxMultipartMemory = 1024 * 1024 * 32 // 插入较大的资源文件时内存占用较大 https://github.com/siyuan-note/siyuan/issues/5023 ginServer.Use( model.ControlConcurrency, // 请求串行化 Concurrency control when requesting the kernel API https://github.com/siyuan-note/siyuan/issues/9939 @@ -135,7 +136,7 @@ func Serve(fastMode bool) { go util.HookUILoaded() - if err = http.Serve(ln, ginServer); nil != err { + if err = http.Serve(ln, ginServer.Handler()); nil != err { if !fastMode { logging.LogErrorf("boot kernel failed: %s", err) os.Exit(logging.ExitCodeUnavailablePort)