pkg.go.dev Open in urlscan Pro
34.149.140.181  Public Scan

Submitted URL: http://golang.org/x/net/http/httpguts
Effective URL: https://pkg.go.dev/golang.org/x/net/http/httpguts
Submission: On March 09 via api from US — Scanned from DE

Form analysis 3 forms found in the DOM

/search

<form class="go-InputGroup go-ShortcutKey go-SearchForm-form" action="/search" data-shortcut="/" data-shortcut-alt="search" data-gtmc="search form" aria-label="Search for a package" role="search">
  <input name="q" class="go-Input js-searchFocus" aria-label="Search for a package" type="search" autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false" placeholder="Search packages or symbols" value="">
  <input name="m" value="" hidden="">
  <button class="go-Button go-Button--inverted" aria-label="Submit search">
    <img class="go-Icon" height="24" width="24" src="/static/shared/icon/search_gm_grey_24dp.svg" alt="">
  </button>
</form>

DIALOG

<form method="dialog" data-gmtc="jump to form" aria-label="Jump to Identifier">
  <div class="Dialog-title go-Modal-header">
    <h2>Jump to</h2>
    <button class="go-Button go-Button--inline" type="button" data-modal-close="" data-gtmc="modal button" aria-label="Close">
      <img class="go-Icon" height="24" width="24" src="/static/shared/icon/close_gm_grey_24dp.svg" alt="">
    </button>
  </div>
  <div class="JumpDialog-filter">
    <input class="JumpDialog-input go-Input" autocomplete="off" type="text">
  </div>
  <div class="JumpDialog-body go-Modal-body">
    <div class="JumpDialog-list"></div>
  </div>
  <div class="go-Modal-actions">
    <button class="go-Button" data-test-id="close-dialog">Close</button>
  </div>
</form>

DIALOG

<form method="dialog">
  <div class="go-Modal-header">
    <h2>Keyboard shortcuts</h2>
    <button class="go-Button go-Button--inline" type="button" data-modal-close="" data-gtmc="modal button" aria-label="Close">
      <img class="go-Icon" height="24" width="24" src="/static/shared/icon/close_gm_grey_24dp.svg" alt="">
    </button>
  </div>
  <div class="go-Modal-body">
    <table>
      <tbody>
        <tr>
          <td class="ShortcutsDialog-key">
            <strong>?</strong>
          </td>
          <td> : This menu</td>
        </tr>
        <tr>
          <td class="ShortcutsDialog-key">
            <strong>/</strong>
          </td>
          <td> : Search site</td>
        </tr>
        <tr>
          <td class="ShortcutsDialog-key">
            <strong>f</strong> or <strong>F</strong>
          </td>
          <td> : Jump to</td>
        </tr>
        <tr>
          <td class="ShortcutsDialog-key"><strong>y</strong> or <strong>Y</strong></td>
          <td> : Canonical URL</td>
        </tr>
      </tbody>
    </table>
  </div>
  <div class="go-Modal-actions">
    <button class="go-Button" data-test-id="close-dialog">Close</button>
  </div>
</form>

Text Content

 * Why Go
   * Case Studies
     
     Common problems companies solve with Go
   
   * Use Cases
     
     Stories about how and why companies use Go
   
   * Security Policy
     
     How Go can help keep you secure by default
 * Learn
 * Docs
   * Effective Go
     
     Tips for writing clear, performant, and idiomatic Go code
   
   * Go User Manual
     
     A complete introduction to building software with Go
   
   * Standard library
     
     Reference documentation for Go's standard library
   
   * Release Notes
     
     Learn what's new in each Go release
 * Packages
 * Community
   * Recorded Talks
     
     Videos from prior events
   
   * Meetups
     
     Meet other local Go developers
   
   * Conferences
     
     Learn and network with Go developers from around the world
   
   * Go blog
     
     The Go project's official blog.
   
   * Go project
     
     Get help and stay informed from Go
   
   * Get connected
     
     
     
     

 * Why Go
   Why Go
    * Case Studies
    * Use Cases
    * Security Policy

 * Learn
 * Docs
   Docs
    * Effective Go
    * Go User Manual
    * Standard library
    * Release Notes

 * Packages
 * Community
   Community
    * Recorded Talks
    * Meetups
    * Conferences
    * Go blog
    * Go project
    * Get connected
      


 1. Discover Packages
 2. golang.org/x/net
 3. http
 4. httpguts


HTTPGUTS

package
Version: v0.8.0 Latest Latest

This package is not in the latest version of its module.

Go to latest Published: Mar 5, 2023 License: BSD-3-Clause Imports: 5 Imported
by: 1,020
Main Versions Licenses Imports Imported By


DETAILS

 * Valid go.mod file
   
   The Go module system was introduced in Go 1.11 and is the official dependency
   management solution for Go.

 * Redistributable license
   
   Redistributable licenses place minimal restrictions on how software can be
   used, modified, and redistributed.

 * Tagged version
   
   Modules with tagged versions give importers more predictable builds.

 * Stable version
   
   When a project reaches major version v1 it is considered stable.

 * Learn more


REPOSITORY

