cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: POST binary files using curl for windows

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 27 Mar 2002 23:13:13 +0100 (MET)

On Wed, 27 Mar 2002, Pedro Neves wrote:

> But on Windows, it seems just to transmit part of the file (2Kb). I tested
> to send a text file (2Mb) using the following command and it works great:

> curl -# --data-binary @manual.txt https://16.152.1.29/tanga2.asp

> I am using a Windows2k and the latest cURL (7.9.5) submitted by Jörn
> Hartroth. Do you know what could be the reason for this ?

I just had a look, and I believe I've found the reason: an fopen() without
the "b" for binary. This patch might do the trick (I can't test this myself,
I don't have a windows machine available):

diff -u -r1.120 main.c
--- src/main.c 19 Mar 2002 14:58:35 -0000 1.120
+++ src/main.c 27 Mar 2002 22:12:15 -0000
@@ -1225,7 +1225,7 @@
           if(strequal("-", nextarg))
             file = stdin;
           else
- file = fopen(nextarg, "r");
+ file = fopen(nextarg, "rb");

           if(subletter == 'b') /* forced binary */
             postdata = file2memory(file, &config->postfieldsize);

I appreciate if someone can test this and tell me if this fixes the
problem...

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-03-27