mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-06-06 07:37:21 +02:00
Fixed #235
- Added flush sniffing for keep-alive request - Set default flush interval to 100ms for hostname and 500ms for virtual directory
This commit is contained in:
parent
aca6e44b35
commit
e410b92e34
@ -3,6 +3,7 @@ package dpcore
|
|||||||
import (
|
import (
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -17,6 +18,12 @@ func (p *ReverseProxy) getFlushInterval(req *http.Request, res *http.Response) t
|
|||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fixed issue #235: Added auto detection for ollama / llm output stream
|
||||||
|
connectionHeader := req.Header["Connection"]
|
||||||
|
if len(connectionHeader) > 0 && strings.Contains(strings.Join(connectionHeader, ","), "keep-alive") {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
//Cannot sniff anything. Use default value
|
//Cannot sniff anything. Use default value
|
||||||
return p.FlushInterval
|
return p.FlushInterval
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"imuslab.com/zoraxy/mod/dynamicproxy/dpcore"
|
"imuslab.com/zoraxy/mod/dynamicproxy/dpcore"
|
||||||
)
|
)
|
||||||
@ -39,6 +40,7 @@ func (u *Upstream) StartProxy() error {
|
|||||||
|
|
||||||
proxy := dpcore.NewDynamicProxyCore(path, "", &dpcore.DpcoreOptions{
|
proxy := dpcore.NewDynamicProxyCore(path, "", &dpcore.DpcoreOptions{
|
||||||
IgnoreTLSVerification: u.SkipCertValidations,
|
IgnoreTLSVerification: u.SkipCertValidations,
|
||||||
|
FlushInterval: 100 * time.Millisecond,
|
||||||
})
|
})
|
||||||
|
|
||||||
u.proxy = proxy
|
u.proxy = proxy
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"imuslab.com/zoraxy/mod/dynamicproxy/dpcore"
|
"imuslab.com/zoraxy/mod/dynamicproxy/dpcore"
|
||||||
)
|
)
|
||||||
@ -58,6 +59,7 @@ func (router *Router) PrepareProxyRoute(endpoint *ProxyEndpoint) (*ProxyEndpoint
|
|||||||
|
|
||||||
proxy := dpcore.NewDynamicProxyCore(path, vdir.MatchingPath, &dpcore.DpcoreOptions{
|
proxy := dpcore.NewDynamicProxyCore(path, vdir.MatchingPath, &dpcore.DpcoreOptions{
|
||||||
IgnoreTLSVerification: vdir.SkipCertValidations,
|
IgnoreTLSVerification: vdir.SkipCertValidations,
|
||||||
|
FlushInterval: 500 * time.Millisecond,
|
||||||
})
|
})
|
||||||
vdir.proxy = proxy
|
vdir.proxy = proxy
|
||||||
vdir.parent = endpoint
|
vdir.parent = endpoint
|
||||||
|
@ -234,7 +234,6 @@
|
|||||||
var payload = $(row).attr("payload");
|
var payload = $(row).attr("payload");
|
||||||
payload = JSON.parse(decodeURIComponent(payload));
|
payload = JSON.parse(decodeURIComponent(payload));
|
||||||
console.log(payload);
|
console.log(payload);
|
||||||
//console.log(payload);
|
|
||||||
columns.each(function(index) {
|
columns.each(function(index) {
|
||||||
var column = $(this);
|
var column = $(this);
|
||||||
var oldValue = column.text().trim();
|
var oldValue = column.text().trim();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user