Поиск по блогу

четверг, 3 июля 2014 г.

Curl command with proxy ...все из curl.1 the man page

И ссылка на отличные примеры Linux curl command with proxy. Если задать поиск по man Curl со словом "proxy", то получится этот пост

-H, --header

(HTTP) Extra header to include in the request when sending HTTP to a server. You may specify any number of extra headers. Note that if you should add a custom header that has the same name as one of the internal ones curl would use, your externally set header will be used instead of the internal one. This allows you to make even trickier stuff than curl would normally do. You should not replace internally set headers without knowing perfectly well what you're doing. Remove an internal header by giving a replacement without content on the right side of the colon, as in: -H "Host:". If you send the custom header with no-value then its header must be terminated with a semicolon, such as -H "X-Custom-Header;" to send "X-Custom-Header:".
curl will make sure that each header you add/replace is sent with the proper end-of-line marker, you should thus not add that as a part of the header content: do not add newlines or carriage returns, they will only mess things up for you.
See also the -A, --user-agent and -e, --referer options.
Starting in 7.37.0, you need --proxy-header to send custom headers intended for a proxy.
This option can be used multiple times to add/replace/remove multiple headers.

--negotiate

(HTTP) Enables GSS-Negotiate authentication. The GSS-Negotiate method was designed by Microsoft and is used in their web applications. It is primarily meant as a support for Kerberos5 authentication but may be also used along with another authentication method. For more information see IETF draft draft-brezak-spnego-http-04.txt.
If you want to enable Negotiate for your proxy authentication, then use --proxy-negotiate.
This option requires a library built with GSSAPI support. This is not very common. Use -V, --version to see if your version supports GSS-Negotiate.
When using this option, you must also provide a fake -u, --user option to activate the authentication code properly. Sending a '-u :' is enough as the user name and password from the -u option aren't actually used.
If this option is used several times, only the first one is used.

--noproxy no-proxy-list

Comma-separated list of hosts which do not use a proxy, if one is specified. The only wildcard is a single * character, which matches all hosts, and effectively disables the proxy. Each name in this list is matched as either a domain which contains the hostname, or the hostname itself. For example, local.com would match local.com, local.com:80, and www.local.com, but not www.notlocal.com. (Added in 7.19.4).

--ntlm

(HTTP) Enables NTLM authentication. The NTLM authentication method was designed by Microsoft and is used by IIS web servers. It is a proprietary protocol, reverse-engineered by clever people and implemented in curl based on their efforts. This kind of behavior should not be endorsed, you should encourage everyone who uses NTLM to switch to a public and documented authentication method instead, such as Digest.
If you want to enable NTLM for your proxy authentication, then use --proxy-ntlm.
This option requires a library built with SSL support. Use -V, --version to see if your curl supports NTLM.
If this option is used several times, only the first one is used.

--proxy-header

(HTTP) Extra header to include in the request when sending HTTP to a proxy. You may specify any number of extra headers. This is the equivalent option to -H, --header but is for proxy communication only like in CONNECT requests when you want a separate header sent to the proxy to what is sent to the actual remote host.
curl will make sure that each header you add/replace is sent with the proper end-of-line marker, you should thus not add that as a part of the header content: do not add newlines or carriage returns, they will only mess things up for you.
Headers specified with this option will not be included in requests that curl knows will not be sent to a proxy.
This option can be used multiple times to add/replace/remove multiple headers.
(Added in 7.37.0)

-p, --proxytunnel

When an HTTP proxy is used (-x, --proxy), this option will cause non-HTTP protocols to attempt to tunnel through the proxy instead of merely using it to do HTTP-like operations. The tunnel approach is made with the HTTP proxy CONNECT request and requires that the proxy allows direct connect to the remote port number curl wants to tunnel through to.

--proxy-anyauth

Tells curl to pick a suitable authentication method when communicating with the given proxy. This might cause an extra request/response round-trip. (Added in 7.13.2)

--proxy-basic

Tells curl to use HTTP Basic authentication when communicating with the given proxy. Use --basic for enabling HTTP Basic with a remote host. Basic is the default authentication method curl uses with proxies.

--proxy-digest

Tells curl to use HTTP Digest authentication when communicating with the given proxy. Use --digest for enabling HTTP Digest with a remote host.

--proxy-negotiate

Tells curl to use HTTP Negotiate authentication when communicating with the given proxy. Use --negotiate for enabling HTTP Negotiate with a remote host. (Added in 7.17.1)

--proxy-ntlm

Tells curl to use HTTP NTLM authentication when communicating with the given proxy. Use --ntlm for enabling NTLM with a remote host.

--proxy1.0 proxyhost[:port]

Use the specified HTTP 1.0 proxy. If the port number is not specified, it is assumed at port 1080.
The only difference between this and the HTTP proxy option (-x, --proxy), is that attempts to use CONNECT through the proxy will specify an HTTP 1.0 protocol instead of the default HTTP 1.1.

--socks4 host[:port]