cs.opensource.google/go/x/net


LINKS

 * Report a Vulnerability
 * Open Source Insights

Jump to ...
 * Documentation
   * Overview
   * Index
   * Constants
   * Variables
   * Functions
     * HeaderValuesContainsToken(values, token)
     * IsTokenRune(r)
     * PunycodeHostPort(v)
     * ValidHeaderFieldName(v)
     * ValidHeaderFieldValue(v)
     * ValidHostHeader(h)
     * ValidTrailerHeader(name)
   * Types
 * Source Files

DocumentationSource
FilesOverviewIndexConstantsVariablesFunctionsTypesHeaderValuesContainsToken(values,
token)IsTokenRune(r)PunycodeHostPort(v)ValidHeaderFieldName(v)ValidHeaderFieldValue(v)ValidHostHeader(h)ValidTrailerHeader(name)


DOCUMENTATION ¶


OVERVIEW ¶

Package httpguts provides functions implementing various details of the HTTP
specification.

This package is shared by the standard library (which vendors it) and
x/net/http2. It comes with no API stability promise.


INDEX ¶

 * func HeaderValuesContainsToken(values []string, token string) bool
 * func IsTokenRune(r rune) bool
 * func PunycodeHostPort(v string) (string, error)
 * func ValidHeaderFieldName(v string) bool
 * func ValidHeaderFieldValue(v string) bool
 * func ValidHostHeader(h string) bool
 * func ValidTrailerHeader(name string) bool


CONSTANTS ¶

This section is empty.


VARIABLES ¶

This section is empty.


FUNCTIONS ¶

FUNC HEADERVALUESCONTAINSTOKEN ¶

func HeaderValuesContainsToken(values []string, token string) bool

HeaderValuesContainsToken reports whether any string in values contains the
provided token, ASCII case-insensitively.

FUNC ISTOKENRUNE ¶

func IsTokenRune(r rune) bool

FUNC PUNYCODEHOSTPORT ¶

func PunycodeHostPort(v string) (string, error)

PunycodeHostPort returns the IDNA Punycode version of the provided "host" or
"host:port" string.

FUNC VALIDHEADERFIELDNAME ¶

func ValidHeaderFieldName(v string) bool

ValidHeaderFieldName reports whether v is a valid HTTP/1.x header name. HTTP/2
imposes the additional restriction that uppercase ASCII letters are not allowed.

RFC 7230 says:

header-field   = field-name ":" OWS field-value OWS
field-name     = token
token          = 1*tchar
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
        "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA


FUNC VALIDHEADERFIELDVALUE ¶

func ValidHeaderFieldValue(v string) bool

ValidHeaderFieldValue reports whether v is a valid "field-value" according to
http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 :

message-header = field-name ":" [ field-value ]
field-value    = *( field-content | LWS )
field-content  = <the OCTETs making up the field-value
                 and consisting of either *TEXT or combinations
                 of token, separators, and quoted-string>


http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2 :

TEXT           = <any OCTET except CTLs,
                  but including LWS>
LWS            = [CRLF] 1*( SP | HT )
CTL            = <any US-ASCII control character
                 (octets 0 - 31) and DEL (127)>


RFC 7230 says:

field-value    = *( field-content / obs-fold )
obj-fold       =  N/A to http2, and deprecated
field-content  = field-vchar [ 1*( SP / HTAB ) field-vchar ]
field-vchar    = VCHAR / obs-text
obs-text       = %x80-FF
VCHAR          = "any visible [USASCII] character"


http2 further says: "Similarly, HTTP/2 allows header field values that are not
valid. While most of the values that can be encoded will not alter header field
parsing, carriage return (CR, ASCII 0xd), line feed (LF, ASCII 0xa), and the
zero character (NUL, ASCII 0x0) might be exploited by an attacker if they are
translated verbatim. Any request or response that contains a character not
permitted in a header field value MUST be treated as malformed (Section
8.1.2.6). Valid characters are defined by the field-content ABNF rule in Section
3.2 of [RFC7230]."

This function does not (yet?) properly handle the rejection of strings that
begin or end with SP or HTAB.

FUNC VALIDHOSTHEADER ¶

func ValidHostHeader(h string) bool

ValidHostHeader reports whether h is a valid host header.

FUNC VALIDTRAILERHEADER ¶

func ValidTrailerHeader(name string) bool

ValidTrailerHeader reports whether name is a valid header field name to appear
in trailers. See RFC 7230, Section 4.1.2


TYPES ¶

This section is empty.


SOURCE FILES ¶

View all
 * guts.go
 * httplex.go


Why Go Use Cases Case Studies
Get Started Playground Tour Stack Overflow Help
Packages Standard Library About Go Packages
About Download Blog Issue Tracker Release Notes Brand Guidelines Code of Conduct
Connect Twitter GitHub Slack r/golang Meetup Golang Weekly
 * Copyright
 * Terms of Service
 * Privacy Policy
 * Report an Issue
 * 


JUMP TO



Close


KEYBOARD SHORTCUTS

? : This menu / : Search site f or F : Jump to y or Y : Canonical URL

Close