github.com/cloudwego/hertz@v0.9.3/internal/bytestr/bytes.go (about)

     1  /*
     2   * Copyright 2022 CloudWeGo Authors
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  // Package bytestr defines some common bytes
    18  package bytestr
    19  
    20  import (
    21  	"github.com/cloudwego/hertz/pkg/protocol/consts"
    22  )
    23  
    24  var (
    25  	DefaultServerName  = []byte("hertz")
    26  	DefaultUserAgent   = []byte("hertz")
    27  	DefaultContentType = []byte("text/plain; charset=utf-8")
    28  )
    29  
    30  var (
    31  	StrBackSlash        = []byte("\\")
    32  	StrSlash            = []byte("/")
    33  	StrSlashSlash       = []byte("//")
    34  	StrSlashDotDot      = []byte("/..")
    35  	StrSlashDotSlash    = []byte("/./")
    36  	StrSlashDotDotSlash = []byte("/../")
    37  	StrCRLF             = []byte("\r\n")
    38  	StrHTTP             = []byte("http")
    39  	StrHTTPS            = []byte("https")
    40  	StrHTTP11           = []byte("HTTP/1.1")
    41  	StrColon            = []byte(":")
    42  	StrStar             = []byte("*")
    43  	StrColonSlashSlash  = []byte("://")
    44  	StrColonSpace       = []byte(": ")
    45  	StrCommaSpace       = []byte(", ")
    46  	StrAt               = []byte("@")
    47  	StrSD               = []byte("sd")
    48  
    49  	StrResponseContinue = []byte("HTTP/1.1 100 Continue\r\n\r\n")
    50  
    51  	StrGet     = []byte(consts.MethodGet)
    52  	StrHead    = []byte(consts.MethodHead)
    53  	StrPost    = []byte(consts.MethodPost)
    54  	StrPut     = []byte(consts.MethodPut)
    55  	StrDelete  = []byte(consts.MethodDelete)
    56  	StrConnect = []byte(consts.MethodConnect)
    57  	StrOptions = []byte(consts.MethodOptions)
    58  	StrTrace   = []byte(consts.MethodTrace)
    59  	StrPatch   = []byte(consts.MethodPatch)
    60  
    61  	StrExpect           = []byte(consts.HeaderExpect)
    62  	StrConnection       = []byte(consts.HeaderConnection)
    63  	StrContentLength    = []byte(consts.HeaderContentLength)
    64  	StrContentType      = []byte(consts.HeaderContentType)
    65  	StrDate             = []byte(consts.HeaderDate)
    66  	StrHost             = []byte(consts.HeaderHost)
    67  	StrServer           = []byte(consts.HeaderServer)
    68  	StrTransferEncoding = []byte(consts.HeaderTransferEncoding)
    69  
    70  	StrUserAgent          = []byte(consts.HeaderUserAgent)
    71  	StrCookie             = []byte(consts.HeaderCookie)
    72  	StrLocation           = []byte(consts.HeaderLocation)
    73  	StrContentRange       = []byte(consts.HeaderContentRange)
    74  	StrContentEncoding    = []byte(consts.HeaderContentEncoding)
    75  	StrAcceptEncoding     = []byte(consts.HeaderAcceptEncoding)
    76  	StrSetCookie          = []byte(consts.HeaderSetCookie)
    77  	StrAuthorization      = []byte(consts.HeaderAuthorization)
    78  	StrRange              = []byte(consts.HeaderRange)
    79  	StrLastModified       = []byte(consts.HeaderLastModified)
    80  	StrAcceptRanges       = []byte(consts.HeaderAcceptRanges)
    81  	StrIfModifiedSince    = []byte(consts.HeaderIfModifiedSince)
    82  	StrTE                 = []byte(consts.HeaderTE)
    83  	StrTrailer            = []byte(consts.HeaderTrailer)
    84  	StrMaxForwards        = []byte(consts.HeaderMaxForwards)
    85  	StrProxyConnection    = []byte(consts.HeaderProxyConnection)
    86  	StrProxyAuthenticate  = []byte(consts.HeaderProxyAuthenticate)
    87  	StrProxyAuthorization = []byte(consts.HeaderProxyAuthorization)
    88  	StrWWWAuthenticate    = []byte(consts.HeaderWWWAuthenticate)
    89  
    90  	StrCookieExpires        = []byte("expires")
    91  	StrCookieDomain         = []byte("domain")
    92  	StrCookiePath           = []byte("path")
    93  	StrCookieHTTPOnly       = []byte("HttpOnly")
    94  	StrCookieSecure         = []byte("secure")
    95  	StrCookieMaxAge         = []byte("max-age")
    96  	StrCookieSameSite       = []byte("SameSite")
    97  	StrCookieSameSiteLax    = []byte("Lax")
    98  	StrCookieSameSiteStrict = []byte("Strict")
    99  	StrCookieSameSiteNone   = []byte("None")
   100  	StrCookiePartitioned    = []byte("Partitioned")
   101  
   102  	StrClose               = []byte("close")
   103  	StrGzip                = []byte("gzip")
   104  	StrDeflate             = []byte("deflate")
   105  	StrKeepAlive           = []byte("keep-alive")
   106  	StrUpgrade             = []byte("Upgrade")
   107  	StrChunked             = []byte("chunked")
   108  	StrIdentity            = []byte("identity")
   109  	Str100Continue         = []byte("100-continue")
   110  	StrPostArgsContentType = []byte("application/x-www-form-urlencoded")
   111  	StrMultipartFormData   = []byte("multipart/form-data")
   112  	StrBoundary            = []byte("boundary")
   113  	StrBytes               = []byte("bytes")
   114  	StrTextSlash           = []byte("text/")
   115  	StrApplicationSlash    = []byte("application/")
   116  	StrBasicSpace          = []byte("Basic ")
   117  
   118  	// http2
   119  	StrClientPreface = []byte(consts.ClientPreface)
   120  )