package
1.68.0
Repository: https://github.com/fortio/fortio.git
Documentation: pkg.go.dev

# Functions

AddHTTPS replaces http:// in url with https:// or prepends https:/// if url does not contain the http:// prefix.
ASCIIToUpper returns a byte array equal to the input string but in lowercase.
CacheOn sets the header for indefinite caching.
CommonHTTPOptionsFromForm is used essentially in ui/uihandler.go but we want to reuse some options for fetching URLs too.
CopyHeaders copies all or trace headers from `r` into `req`.
CreateProxyClient HTTP client for connection reuse.
DebugHandler returns debug/useful info to HTTP client.
DebugSummary returns a string with the size and escaped first max/2 and last max/2 bytes of a buffer (or the whole escaped buffer if small enough).
DynamicHTTPServer listens on an available port, sets up an HTTP or a closing server simulating an HTTPS server (when closing is true) server on it and returns the listening port and mux to which one can attach handlers to.
EchoDebugPath returns the additional echo handler path behind debugPath (ie /debug -> /debug/echo/).
EchoHandler is an HTTP server handler echoing back the input.
Fetch creates a client an performs a fetch according to the HTTP options passed in.
FetcherHandler is the handler for the fetcher/proxy.
FetcherHandler2 is the handler for the fetcher/proxy that supports h2 input and makes a new request with all headers copied (allows to test sticky routing) Note this should only be made available to trusted clients.
FetchURL fetches the data at the given URL using the standard client and default options.
FoldFind searches the bytes assuming ASCII, ignoring the lowercase bit for testing.
Gzip wraps a handler for automatic gzip.
HTTPServer creates an HTTP server named name on address/port.
HTTPServerWithHandler creates and h2c compatible server named name on address/port.
Deprecated: use fortio.org/log.LogAndCall().
LogAndCallNoArg is LogAndCall for functions not needing the response/request args.
MakeSimpleRequest makes a new request for url but copies trace headers from input request r.
MultiServer starts fan out HTTP server on the given port.
NewClient creates either a standard or fast client (depending on the DisableFastClient flag).
NewFastClient makes a basic, efficient HTTP 1.0/1.1 client.
NewGzipHTTPResponseWriter returns a wrapper for gzip'ing the response.
NewHTMLEscapeWriter creates a io.Writer that can safely output to an http.ResponseWrite with HTMLEscape-ing.
NewHTTPOptions creates and initialize a HTTPOptions object.
NewStdClient creates a client object that wraps the net/http standard client.
NewSyncReader returns a new thread-safe reader.
OnBehalfOf adds a header with the remote addr to an http options object.
OnBehalfOfRequest same as OnBehalfOf but places the header directly on the dst request object but also adds a X-Proxy-Agent header if the user-agent isn't already the same as this running server's version.
ParseChunkSize extracts the chunk size and consumes the line.
ParseDecimal extracts the first positive integer number from the input.
QueryArg(r,...) is like r.FormValue(...) but exclusively getting the values from the query string (as we use the body for data).
RedirectToHTTPS Sets up a redirector to https on the given port.
RedirectToHTTPSHandler handler sends a redirect to same URL with https.
RoundDuration rounds to 10th of second.
RunHTTPTest runs an HTTP test and returns the aggregated stats.
Serve starts a debug / echo HTTP server on the given port.
ServeTCP is Serve() but restricted to TCP (return address is assumed to be TCP - will panic for Unix domain).
ServeTLS starts a debug / echo server on the given port, using TLS if certPath and keyPath aren't empty.
SetupPPROF add pprof to the mux (mirror the init() of HTTP pprof).
Fetch creates a client an performs a fetch according to the HTTP options passed in.

# Constants

HTTPReqTimeOutDefaultValue is the default timeout value.
RetryOnce is used internally as an error code to allow 1 retry for bad socket reuse.
SocketError is return when a transport error occurred: unexpected EOF, connection error, etc...

# Variables

BufferSizeKb size of the buffer (max data) for optimized client in kilobytes defaults to 128k.
CheckConnectionClosedHeader indicates whether to check for server side connection closed headers.
DefaultHTTPOptions is meant to be set by the main() from bincommon.SharedHTTPOptions() and used as a starting point for CommonHTTPOptionsFromForm which is used for FetchHandler and forwarder as well as the UI.
EchoRequests is the number of request received.
EnvoyRequestID is the header set by envoy and we need to propagate for distributed tracing.
MaxDelay is the maximum delay allowed for the echoserver responses.
TraceHeader is the single aggregated open tracing header to propagate when present.
TraceHeadersPrefix is the prefix for the multi header version of open zipkin.

# Structs

Client object for making repeated requests of the same URL using the same HTTP client (net/http).
DelayedErrorReader is a reader that never returns an error along with a non 0 read.
FastClient is a fast, lockfree single purpose HTTP 1.0/1.1 client.
GzipResponseWriter wraps the response and gzips the content.
HTMLEscapeWriter is an io.Writer escaping the output for safe HTML inclusion.
HTTPOptions holds the common options of both HTTP clients and the headers.
HTTPRunnerOptions includes the base RunnerOptions plus HTTP specific options.
HTTPRunnerResults is the aggregated result of an HTTPRunner.
MultiServerConfig configures the MultiServer and holds the HTTP client it uses for proxying.
SyncReader is a thread-safe wrapper for a reader.
TargetConf is the structure to configure one of the multiple targets for MultiServer.
TLSOptions are common TLS related options between https and grpc.

# Interfaces

Fetcher is the URL content fetcher that the different client implements.
Transport common interface between http.Transport and http2.Transport.

# Type aliases