diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2016-01-04 15:55:30 +0200 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2016-01-04 15:55:30 +0200 |
commit | 4bca54c0bb50b50fc570061b75812fd44a6d3fc3 (patch) | |
tree | 2b56dbe93db6101307dbb9d7bebe269331b9cafc /bytesconv.go | |
parent | Added WriteGzip and WriteGunzip helper functions (diff) | |
download | fasthttp-4bca54c0bb50b50fc570061b75812fd44a6d3fc3.tar.gz fasthttp-4bca54c0bb50b50fc570061b75812fd44a6d3fc3.tar.bz2 fasthttp-4bca54c0bb50b50fc570061b75812fd44a6d3fc3.zip |
Issue #29: use time.UTC instead of time.LoadLocation, since this call may fail on systems without certain config files
Diffstat (limited to 'bytesconv.go')
-rw-r--r-- | bytesconv.go | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/bytesconv.go b/bytesconv.go index 216e0ea..3db9cdb 100644 --- a/bytesconv.go +++ b/bytesconv.go @@ -12,14 +12,6 @@ import ( "unsafe" ) -var gmtLocation = func() *time.Location { - x, err := time.LoadLocation("GMT") - if err != nil { - panic(fmt.Sprintf("cannot load GMT location: %s", err)) - } - return x -}() - // AppendIPv4 appends string representation of the given ip v4 to dst // and returns the extended dst. func AppendIPv4(dst []byte, ip net.IP) []byte { @@ -78,7 +70,9 @@ func ParseIPv4(dst net.IP, ipStr []byte) (net.IP, error) { // AppendHTTPDate appends HTTP-compliant (RFC1123) representation of date // to dst and returns the extended dst. func AppendHTTPDate(dst []byte, date time.Time) []byte { - return date.In(gmtLocation).AppendFormat(dst, time.RFC1123) + dst = date.In(time.UTC).AppendFormat(dst, time.RFC1123) + copy(dst[len(dst)-3:], strGMT) + return dst } // ParseHTTPDate parses HTTP-compliant (RFC1123) date. |