From 0d4c71d0f6ffda15df05480575d8f4c5750ce9b6 Mon Sep 17 00:00:00 2001 From: Toby Chui Date: Tue, 31 Dec 2024 22:56:51 +0800 Subject: [PATCH] Fixed #450 --- src/def.go | 2 +- src/mod/dynamicproxy/dynamicproxy.go | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/def.go b/src/def.go index 0ebeb5a..91a491b 100644 --- a/src/def.go +++ b/src/def.go @@ -42,7 +42,7 @@ import ( const ( /* Build Constants */ SYSTEM_NAME = "Zoraxy" - SYSTEM_VERSION = "3.1.6" + SYSTEM_VERSION = "3.1.7" DEVELOPMENT_BUILD = false /* Development: Set to false to use embedded web fs */ /* System Constants */ diff --git a/src/mod/dynamicproxy/dynamicproxy.go b/src/mod/dynamicproxy/dynamicproxy.go index 773910d..8e45be4 100644 --- a/src/mod/dynamicproxy/dynamicproxy.go +++ b/src/mod/dynamicproxy/dynamicproxy.go @@ -191,7 +191,24 @@ func (router *Router) StartProxyService() error { w.Write([]byte("400 - Bad Request")) } else { //No defined sub-domain - http.NotFound(w, r) + if router.Root.DefaultSiteOption == DefaultSite_NoResponse { + //No response. Just close the connection + hijacker, ok := w.(http.Hijacker) + if !ok { + w.Header().Set("Connection", "close") + return + } + conn, _, err := hijacker.Hijack() + if err != nil { + w.Header().Set("Connection", "close") + return + } + conn.Close() + } else { + //Default behavior + http.NotFound(w, r) + } + } }