mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
-D now stores all headers to the same file if multiple URLs are given on the
command line!
This commit is contained in:
parent
9ef9797998
commit
71f4c05665
30
src/main.c
30
src/main.c
@ -2125,6 +2125,18 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
|
|
||||||
urlnode = config->url_list;
|
urlnode = config->url_list;
|
||||||
|
|
||||||
|
if(config->headerfile) {
|
||||||
|
/* open file for output: */
|
||||||
|
if(strcmp(config->headerfile,"-")) {
|
||||||
|
heads.filename = config->headerfile;
|
||||||
|
headerfilep=NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
headerfilep=stdout;
|
||||||
|
heads.stream = headerfilep;
|
||||||
|
heads.config = config;
|
||||||
|
}
|
||||||
|
|
||||||
/* loop through the list of given URLs */
|
/* loop through the list of given URLs */
|
||||||
while(urlnode) {
|
while(urlnode) {
|
||||||
|
|
||||||
@ -2291,18 +2303,6 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
config->resume_from_current) {
|
config->resume_from_current) {
|
||||||
config->resume_from = -1; /* -1 will then force get-it-yourself */
|
config->resume_from = -1; /* -1 will then force get-it-yourself */
|
||||||
}
|
}
|
||||||
if(config->headerfile) {
|
|
||||||
/* open file for output: */
|
|
||||||
if(strcmp(config->headerfile,"-")) {
|
|
||||||
heads.filename = config->headerfile;
|
|
||||||
headerfilep=NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
headerfilep=stdout;
|
|
||||||
heads.stream = headerfilep;
|
|
||||||
heads.config = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(outs.stream && isatty(fileno(outs.stream)) &&
|
if(outs.stream && isatty(fileno(outs.stream)) &&
|
||||||
!(config->conf&(CONF_UPLOAD|CONF_HTTPPOST)))
|
!(config->conf&(CONF_UPLOAD|CONF_HTTPPOST)))
|
||||||
/* we send the output to a tty and it isn't an upload operation,
|
/* we send the output to a tty and it isn't an upload operation,
|
||||||
@ -2512,9 +2512,6 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
fprintf(config->errors, "curl: (%d) %s\n", res, errorbuffer);
|
fprintf(config->errors, "curl: (%d) %s\n", res, errorbuffer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(config->headerfile && !headerfilep && heads.stream)
|
|
||||||
fclose(heads.stream);
|
|
||||||
|
|
||||||
if (outfile && !strequal(outfile, "-") && outs.stream)
|
if (outfile && !strequal(outfile, "-") && outs.stream)
|
||||||
fclose(outs.stream);
|
fclose(outs.stream);
|
||||||
|
|
||||||
@ -2568,6 +2565,9 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
|
|
||||||
} /* while-loop through all URLs */
|
} /* while-loop through all URLs */
|
||||||
|
|
||||||
|
if(config->headerfile && !headerfilep && heads.stream)
|
||||||
|
fclose(heads.stream);
|
||||||
|
|
||||||
if(allocuseragent)
|
if(allocuseragent)
|
||||||
free(config->useragent);
|
free(config->useragent);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user