summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-01-03 08:07:29 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-01-03 08:07:29 +0000
commit128f34163581686b147db5e1c084c31d617fbe2c (patch)
tree77e33f483c50b671115272987bd296cc61205b70
parente48bc1be4806ee61fc3450b0ea3f53fa45e4d404 (diff)
downloadgnurl-128f34163581686b147db5e1c084c31d617fbe2c.tar.gz
gnurl-128f34163581686b147db5e1c084c31d617fbe2c.tar.bz2
gnurl-128f34163581686b147db5e1c084c31d617fbe2c.zip
Changed how -I/--head works when --include is also used... Test case 104
stopped working after the dec-20 fixes that now supports FTP operations to skip the transfer phase.
-rw-r--r--src/main.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 54ad587e1..696f7684f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1279,10 +1279,23 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
config->conf ^= CONF_HEADER; /* include the HTTP header as well */
break;
case 'I':
- config->conf ^= CONF_HEADER; /* include the HTTP header in the output */
- config->conf ^= CONF_NOBODY; /* don't fetch the body at all */
- if(SetHTTPrequest(HTTPREQ_HEAD, &config->httpreq))
- return PARAM_BAD_USE;
+ /*
+ * This is a bit tricky. We either SET both bits, or we clear both
+ * bits. Let's not make any other outcomes from this.
+ */
+ if((CONF_HEADER|CONF_NOBODY) !=
+ (config->conf&(CONF_HEADER|CONF_NOBODY)) ) {
+ /* one of them weren't set, set both */
+ config->conf |= (CONF_HEADER|CONF_NOBODY);
+ if(SetHTTPrequest(HTTPREQ_HEAD, &config->httpreq))
+ return PARAM_BAD_USE;
+ }
+ else {
+ /* both were set, clear both */
+ config->conf &= ~(CONF_HEADER|CONF_NOBODY);
+ if(SetHTTPrequest(HTTPREQ_GET, &config->httpreq))
+ return PARAM_BAD_USE;
+ }
break;
case 'K':
res = parseconfig(nextarg, config);