Loading docs/cmdline-opts/header.d +6 −3 Original line number Original line Diff line number Diff line Long: header Long: header Short: H Short: H Arg: <header> Arg: <header/@file> Help: Pass custom header LINE to server Help: Pass custom header(s) to server Protocols: HTTP Protocols: HTTP --- --- Extra header to include in the request when sending HTTP to a server. You may 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 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 header that has the same name as one of the internal ones curl would use, your Loading @@ -21,6 +20,10 @@ end-of-line marker, you should thus \fBnot\fP add that as a part of the header content: do not add newlines or carriage returns, they will only mess things up content: do not add newlines or carriage returns, they will only mess things up for you. for you. Starting in 7.55.0, this option can take an argument in @filename style, which then adds a header for each line in the input file. Using @- will make curl read the header file from stdin. See also the --user-agent and --referer options. See also the --user-agent and --referer options. Starting in 7.37.0, you need --proxy-header to send custom headers intended Starting in 7.37.0, you need --proxy-header to send custom headers intended Loading docs/cmdline-opts/proxy-header.d +6 −2 Original line number Original line Diff line number Diff line Long: proxy-header Long: proxy-header Arg: <header> Arg: <header/@file> Help: Pass custom header LINE to proxy Help: Pass custom header(s) to proxy Protocols: HTTP Protocols: HTTP Added: 7.37.0 Added: 7.37.0 --- --- Loading @@ -17,4 +17,8 @@ up for you. Headers specified with this option will not be included in requests that curl Headers specified with this option will not be included in requests that curl knows will not be sent to a proxy. knows will not be sent to a proxy. Starting in 7.55.0, this option can take an argument in @filename style, which then adds a header for each line in the input file. Using @- will make curl read the header file from stdin. This option can be used multiple times to add/replace/remove multiple headers. This option can be used multiple times to add/replace/remove multiple headers. src/tool_getparam.c +36 −6 Original line number Original line Diff line number Diff line Loading @@ -1602,12 +1602,42 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ break; break; case 'H': case 'H': /* A custom header to append to a list */ /* A custom header to append to a list */ if(nextarg[0] == '@') { /* read many headers from a file or stdin */ char *string; size_t len; bool use_stdin = !strcmp(&nextarg[1], "-"); FILE *file = use_stdin?stdin:fopen(&nextarg[1], FOPEN_READTEXT); if(!file) warnf(global, "Failed to open %s!\n", &nextarg[1]); else { if(PARAM_OK == file2memory(&string, &len, file)) { /* Allow strtok() here since this isn't used threaded */ /* !checksrc! disable BANNEDFUNC 2 */ char *h = strtok(string, "\r\n"); while(h) { if(subletter == 'p') /* --proxy-header */ err = add2list(&config->proxyheaders, h); else err = add2list(&config->headers, h); if(err) return err; h = strtok(NULL, "\r\n"); } free(string); } if(!use_stdin) fclose(file); } } else { if(subletter == 'p') /* --proxy-header */ if(subletter == 'p') /* --proxy-header */ err = add2list(&config->proxyheaders, nextarg); err = add2list(&config->proxyheaders, nextarg); else else err = add2list(&config->headers, nextarg); err = add2list(&config->headers, nextarg); if(err) if(err) return err; return err; } break; break; case 'i': case 'i': config->include_headers = toggle; /* include the headers as well in the config->include_headers = toggle; /* include the headers as well in the Loading Loading
docs/cmdline-opts/header.d +6 −3 Original line number Original line Diff line number Diff line Long: header Long: header Short: H Short: H Arg: <header> Arg: <header/@file> Help: Pass custom header LINE to server Help: Pass custom header(s) to server Protocols: HTTP Protocols: HTTP --- --- Extra header to include in the request when sending HTTP to a server. You may 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 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 header that has the same name as one of the internal ones curl would use, your Loading @@ -21,6 +20,10 @@ end-of-line marker, you should thus \fBnot\fP add that as a part of the header content: do not add newlines or carriage returns, they will only mess things up content: do not add newlines or carriage returns, they will only mess things up for you. for you. Starting in 7.55.0, this option can take an argument in @filename style, which then adds a header for each line in the input file. Using @- will make curl read the header file from stdin. See also the --user-agent and --referer options. See also the --user-agent and --referer options. Starting in 7.37.0, you need --proxy-header to send custom headers intended Starting in 7.37.0, you need --proxy-header to send custom headers intended Loading
docs/cmdline-opts/proxy-header.d +6 −2 Original line number Original line Diff line number Diff line Long: proxy-header Long: proxy-header Arg: <header> Arg: <header/@file> Help: Pass custom header LINE to proxy Help: Pass custom header(s) to proxy Protocols: HTTP Protocols: HTTP Added: 7.37.0 Added: 7.37.0 --- --- Loading @@ -17,4 +17,8 @@ up for you. Headers specified with this option will not be included in requests that curl Headers specified with this option will not be included in requests that curl knows will not be sent to a proxy. knows will not be sent to a proxy. Starting in 7.55.0, this option can take an argument in @filename style, which then adds a header for each line in the input file. Using @- will make curl read the header file from stdin. This option can be used multiple times to add/replace/remove multiple headers. This option can be used multiple times to add/replace/remove multiple headers.
src/tool_getparam.c +36 −6 Original line number Original line Diff line number Diff line Loading @@ -1602,12 +1602,42 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ break; break; case 'H': case 'H': /* A custom header to append to a list */ /* A custom header to append to a list */ if(nextarg[0] == '@') { /* read many headers from a file or stdin */ char *string; size_t len; bool use_stdin = !strcmp(&nextarg[1], "-"); FILE *file = use_stdin?stdin:fopen(&nextarg[1], FOPEN_READTEXT); if(!file) warnf(global, "Failed to open %s!\n", &nextarg[1]); else { if(PARAM_OK == file2memory(&string, &len, file)) { /* Allow strtok() here since this isn't used threaded */ /* !checksrc! disable BANNEDFUNC 2 */ char *h = strtok(string, "\r\n"); while(h) { if(subletter == 'p') /* --proxy-header */ err = add2list(&config->proxyheaders, h); else err = add2list(&config->headers, h); if(err) return err; h = strtok(NULL, "\r\n"); } free(string); } if(!use_stdin) fclose(file); } } else { if(subletter == 'p') /* --proxy-header */ if(subletter == 'p') /* --proxy-header */ err = add2list(&config->proxyheaders, nextarg); err = add2list(&config->proxyheaders, nextarg); else else err = add2list(&config->headers, nextarg); err = add2list(&config->headers, nextarg); if(err) if(err) return err; return err; } break; break; case 'i': case 'i': config->include_headers = toggle; /* include the headers as well in the config->include_headers = toggle; /* include the headers as well in the Loading