aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-10-27 21:02:01 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-10-27 21:02:01 +0000
commit6f8fe67ace4346c3c22fb3348d54ba1cfeb59669 (patch)
tree3f8ea1726d3eee88c679d727e1039b7f1db8c508 /src
parentd49edc8e095ab45c7c9b2377f9111d84c32550ca (diff)
tommink[at]post.pl reported in bug report #1337723
(http://curl.haxx.se/bug/view.cgi?id=1337723) that curl could not upload binary data from stdin on Windows if the data contained control-Z (hex 1a) since that is treated as end-of-file when read in text mode. Gisle Vanem pointed out the fix, and I made both -T and --data-binary take advantage of it.
Diffstat (limited to 'src')
-rw-r--r--src/main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index cd42b0d06..33200cea0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1797,8 +1797,13 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
nextarg++; /* pass the @ */
- if(curlx_strequal("-", nextarg))
+ if(curlx_strequal("-", nextarg)) {
file = stdin;
+#ifdef O_BINARY
+ if(subletter == 'b') /* forced binary */
+ setmode(fileno(stdin), O_BINARY);
+#endif
+ }
else {
file = fopen(nextarg, "rb");
if(!file)
@@ -3620,6 +3625,9 @@ operate(struct Configurable *config, int argc, char *argv[])
}
else if(uploadfile && curlx_strequal(uploadfile, "-")) {
+#ifdef O_BINARY
+ setmode(fileno(stdin), O_BINARY);
+#endif
infd = stdin;
}