Martin Maurer | 1 Jun 2011 13:12
Picon

curl (on Windows Vista 64 Bit edition) does only write partial file when doing download via redirect

Hello,
 
i am using
 
curl 7.21.6 (i386-pc-win32) libcurl/7.21.6 zlib/1.2.5
Protocols: dict file ftp gopher http imap ldap pop3 rtsp smtp telnet tftp
Features: AsynchDNS IPv6 Largefile libz
 
on Windows Vista 64 Bit edition.
 
I am calling curl as following:
 
once
 
 
and later multiple times
 
fc hijk.org hijk.js
 
I downloaded file hijk.js is equal to original file, i do the second url call again (i do this via batch file).
 
Around every two hours i see that hijk.js is a bit too small. curl itself reports the amount of bytes, which the original file had.
The written content seems to be on a 4 KByte (not completely sure, but at least on a 1 KByte boundary).
The last pieces from boundary to end of file is missing. It looks like writing to stdout which is redirected to hijk.js is not yet complete, when file compare is done.
According to wireshark it looks like the file was completely downloaded, with no error, also the last missing content is displayed as correctly transfered.
This leads me to the opinion, that something on PC side is not working.
 
Is there perhaps a flush missing ?
 
I am currently trying the following call instead:
 
curl -D log -o hijk.js -v -S http://192.168.178.145/ab/cde/fg/hijk.js
 
and the error has not occured yet. But it is too early to say, this way, it is working.
 
Best regards,
 
Martin
 
 
 
 
 
 
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Daniel Stenberg | 1 Jun 2011 13:35
Picon
Favicon
Gravatar

Re: curl (on Windows Vista 64 Bit edition) does only write partial file when doing download via redirect

On Wed, 1 Jun 2011, Martin Maurer wrote:

> Around every two hours i see that hijk.js is a bit too small. curl itself 
> reports the amount of bytes, which the original file had. The written 
> content seems to be on a 4 KByte (not completely sure, but at least on a 1 
> KByte boundary). The last pieces from boundary to end of file is missing. It 
> looks like writing to stdout which is redirected to hijk.js is not yet 
> complete, when file compare is done. According to wireshark it looks like 
> the file was completely downloaded, with no error, also the last missing 
> content is displayed as correctly transfered. This leads me to the opinion, 
> that something on PC side is not working.
>
> Is there perhaps a flush missing ?

Since curl exits when done, all file handles are flushed automatically.

You can use --trace-ascii or similar to see exactly what curl has received.

In Windows land, lots of the stuff that is related to files and filesystems 
are a bit peculiar so it wouldn't at all surprise me if there at times could 
be so that the kernel hasn't yet completely finished writing all the data to 
the file when you try to read it. Possibly you should add a short pause 
between the curl invoke and the use of the file.

--

-- 

  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html

zin tun kyaw | 2 Jun 2011 09:14
Picon

how to get "--data " and "-T" value from curl at the same time in a method

hi,
   I have a method to upload a file. 
   This the method below.
   "directory" variable and contents are for file "-T" to upload.
   "data" variable is for "--data" for "metadata".
 
This is my curl command
  curl -T C:\Users\a.jpg --data " { "metadata" : "username":"name"} -H "Content-Type:application/.." http://localhost:8080/user/folder/a.jpg -v

But I can't get the "--data" values from data variable.How can i do that?
 
  <at> PUT
    <at> Path("/{container:.+}")
    <at> Consumes(MediaTypes.DataObject)
    <at> Produces(MediaTypes.DataObject)
    public Response doputDataObject( <at> PathParam("container")String directory,byte[]contents,String data) throws IOException, Exception
    {
        ...........
        if(bool==true){
           return Response.ok().header("X-CDMI-Specification", "1.0").build();
        }else{
            return Response.status(Response.Status.BAD_REQUEST).build();
        }

 

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Daniel Stenberg | 2 Jun 2011 22:14
Picon
Favicon
Gravatar

Re: how to get "--data " and "-T" value from curl at the same time in a method

On Thu, 2 Jun 2011, zin tun kyaw wrote:

>  curl -T C:\Users\a.jpg --data " { "metadata" : "username":"name"} -H
> "Content-Type:application/.." http://localhost:8080/user/folder/a.jpg -v
>
> *But I can't get the "--data" values from data variable.How can i do that?*

You can't. You can only use -T _or_ --data. For a HTTP URL, -T makes a PUT and 
--data makes a POST.

But to do PUT and get data from two sources, you can do something like this:

  curl -X PUT --data  <at> file --data "metadata" ...

but that will append a & in there that I don't think you'll like.

--

-- 

  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html

zin tun kyaw | 3 Jun 2011 02:56
Picon

Re: how to get "--data " and "-T" value from curl at the same time in a method

hi daniel,
 
     how about i used --upload-file with data ?
    It is also same with -T and --data.
    If i can use how to get --upload-file value from curl in web service method and how to set that into variable.

 curl --upload-file C:\Users\a.jpg --data " { "metadata" : "username":"name"} -H
"Content-Type:application/.." http://localhost:8080/user/folder/a.jpg -v


thanks.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Daniel Stenberg | 4 Jun 2011 00:17
Picon
Favicon
Gravatar

Re: how to get "--data " and "-T" value from curl at the same time in a method

On Fri, 3 Jun 2011, zin tun kyaw wrote:

>     how about i used --upload-file with data ?

--upload-file and -T is the same option, just with two different names. See 
the man page.

--

-- 

  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Richard Silverman | 6 Jun 2011 22:42
Gravatar

inappropriate GSSAPI delegation

Hello,

I'm writing to report a security bug in curl, which probably should not go
to the general list.  How should I go about this?

Thanks,

--

-- 
   Richard E. Silverman
   res <at> qoxp.net
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Daniel Stenberg | 6 Jun 2011 22:49
Picon
Favicon
Gravatar

Re: inappropriate GSSAPI delegation

On Mon, 6 Jun 2011, Richard Silverman wrote:

> I'm writing to report a security bug in curl, which probably should not go 
> to the general list.  How should I go about this?

Hi Richard,

Thanks for asking and wanting to help us out. To report security issues, 
please email "curl-security at haxx.se". That's a list of trusted project team 
members, as we prefer to first work out the details and level of the problem 
in private so that we can release a fix and security alert at the same time 
(if necessary) to reduce the impact for our millions of users.

This is mentioned, and our previous vulnerability reports are collected here:
http://curl.haxx.se/docs/security.html

--

-- 

  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Emerson Espínola | 7 Jun 2011 03:27
Picon

Using curl to send/receive email through Hotmail

Hi.

Is that possible to use curl lib to send and receive emails through my hotmail account? In other words, if I want to write a simple email client that uses my hotmail account to send and receive emails, is that possible to use curl to do that?

If so, what should I do?

[]'s
Emerson de Lira Espínola
 


-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Daniel Stenberg | 7 Jun 2011 22:46
Picon
Favicon
Gravatar

Re: Using curl to send/receive email through Hotmail

On Mon, 6 Jun 2011, Emerson Espínola wrote:

> Is that possible to use curl lib to send and receive emails through my 
> hotmail account? In other words, if I want to write a simple email client 
> that uses my hotmail account to send and receive emails, is that possible to 
> use curl to do that?
>
> If so, what should I do?

Yes it is possible. It can involve little to a lot of hard work. Start here:

 	http://curl.haxx.se/docs/httpscripting.html

--

-- 

  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Gmane