internal/webfetchhelp/text/http.txt
HTTP REFERENCE
USAGE
ez-agent-webfetch [HTTP OPTIONS] http://URL
ez-agent-webfetch [HTTP OPTIONS] https://URL
REQUESTS
-X, --method METHOD
Use a valid HTTP method token exactly as supplied. The implicit method is
GET without a body and POST with --data or --data-file. An explicit method
always wins, including GET or DELETE with a body.
-d, --data STRING
Send literal argument bytes. No form/JSON conversion, newline, or implicit
Content-Type is added.
--data-file PATH
Send literal file bytes; - reads stdin. A regular file has a known length
and can be reopened for 307/308 redirect replay. Stdin is non-replayable;
a redirect that requires replay fails rather than sending an empty body.
--data and --data-file are mutually exclusive.
HEADERS AND IDENTITY
-H, --header 'Name: value'
Repeatable. Fields split at the first colon, reject CR/LF injection, trim
optional whitespace around values, and use additive semantics. Host sets
the request host. URL userinfo is rejected.
--header-file PATH
Read header lines from a repeatable filesystem path so secret values do not
enter argv or shell history. Blank lines are ignored. Every field loaded
this way is sensitive during redirects. Stdin is not accepted here because
it remains request-body or WebSocket input. Header files are limited to
65,536 bytes each.
-A, --user-agent VALUE
User-Agent precedence is explicit --user-agent (including empty), then the
last User-Agent from --header, then EzAgent/<version>. An explicit empty
value suppresses the header and Go's fallback identity.
--sensitive-header NAME
Repeat a valid field name to classify a caller-defined header as sensitive
during redirects. The value is still supplied separately with --header.
Content-Length, Transfer-Encoding, and Trailer are transport-owned and cannot
be supplied with --header. Request framing is computed from the selected body.
Secret command-line headers may be visible in process listings and shell
history; use --header-file for them.
REDIRECTS AND STATUS
--no-redirect
Disable redirects. Otherwise origins are compared by normalized scheme,
hostname, and effective port, with a ten-redirect limit. Authorization,
Cookie, Proxy-Authorization, header-file fields, caller-marked sensitive
headers, and request bodies cause a cross-origin redirect to fail rather
than being forwarded. This includes HTTPS-to-HTTP downgrades. Ordinary
unauthenticated GET redirects remain enabled, including redirects to LAN
or private destinations.
--fail-with-body
Ordinarily completed 4xx/5xx bodies are successful fetches. This option
still writes the body to stdout or the direct output file, then exits 1 for
a final status >= 400. The file body is retained.
The first release intentionally has no status-printing or response-header dump
mode. Only body bytes are output; status is exposed only by --fail-with-body.
LIMITS, TRANSFORMS, AND OUTPUT
--max-bytes N
A positive limit detects one byte beyond N and fails. Omission defaults to
10 MiB for raw and transformed responses. Explicit zero opts raw streaming
into an unlimited response; it remains invalid with a response transform.
--normalize
--strip-and-index
--html-width N
See --help-html. Normalize requires HTML/XHTML. Strip-and-index accepts
negotiated Markdown or HTML/XHTML semantic fallback and processes the
complete response in memory before output.
-o, --output PATH
Omission or - writes stdout. A filesystem destination is opened before the
request and response bytes stream directly to it. Without --force,
O_WRONLY|O_CREATE|O_EXCL refuses an existing path. Creation requests mode
0666 subject to the process umask.
--force
Requires a filesystem --output path. It opens with
O_WRONLY|O_CREATE|O_TRUNC, truncating an existing target immediately.
Direct output uses ordinary OS path semantics, like tee. There are no temporary
files, rollback, symlink/non-regular-file restrictions, or restoration of prior
data. Open, write, and close errors fail the command; any later failure may
leave the requested file empty or partially written.
Responses stream with bounded buffers and are not implicitly decompressed.
Webfetch does not add Accept-Encoding. A caller may explicitly request an
encoding, in which case delivered entity bytes remain encoded unless a response
transform's separately documented decoding policy applies.
TIMEOUT, TLS, AND PROXIES
--timeout DURATION
A nonnegative network-operation timeout; 0 means no deadline. After local
inputs are loaded, it includes DNS, proxy, connection, TLS, redirects, body
transfer, and output. The caller coordinates readiness and delivery for
local --header-file paths, including FIFOs.
HTTPS verifies hostnames and certificates using the system root CA store.
There is no insecure TLS mode. HTTP is plaintext. Standard Go HTTP_PROXY,
HTTPS_PROXY, and NO_PROXY behavior is retained, including supported SOCKS proxy URLs.
EXAMPLES
ez-agent-webfetch https://example.test/data.json
ez-agent-webfetch -H 'Accept: application/json' \
-H 'Authorization: Bearer token' https://example.test/api?page=2
ez-agent-webfetch -X POST -H 'Content-Type: application/json' \
-d '{"name":"example"}' https://example.test/api
generate-payload | ez-agent-webfetch -X PUT --data-file - \
-H 'Content-Type: application/octet-stream' \
-o response.bin https://example.test/object