mirror of
https://github.com/curl/curl.git
synced 2026-08-24 12:23:32 +03:00
curl: add --follow
Makes curl follow redirects an act on the response code and change a
custom method accordingly, contrary to --location.
Potential future command line to send QUERY and following a redirect
according to the status code:
curl -d "request-body" -X QUERY --follow https://example.com
add test 794,796,797
Assisted-by: Daniel Böhmer <post@daniel-boehmer.de>
Closes #16543
This commit is contained in:
parent
4d025fd912
commit
39543b7fdc
16 changed files with 340 additions and 10 deletions
|
|
@ -101,6 +101,7 @@ DPAGES = \
|
|||
fail-with-body.md \
|
||||
fail.md \
|
||||
false-start.md \
|
||||
follow.md \
|
||||
form-escape.md \
|
||||
form-string.md \
|
||||
form.md \
|
||||
|
|
|
|||
25
docs/cmdline-opts/follow.md
Normal file
25
docs/cmdline-opts/follow.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Long: follow
|
||||
Help: Follow redirects per spec
|
||||
Category: http
|
||||
Added: 8.16.0
|
||||
Multi: boolean
|
||||
See-also:
|
||||
- request
|
||||
- location
|
||||
Example:
|
||||
- -X POST --follow $URL
|
||||
---
|
||||
|
||||
# `--follow`
|
||||
|
||||
Instructs curl to follow HTTP redirects and to do the custom request method
|
||||
set with --request when following redirects as the HTTP specification says.
|
||||
|
||||
The method string set with --request is used in subsequent requests for the
|
||||
status codes 307 or 308, but may be reset to GET for 301, 302 and 303.
|
||||
|
||||
This is subtly different than --location, as that option always set the custom
|
||||
method in all subsequent requests independent of response code.
|
||||
|
|
@ -9,6 +9,7 @@ Added: 7.10.4
|
|||
Multi: boolean
|
||||
See-also:
|
||||
- user
|
||||
- follow
|
||||
Example:
|
||||
- --location-trusted -u user:password $URL
|
||||
- --location-trusted -H "Cookie: session=abc" $URL
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ Multi: boolean
|
|||
See-also:
|
||||
- resolve
|
||||
- alt-svc
|
||||
- follow
|
||||
Example:
|
||||
- -L $URL
|
||||
---
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@
|
|||
--range (-r) 4.0
|
||||
--rate 7.84.0
|
||||
--raw 7.16.2
|
||||
--follow 8.16.0
|
||||
--referer (-e) 4.0
|
||||
--remote-header-name (-J) 7.20.0
|
||||
--remote-name (-O) 4.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue