aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-05-03 09:47:25 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-05-03 09:47:25 +0000
commit71f4c0566537c087660dcf59044299d881d332e9 (patch)
tree04df42e92ff76d31e562db21532d8f0608cac047 /src
parent9ef97979985badcfd5bdc97055508e53ba54d6a0 (diff)
-D now stores all headers to the same file if multiple URLs are given on the
command line!
Diffstat (limited to 'src')
-rw-r--r--src/main.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/main.c b/src/main.c
index 452edcc7b..ff572205a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2125,6 +2125,18 @@ operate(struct Configurable *config, int argc, char *argv[])
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 */
while(urlnode) {
@@ -2291,18 +2303,6 @@ operate(struct Configurable *config, int argc, char *argv[])
config->resume_from_current) {
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)) &&
!(config->conf&(CONF_UPLOAD|CONF_HTTPPOST)))
/* 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);
#endif
- if(config->headerfile && !headerfilep && heads.stream)
- fclose(heads.stream);
-
if (outfile && !strequal(outfile, "-") && outs.stream)
fclose(outs.stream);
@@ -2568,6 +2565,9 @@ operate(struct Configurable *config, int argc, char *argv[])
} /* while-loop through all URLs */
+ if(config->headerfile && !headerfilep && heads.stream)
+ fclose(heads.stream);
+
if(allocuseragent)
free(config->useragent);