Use the specified SOCKS4 proxy. If the port number is not specified, it is assumed at port 1080. (Added in 7.15.2)
This option overrides any previous use of -x, --proxy, as they are mutually exclusive.
Since 7.21.7, this option is superfluous since you can specify a socks4 proxy with -x, --proxy using a socks4:// protocol prefix.
If this option is used several times, the last one will be used.

--socks4a host[:port]

Use the specified SOCKS4a proxy. If the port number is not specified, it is assumed at port 1080. (Added in 7.18.0)
This option overrides any previous use of -x, --proxy, as they are mutually exclusive.
Since 7.21.7, this option is superfluous since you can specify a socks4a proxy with -x, --proxy using a socks4a:// protocol prefix.
If this option is used several times, the last one will be used.

--socks5-hostname host[:port]

Use the specified SOCKS5 proxy (and let the proxy resolve the host name). If the port number is not specified, it is assumed at port 1080. (Added in 7.18.0)
This option overrides any previous use of -x, --proxy, as they are mutually exclusive.
Since 7.21.7, this option is superfluous since you can specify a socks5 hostname proxy with -x, --proxy using a socks5h:// protocol prefix.
If this option is used several times, the last one will be used. (This option was previously wrongly documented and used as --socks without the number appended.)

--socks5 host[:port]

Use the specified SOCKS5 proxy - but resolve the host name locally. If the port number is not specified, it is assumed at port 1080.
This option overrides any previous use of -x, --proxy, as they are mutually exclusive.
Since 7.21.7, this option is superfluous since you can specify a socks5 proxy with -x, --proxy using a socks5:// protocol prefix.
If this option is used several times, the last one will be used. (This option was previously wrongly documented and used as --socks without the number appended.)
This option (as well as --socks4) does not work with IPV6, FTPS or LDAP.

--socks5-gssapi-service servicename

The default service name for a socks server is rcmd/server-fqdn. This option allows you to change it.
Examples: --socks5 proxy-name --socks5-gssapi-service sockd would use sockd/proxy-name --socks5 proxy-name --socks5-gssapi-service sockd/real-name would use sockd/real-name for cases where the proxy-name does not match the principal name. (Added in 7.19.4).

-U, --proxy-user user:password

Specify the user name and password to use for proxy authentication.
If you use an SSPI-enabled curl binary and do NTLM authentication, you can force curl to pick up the user name and password from your environment by simply specifying a single colon with this option: "-U :".
If this option is used several times, the last one will be used.

Из переменных "The variables available are: "

http_connect The numerical code that was found in the last response (from a proxy) to a curl CONNECT request. (Added in 7.12.4)
time_connect The time, in seconds, it took from the start until the TCP connect to the remote host (or proxy) was completed.

-x, --proxy

Use the specified proxy.
The proxy string can be specified with a protocol:// prefix to specify alternative proxy protocols. Use socks4://, socks4a://, socks5:// or socks5h:// to request the specific SOCKS version to be used. No protocol specified, http:// and all others will be treated as HTTP proxies. (The protocol support was added in curl 7.21.7)
If the port number is not specified in the proxy string, it is assumed to be 1080.
This option overrides existing environment variables that set the proxy to use. If there's an environment variable setting a proxy, you can set proxy to "" to override it.
All operations that are performed over an HTTP proxy will transparently be converted to HTTP. It means that certain protocol specific operations might not be available. This is not the case if you can tunnel through the proxy, as one with the -p, --proxytunnel option.
User and password that might be provided in the proxy string are URL decoded by curl. This allows you to pass in special characters such as @ by using %40 or pass in a colon with %3a.
The proxy host can be specified the exact same way as the proxy environment variables, including the protocol prefix (http://) and the embedded user + password.
If this option is used several times, the last one will be used.

ENVIRONMENT

The environment variables can be specified in lower case or upper case. The lower case version has precedence. http_proxy is an exception as it is only available in lower case.
Using an environment variable to set the proxy has the same effect as using the --proxy option.
http_proxy [protocol://]host[:port]
Sets the proxy server to use for HTTP.
HTTPS_PROXY [protocol://]host[:port]
Sets the proxy server to use for HTTPS.
[url-protocol]_PROXY [protocol://]host[:port]
Sets the proxy server to use for [url-protocol], where the protocol is a protocol that curl supports and as specified in a URL. FTP, FTPS, POP3, IMAP, SMTP, LDAP etc.
ALL_PROXY [protocol://]host[:port]
Sets the proxy server to use if no protocol-specific proxy is set.
NO_PROXY comma-separated list of hosts
list of host names that shouldn't go through any proxy. If set to a asterisk '*' only, it matches all hosts.

PROXY PROTOCOL PREFIXES

Since curl version 7.21.7, the proxy string may be specified with a protocol:// prefix to specify alternative proxy protocols.
If no protocol is specified in the proxy string or if the string doesn't match a supported one, the proxy will be treated as an HTTP proxy.
The supported proxy protocol prefixes are as follows:
socks4://
Makes it the equivalent of --socks4
socks4a://
Makes it the equivalent of --socks4a
socks5://
Makes it the equivalent of --socks5
socks5h://
Makes it the equivalent of --socks5-hostname


Посты чуть ниже также могут вас заинтересовать

Комментариев нет:

Отправить комментарий