http
Types from the Go package http (a library PocketBase builds on), as JavaScript sees them: they turn up as values of PocketBase's types and of hook events.
http.Cookie
A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an HTTP response or the Cookie header of an HTTP request.
See https://tools.ietf.org/html/rfc6265 for details.
| Member | Type | |
|---|---|---|
name |
string |
|
value |
string |
|
quoted |
boolean // indicates whether the Value was originally quoted |
|
path |
string // optional |
|
domain |
string // optional |
|
expires |
time.Time // optional |
|
rawExpires |
string // for reading cookies only |
|
maxAge |
number |
MaxAge=0 means no 'Max-Age' attribute specified. MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0' MaxAge>0 means Max-Age attribute present and given in seconds |
secure |
boolean |
|
httpOnly |
boolean |
|
sameSite |
SameSite |
|
partitioned |
boolean |
|
raw |
string |
|
unparsed |
Array<string> // Raw text of unparsed attribute-value pairs |
|
string() |
(): string |
String returns the serialization of the cookie for use in a Cookie header (if only Name and Value are set) or a Set-Cookie response header (if other fields are set). If c is nil or c.Name is invalid, the empty string is returned. |
valid() |
(): void |
Valid reports whether the cookie is valid. |
http.Header
A Header represents the key-value pairs in an HTTP header.
The keys should be in canonical form, as returned by
CanonicalHeaderKey.
Has everything { [key: string]: any } has.
| Member | Type | |
|---|---|---|
add() |
(key: string, value: string): void |
Add adds the key, value pair to the header. It appends to any existing values associated with key. The key is case insensitive; it is canonicalized by CanonicalHeaderKey. |
set() |
(key: string, value: string): void |
Set sets the header entries associated with key to the single element value. It replaces any existing values associated with key. The key is case insensitive; it is canonicalized by textproto.canonicalMIMEHeaderKey. To use non-canonical keys, assign to the map directly. |
get() |
(key: string): string |
Get gets the first value associated with the given key. If there are no values associated with the key, Get returns "". It is case insensitive; textproto.canonicalMIMEHeaderKey is used to canonicalize the provided key. Get assumes that all keys are stored in canonical form. To use non-canonical keys, access the map directly. |
values() |
(key: string): Array<string> |
Values returns all values associated with the given key. It is case insensitive; textproto.canonicalMIMEHeaderKey is used to canonicalize the provided key. To use non-canonical keys, access the map directly. The returned slice is not a copy. |
del() |
(key: string): void |
Del deletes the values associated with key. The key is case insensitive; it is canonicalized by CanonicalHeaderKey. |
write() |
(w: io.Writer): void |
Write writes a header in wire format. |
clone() |
(): Header |
Clone returns a copy of h or nil if h is nil. |
writeSubset() |
(w: io.Writer, exclude: { [key: string]: any }): void |
WriteSubset writes a header in wire format. If exclude is not nil, keys where exclude[key] == true are not written. Keys are not canonicalized before checking the exclude map. |
http.Protocols
Protocols is a set of HTTP protocols. The zero value is an empty set of protocols.
The supported protocols are:
- HTTP1 is the HTTP/1.0 and HTTP/1.1 protocols.
HTTP1 is supported on both unsecured TCP and secured TLS connections.
- HTTP2 is the HTTP/2 protocol over a TLS connection.
- UnencryptedHTTP2 is the HTTP/2 protocol over an unsecured TCP connection.
| Member | Type | |
|---|---|---|
http1() |
(): boolean |
HTTP1 reports whether p includes HTTP/1. |
setHTTP1() |
(ok: boolean): void |
SetHTTP1 adds or removes HTTP/1 from p. |
http2() |
(): boolean |
HTTP2 reports whether p includes HTTP/2. |
setHTTP2() |
(ok: boolean): void |
SetHTTP2 adds or removes HTTP/2 from p. |
unencryptedHTTP2() |
(): boolean |
UnencryptedHTTP2 reports whether p includes unencrypted HTTP/2. |
setUnencryptedHTTP2() |
(ok: boolean): void |
SetUnencryptedHTTP2 adds or removes unencrypted HTTP/2 from p. |
string() |
(): string |
http.HTTP2Config
HTTP2Config defines HTTP/2 configuration parameters common to
both Transport and Server.
| Member | Type | |
|---|---|---|
maxConcurrentStreams |
number |
MaxConcurrentStreams optionally specifies the number of concurrent streams that a client may have open at a time. If zero, MaxConcurrentStreams defaults to at least 100. |
strictMaxConcurrentRequests |
boolean |
StrictMaxConcurrentRequests controls whether an HTTP/2 server's concurrency limit should be respected across all connections to that server. If true, new requests sent when a connection's concurrency limit has been exceeded will block until an existing request completes. If false, an additional connection will be opened if all existing connections are at their limit. |
maxDecoderHeaderTableSize |
number |
MaxDecoderHeaderTableSize optionally specifies an upper limit for the size of the header compression table used for decoding headers sent by the peer. A valid value is less than 4MiB. If zero or invalid, a default value is used. |
maxEncoderHeaderTableSize |
number |
MaxEncoderHeaderTableSize optionally specifies an upper limit for the header compression table used for sending headers to the peer. A valid value is less than 4MiB. If zero or invalid, a default value is used. |
maxReadFrameSize |
number |
MaxReadFrameSize optionally specifies the largest frame this endpoint is willing to read. A valid value is between 16KiB and 16MiB, inclusive. If zero or invalid, a default value is used. |
maxReceiveBufferPerConnection |
number |
MaxReceiveBufferPerConnection is the maximum size of the flow control window for data received on a connection. A valid value is at least 64KiB and less than 4MiB. If invalid, a default value is used. |
maxReceiveBufferPerStream |
number |
MaxReceiveBufferPerStream is the maximum size of the flow control window for data received on a stream (request). A valid value is less than 4MiB. If zero or invalid, a default value is used. |
sendPingTimeout |
time.Duration |
SendPingTimeout is the timeout after which a health check using a ping frame will be carried out if no frame is received on a connection. If zero, no health check is performed. |
pingTimeout |
time.Duration |
PingTimeout is the timeout after which a connection will be closed if a response to a ping is not received. If zero, a default of 15 seconds is used. |
writeByteTimeout |
time.Duration |
WriteByteTimeout is the timeout after which a connection will be closed if no data can be written to it. The timeout begins when data is available to write, and is extended whenever any bytes are written. |
permitProhibitedCipherSuites |
boolean |
PermitProhibitedCipherSuites, if true, permits the use of cipher suites prohibited by the HTTP/2 spec. |
countError |
(errType: string) => void |
CountError, if non-nil, is called on HTTP/2 errors. It is intended to increment a metric for monitoring. The errType contains only lowercase letters, digits, and underscores (a-z, 0-9, _). |
http.Response
Response represents the response from an HTTP request.
The Client and Transport return Responses from servers once
the response headers have been received. The response body
is streamed on demand as the Body field is read.
| Member | Type | |
|---|---|---|
status |
string // e.g. "200 OK" |
|
statusCode |
number // e.g. 200 |
|
proto |
string // e.g. "HTTP/1.0" |
|
protoMajor |
number // e.g. 1 |
|
protoMinor |
number // e.g. 0 |
|
header |
Header |
Header maps header keys to values. If the response had multiple headers with the same key, they may be concatenated, with comma delimiters. (RFC 7230, section 3.2.2 requires that multiple headers be semantically equivalent to a comma-delimited sequence.) When Header values are duplicated by other fields in this struct (e.g., ContentLength, TransferEncoding, Trailer), the field values are authoritative. |
body |
io.ReadCloser |
Body represents the response body. |
contentLength |
number |
ContentLength records the length of the associated content. The value -1 indicates that the length is unknown. Unless Request.Method is "HEAD", values >= 0 indicate that the given number of bytes may be read from Body. |
transferEncoding |
Array<string> |
Contains transfer encodings from outer-most to inner-most. Value is nil, means that "identity" encoding is used. |
close |
boolean |
Close records whether the header directed that the connection be closed after reading Body. The value is advice for clients: neither ReadResponse nor Response.Write ever closes a connection. |
uncompressed |
boolean |
Uncompressed reports whether the response was sent compressed but was decompressed by the http package. When true, reading from Body yields the uncompressed content instead of the compressed content actually set from the server, ContentLength is set to -1, and the "Content-Length" and "Content-Encoding" fields are deleted from the responseHeader. To get the original response from the server, set Transport.DisableCompression to true. |
trailer |
Header |
Trailer maps trailer keys to values in the same format as Header. |
request? |
Request |
Request is the request that was sent to obtain this Response. Request's Body is nil (having already been consumed). This is only populated for Client requests. |
tls? |
any |
TLS contains information about the TLS connection on which the response was received. It is nil for unencrypted responses. The pointer is shared between responses and should not be modified. |
cookies() |
(): Array<(Cookie | undefined)> |
Cookies parses and returns the cookies set in the Set-Cookie headers. |
location() |
(): (url.URL) |
Location returns the URL of the response's "Location" header, if present. Relative redirects are resolved relative to Response.request. ErrNoLocation is returned if no Location header is present. |
protoAtLeast() |
(major: number, minor: number): boolean |
ProtoAtLeast reports whether the HTTP protocol used in the response is at least major.minor. |
write() |
(w: io.Writer): void |
Write writes r to w in the HTTP/1.x server response format, including the status line, headers, body, and optional trailer. |
http.ConnState
A ConnState represents the state of a client connection to a server.
It's used by the optional Server.connState hook.
Has everything Number has.
| Member | Type | |
|---|---|---|
string() |
(): string |
http.PushOptions
PushOptions describes options for Pusher.push.
| Member | Type | |
|---|---|---|
method |
string |
Method specifies the HTTP method for the promised request. If set, it must be "GET" or "HEAD". Empty means "GET". |
header |
Header |
Header specifies additional promised request headers. This cannot include HTTP/2 pseudo header fields like ":path" and ":scheme", which will be added automatically. |
http.Request
A Request represents an HTTP request received by a server or to be sent by a client.
The field semantics differ slightly between client and server
usage. In addition to the notes on the fields below, see the
documentation for Request.write and RoundTripper.
| Member | Type | |
|---|---|---|
method |
string |
Method specifies the HTTP method (GET, POST, PUT, etc.). For client requests, an empty string means GET. |
url? |
url.URL |
URL specifies either the URI being requested (for server requests) or the URL to access (for client requests). |
proto |
string // "HTTP/1.0" |
The protocol version for incoming server requests. |
protoMajor |
number // 1 |
|
protoMinor |
number // 0 |
|
header |
Header |
Header contains the request header fields either received by the server or to be sent by the client. |
body |
io.ReadCloser |
Body is the request's body. |
getBody |
() => io.ReadCloser |
GetBody defines an optional func to return a new copy of Body. It is used for client requests when a redirect requires reading the body more than once. Use of GetBody still requires setting Body. |
contentLength |
number |
ContentLength records the length of the associated content. The value -1 indicates that the length is unknown. Values >= 0 indicate that the given number of bytes may be read from Body. |
transferEncoding |
Array<string> |
TransferEncoding lists the transfer encodings from outermost to innermost. An empty list denotes the "identity" encoding. TransferEncoding can usually be ignored; chunked encoding is automatically added and removed as necessary when sending and receiving requests. |
close |
boolean |
Close indicates whether to close the connection after replying to this request (for servers) or after sending this request and reading its response (for clients). |
host |
string |
For server requests, Host specifies the host on which the URL is sought. For HTTP/1 (per RFC 7230, section 5.4), this is either the value of the "Host" header or the host name given in the URL itself. For HTTP/2, it is the value of the ":authority" pseudo-header field. It may be of the form "host:port". For international domain names, Host may be in Punycode or Unicode form. Use golang.org/x/net/idna to convert it to either format if needed. To prevent DNS rebinding attacks, server Handlers should validate that the Host header has a value for which the Handler considers itself authoritative. The included ServeMux supports patterns registered to particular host names and thus protects its registered Handlers. |
form |
url.Values |
Form contains the parsed form data, including both the URL field's query parameters and the PATCH, POST, or PUT form data. This field is only available after ParseForm is called. The HTTP client ignores Form and uses Body instead. |
postForm |
url.Values |
PostForm contains the parsed form data from PATCH, POST or PUT body parameters. |
multipartForm? |
multipart.Form |
MultipartForm is the parsed multipart form, including file uploads. This field is only available after ParseMultipartForm is called. The HTTP client ignores MultipartForm and uses Body instead. |
trailer |
Header |
Trailer specifies additional headers that are sent after the request body. |
remoteAddr |
string |
RemoteAddr allows HTTP servers and other software to record the network address that sent the request, usually for logging. This field is not filled in by ReadRequest and has no defined format. The HTTP server in this package sets RemoteAddr to an "IP:port" address before invoking a handler. This field is ignored by the HTTP client. |
requestURI |
string |
RequestURI is the unmodified request-target of the Request-Line (RFC 7230, Section 3.1.1) as sent by the client to a server. Usually the URL field should be used instead. It is an error to set this field in an HTTP client request. |
tls? |
any |
TLS allows HTTP servers and other software to record information about the TLS connection on which the request was received. This field is not filled in by ReadRequest. The HTTP server in this package sets the field for TLS-enabled connections before invoking a handler; otherwise it leaves the field nil. This field is ignored by the HTTP client. |
cancel |
undefined |
Cancel is an optional channel whose closure indicates that the client request should be regarded as canceled. Not all implementations of RoundTripper may support Cancel. |
response? |
Response |
Response is the redirect response which caused this request to be created. This field is only populated during client redirects. |
pattern |
string |
Pattern is the ServeMux pattern that matched the request. It is empty if the request was not matched against a pattern. |
context() |
(): context.Context |
Context returns the request's context. To change the context, use Request.clone or Request.withContext. |
withContext() |
(ctx: context.Context): (Request) |
WithContext returns a shallow copy of r with its context changed to ctx. The provided ctx must be non-nil. |
clone() |
(ctx: context.Context): (Request) |
Clone returns a deep copy of r with its context changed to ctx. The provided ctx must be non-nil. |
protoAtLeast() |
(major: number, minor: number): boolean |
ProtoAtLeast reports whether the HTTP protocol used in the request is at least major.minor. |
userAgent() |
(): string |
UserAgent returns the client's User-Agent, if sent in the request. |
cookies() |
(): Array<(Cookie | undefined)> |
Cookies parses and returns the HTTP cookies sent with the request. |
cookiesNamed() |
(name: string): Array<(Cookie | undefined)> |
CookiesNamed parses and returns the named HTTP cookies sent with the request or an empty slice if none matched. |
cookie() |
(name: string): (Cookie) |
Cookie returns the named cookie provided in the request or ErrNoCookie if not found. If multiple cookies match the given name, only one cookie will be returned. |
addCookie() |
(c: Cookie): void |
AddCookie adds a cookie to the request. Per RFC 6265 section 5.4, AddCookie does not attach more than one Cookie header field. That means all cookies, if any, are written into the same line, separated by semicolon. AddCookie only sanitizes c's name and value, and does not sanitize a Cookie header already present in the request. |
referer() |
(): string |
Referer returns the referring URL, if sent in the request. |
multipartReader() |
(): (multipart.Reader) |
MultipartReader returns a MIME multipart reader if this is a multipart/form-data or a multipart/mixed POST request, else returns nil and an error. Use this function instead of Request.parseMultipartForm to process the request body as a stream. |
write() |
(w: io.Writer): void |
Write writes an HTTP/1.1 request, which is the header and body, in wire format. This method consults the following fields of the request: |
writeProxy() |
(w: io.Writer): void |
WriteProxy is like Request.write but writes the request in the form expected by an HTTP proxy. In particular, Request.writeProxy writes the initial Request-URI line of the request with an absolute URI, per section 5.3 of RFC 7230, including the scheme and host. In either case, WriteProxy also writes a Host header, using either r.Host or r.URL.Host. |
basicAuth() |
(): [string, string, boolean] |
BasicAuth returns the username and password provided in the request's Authorization header, if the request uses HTTP Basic Authentication. See RFC 2617, Section 2. |
setBasicAuth() |
(username: string, password: string): void |
SetBasicAuth sets the request's Authorization header to use HTTP Basic Authentication with the provided username and password. |
parseForm() |
(): void |
ParseForm populates r.Form and r.PostForm. |
parseMultipartForm() |
(maxMemory: number): void |
ParseMultipartForm parses a request body as multipart/form-data. The whole request body is parsed and up to a total of maxMemory bytes of its file parts are stored in memory, with the remainder stored on disk in temporary files. ParseMultipartForm calls Request.parseForm if necessary. If ParseForm returns an error, ParseMultipartForm returns it but also continues parsing the request body. After one call to ParseMultipartForm, subsequent calls have no effect. |
formValue() |
(key: string): string |
FormValue returns the first value for the named component of the query. The precedence order: 1. application/x-www-form-urlencoded form body (POST, PUT, PATCH only) 2. query parameters (always) 3. multipart/form-data form body (always) |
postFormValue() |
(key: string): string |
PostFormValue returns the first value for the named component of the POST, PUT, or PATCH request body. URL query parameters are ignored. PostFormValue calls Request.parseMultipartForm and Request.parseForm if necessary and ignores any errors returned by these functions. If key is not present, PostFormValue returns the empty string. |
formFile() |
(key: string): [multipart.File, (multipart.FileHeader)] |
FormFile returns the first file for the provided form key. FormFile calls Request.parseMultipartForm and Request.parseForm if necessary. |
pathValue() |
(name: string): string |
PathValue returns the value for the named path wildcard in the ServeMux pattern that matched the request. It returns the empty string if the request was not matched against a pattern or there is no such wildcard in the pattern. |
setPathValue() |
(name: string, value: string): void |
SetPathValue sets name to value, so that subsequent calls to r.PathValue(name) return value. It does not unescape value. |
http.Handler
A Handler responds to an HTTP request.
Handler.serveHTTP should write reply headers and data to the ResponseWriter
and then return. Returning signals that the request is finished; it
is not valid to use the ResponseWriter or read from the
Request.body after or concurrently with the completion of the
ServeHTTP call.
Depending on the HTTP client software, HTTP protocol version, and
any intermediaries between the client and the Go server, it may not
be possible to read from the Request.body after writing to the
ResponseWriter. Cautious handlers should read the Request.body
first, and then reply.
Except for reading the body, handlers should not modify the provided Request.
If ServeHTTP panics, the server (the caller of ServeHTTP) assumes
that the effect of the panic was isolated to the active request.
It recovers the panic, logs a stack trace to the server error log,
and either closes the network connection or sends an HTTP/2
RST_STREAM, depending on the HTTP protocol. To abort a handler so
the client sees an interrupted response but the server doesn't log
an error, panic with the value ErrAbortHandler.
| Member | Type | |
|---|---|---|
serveHTTP() |
(_arg0: ResponseWriter, _arg1: Request): void |
http.ResponseWriter
A ResponseWriter interface is used by an HTTP handler to construct an HTTP response.
A ResponseWriter may not be used after Handler.serveHTTP has returned.
| Member | Type | |
|---|---|---|
header() |
(): Header |
Header returns the header map that will be sent by ResponseWriter.writeHeader. The Header map also is the mechanism with which Handler implementations can set HTTP trailers. |
write() |
(_arg0: string|Array<number>): number |
Write writes the data to the connection as part of an HTTP reply. |
writeHeader() |
(statusCode: number): void |
WriteHeader sends an HTTP response header with the provided status code. |
http.Server
A Server defines parameters for running an HTTP server. The zero value for Server is a valid configuration.
| Member | Type | |
|---|---|---|
addr |
string |
Addr optionally specifies the TCP address for the server to listen on, in the form "host:port". If empty, ":http" (port 80) is used. The service names are defined in RFC 6335 and assigned by IANA. See net.Dial for details of the address format. |
handler |
Handler // handler to invoke, http.DefaultServeMux if nil |
|
disableGeneralOptionsHandler |
boolean |
DisableGeneralOptionsHandler, if true, passes "OPTIONS *" requests to the Handler, otherwise responds with 200 OK and Content-Length: 0. |
tlsConfig? |
any |
TLSConfig optionally provides a TLS configuration for use by ServeTLS and ListenAndServeTLS. Note that this value is cloned by ServeTLS and ListenAndServeTLS, so it's not possible to modify the configuration with methods like tls.Config.SetSessionTicketKeys. To use SetSessionTicketKeys, use Server.Serve with a TLS Listener instead. |
readTimeout |
time.Duration |
ReadTimeout is the maximum duration for reading the entire request, including the body. A zero or negative value means there will be no timeout. |
readHeaderTimeout |
time.Duration |
ReadHeaderTimeout is the amount of time allowed to read request headers. The connection's read deadline is reset after reading the headers and the Handler can decide what is considered too slow for the body. If zero, the value of ReadTimeout is used. If negative, or if zero and ReadTimeout is zero or negative, there is no timeout. |
writeTimeout |
time.Duration |
WriteTimeout is the maximum duration before timing out writes of the response. It is reset whenever a new request's header is read. Like ReadTimeout, it does not let Handlers make decisions on a per-request basis. A zero or negative value means there will be no timeout. |
idleTimeout |
time.Duration |
IdleTimeout is the maximum amount of time to wait for the next request when keep-alives are enabled. If zero, the value of ReadTimeout is used. If negative, or if zero and ReadTimeout is zero or negative, there is no timeout. |
maxHeaderBytes |
number |
MaxHeaderBytes controls the maximum number of bytes the server will read parsing the request header's keys and values, including the request line. It does not limit the size of the request body. If zero, DefaultMaxHeaderBytes is used. |
maxHeaderValueCount |
number |
MaxHeaderValueCount controls the maximum number of header values that the server is willing to parse from a request. If zero, DefaultMaxHeaderValueCount is used. Comma-separated values in a single header line are counted once, while values sent as multiple header lines are counted multiple times. An exception to this is the Trailer header, whose comma-separated values are counted separately, as each of them is expected to be received later as an individual trailer header line. |
tlsNextProto |
{ [key: string]: any } |
TLSNextProto optionally specifies a function to take over ownership of the provided TLS connection when an ALPN protocol upgrade has occurred. The map key is the protocol name negotiated. The Handler argument should be used to handle HTTP requests and will initialize the Request's TLS and RemoteAddr if not already set. The connection is automatically closed when the function returns. If TLSNextProto is not nil, HTTP/2 support is not enabled automatically. |
connState |
(_arg0: net.Conn, _arg1: ConnState) => void |
ConnState specifies an optional callback function that is called when a client connection changes state. See the ConnState type and associated constants for details. |
errorLog? |
any |
ErrorLog specifies an optional logger for errors accepting connections, unexpected behavior from handlers, and underlying FileSystem errors. If nil, logging is done via the log package's standard logger. |
baseContext |
(_arg0: net.Listener) => context.Context |
BaseContext optionally specifies a function that returns the base context for incoming requests on this server. The provided Listener is the specific Listener that's about to start accepting requests. If BaseContext is nil, the default is context.Background(). If non-nil, it must return a non-nil context. |
connContext |
(ctx: context.Context, c: net.Conn) => context.Context |
ConnContext optionally specifies a function that modifies the context used for a new connection c. The provided ctx is derived from the base context and has a ServerContextKey value. |
http2? |
HTTP2Config |
HTTP2 configures HTTP/2 connections. |
protocols? |
Protocols |
Protocols is the set of protocols accepted by the server. |
disableClientPriority |
boolean |
DisableClientPriority specifies whether client-specified priority, as specified in RFC 9218, should be respected or not. |
close() |
(): void |
Close immediately closes all active net.Listeners and any connections in state StateNew, StateActive, or StateIdle. For a graceful shutdown, use Server.shutdown. |
shutdown() |
(ctx: context.Context): void |
Shutdown gracefully shuts down the server without interrupting any active connections. Shutdown works by first closing all open listeners, then closing all idle connections, and then waiting indefinitely for connections to return to idle and then shut down. If the provided context expires before the shutdown is complete, Shutdown returns the context's error, otherwise it returns any error returned from closing the Server's underlying Listener(s). |
registerOnShutdown() |
(f: () => void): void |
RegisterOnShutdown registers a function to call on Server.shutdown. This can be used to gracefully shutdown connections that have undergone ALPN protocol upgrade or that have been hijacked. This function should start protocol-specific graceful shutdown, but should not wait for shutdown to complete. |
listenAndServe() |
(): void |
ListenAndServe listens on the TCP network address s.Addr and then calls Serve to handle requests on incoming connections. Accepted connections are configured to enable TCP keep-alives. |
serve() |
(l: net.Listener): void |
Serve accepts incoming connections on the Listener l, creating a new service goroutine for each. The service goroutines read requests and then call s.Handler to reply to them. |
serveTLS() |
(l: net.Listener, certFile: string, keyFile: string): void |
ServeTLS accepts incoming connections on the Listener l, creating a new service goroutine for each. The service goroutines perform TLS setup and then read requests, calling s.Handler to reply to them. |
setKeepAlivesEnabled() |
(v: boolean): void |
SetKeepAlivesEnabled controls whether HTTP keep-alives are enabled. By default, keep-alives are always enabled. Only very resource-constrained environments or servers in the process of shutting down should disable them. |
listenAndServeTLS() |
(certFile: string, keyFile: string): void |
ListenAndServeTLS listens on the TCP network address s.Addr and then calls ServeTLS to handle requests on incoming TLS connections. Accepted connections are configured to enable TCP keep-alives. |
http.SameSite
SameSite allows a server to define a cookie attribute making it impossible for the browser to send this cookie along with cross-site requests. The main goal is to mitigate the risk of cross-origin information leakage, and provide some protection against cross-site request forgery attacks.
See https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00 for details.
Has everything Number has.
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.