From 0d9bc5cfde7e0fc8a4d1a76b03d9f78cfcfc876b Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 3 Nov 2015 17:48:44 +0200 Subject: [PATCH] Extracted predefined strings into a separate file --- header.go | 35 ----------------------------------- strings.go | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 35 deletions(-) create mode 100644 strings.go diff --git a/header.go b/header.go index 051c446..eb568f5 100644 --- a/header.go +++ b/header.go @@ -10,41 +10,6 @@ import ( "time" ) -var ( - defaultServerName = []byte("fasthttp server") - defaultContentType = []byte("text/plain; charset=utf-8") -) - -var ( - strSlash = []byte("/") - strSlashSlash = []byte("//") - strSlashDotDot = []byte("/..") - strSlashDotDotSlash = []byte("/../") - strCRLF = []byte("\r\n") - strHTTP = []byte("http") - strHTTP11 = []byte("HTTP/1.1") - strColonSlashSlash = []byte("://") - strColonSpace = []byte(": ") - - strGet = []byte("GET") - strHead = []byte("HEAD") - strPost = []byte("POST") - - strConnection = []byte("Connection") - strContentLength = []byte("Content-Length") - strContentType = []byte("Content-Type") - strDate = []byte("Date") - strHost = []byte("Host") - strReferer = []byte("Referer") - strServer = []byte("Server") - strTransferEncoding = []byte("Transfer-Encoding") - strUserAgent = []byte("User-Agent") - - strClose = []byte("close") - strChunked = []byte("chunked") - strPostArgsContentType = []byte("application/x-www-form-urlencoded") -) - // ResponseHeader represents HTTP response header. // // It is forbidden copying ResponseHeader instances. diff --git a/strings.go b/strings.go new file mode 100644 index 0000000..1f60ad2 --- /dev/null +++ b/strings.go @@ -0,0 +1,36 @@ +package fasthttp + +var ( + defaultServerName = []byte("fasthttp server") + defaultContentType = []byte("text/plain; charset=utf-8") +) + +var ( + strSlash = []byte("/") + strSlashSlash = []byte("//") + strSlashDotDot = []byte("/..") + strSlashDotDotSlash = []byte("/../") + strCRLF = []byte("\r\n") + strHTTP = []byte("http") + strHTTP11 = []byte("HTTP/1.1") + strColonSlashSlash = []byte("://") + strColonSpace = []byte(": ") + + strGet = []byte("GET") + strHead = []byte("HEAD") + strPost = []byte("POST") + + strConnection = []byte("Connection") + strContentLength = []byte("Content-Length") + strContentType = []byte("Content-Type") + strDate = []byte("Date") + strHost = []byte("Host") + strReferer = []byte("Referer") + strServer = []byte("Server") + strTransferEncoding = []byte("Transfer-Encoding") + strUserAgent = []byte("User-Agent") + + strClose = []byte("close") + strChunked = []byte("chunked") + strPostArgsContentType = []byte("application/x-www-form-urlencoded") +)