mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
update http header
This commit is contained in:
parent
805bbe5fe4
commit
66e8090d3a
@ -56,6 +56,10 @@ func (this *HTTPAuthenticatorRequest) Build() (*http.RequestConfig, error) {
|
||||
"Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "Accept-Encoding",
|
||||
Value: []string{"gzip, deflate"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"v2ray.com/core/common/dice"
|
||||
)
|
||||
|
||||
@ -62,6 +63,16 @@ func (this *RequestConfig) GetFullVersion() string {
|
||||
return "HTTP/" + this.Version.GetValue()
|
||||
}
|
||||
|
||||
func (this *ResponseConfig) HasHeader(header string) bool {
|
||||
cHeader := strings.ToLower(header)
|
||||
for _, tHeader := range this.Header {
|
||||
if strings.ToLower(tHeader.Name) == cHeader {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (this *ResponseConfig) PickHeaders() []string {
|
||||
n := len(this.Header)
|
||||
if n == 0 {
|
||||
|
@ -4,6 +4,8 @@ import (
|
||||
"bytes"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/common/alloc"
|
||||
"v2ray.com/core/common/loader"
|
||||
@ -159,6 +161,9 @@ func (this HttpAuthenticator) GetServerWriter() *HeaderWriter {
|
||||
for _, h := range headers {
|
||||
header.AppendString(h).AppendString(CRLF)
|
||||
}
|
||||
if !config.HasHeader("Date") {
|
||||
header.AppendString("Date: ").AppendString(time.Now().Format(http.TimeFormat)).AppendString(CRLF)
|
||||
}
|
||||
header.AppendString(CRLF)
|
||||
return &HeaderWriter{
|
||||
header: header,
|
||||
|
Loading…
Reference in New Issue
Block a user