cURL / Mailing Lists / curl-library / Single Mail

curl-library

Question about getting file size

From: hui <lixiaohui9219_at_126.com>
Date: Tue, 21 Feb 2012 20:43:59 +0800

Hi,

If the server does not response with "Content-Length",
How I can get the file size using Libcurl ( Http 1.1, Content-type:application/octel-binary )?

Thanks!

----- Original Message -----

From: <curl-library-request_at_cool.haxx.se>
To: <curl-library_at_cool.haxx.se>
Sent: Monday, December 19, 2011 9:17 PM
Subject: curl-library Digest, Vol 76, Issue 37

> Send curl-library mailing list submissions to
> curl-library_at_cool.haxx.se
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-library
> or, via email, send a message with subject or body 'help' to
> curl-library-request_at_cool.haxx.se
>
> You can reach the person managing the list at
> curl-library-owner_at_cool.haxx.se
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of curl-library digest..."
>
>
> Today's Topics:
>
> 1. RE: Cancelling Mail Request (Nazim Oztahtaci)
> 2. RE: Cancelling Mail Request (Nazim Oztahtaci)
> 3. Progress function for FTP upload is called always with
> ultotal set to -1 (Marcin Adamski)
> 4. RE: Cancelling Mail Request (Daniel Stenberg)
> 5. RE: Cancelling Mail Request (Nazim Oztahtaci)
> 6. Setting Local Directory for an ftpget (SuperWare Support)
> 7. Re: Setting Local Directory for an ftpget (Daniel Stenberg)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 19 Dec 2011 11:05:09 +0000
> From: Nazim Oztahtaci <nazim_oztahtaci_at_hotmail.com>
> To: <curl-library_at_cool.haxx.se>
> Subject: RE: Cancelling Mail Request
> Message-ID: <SNT121-W366875B6699BB13627BDA196A70_at_phx.gbl>
> Content-Type: text/plain; charset="windows-1254"
>
>
> Thanks. I will try it and will see if it works.
>
> Kind regards
>
>> From: steve_holme_at_hotmail.com
>> To: curl-library_at_cool.haxx.se
>> Subject: RE: Cancelling Mail Request
>> Date: Mon, 19 Dec 2011 10:00:47 +0000
>>
>> Hi Nazim,
>>
>> > In my Smtp module, I send email requests recursively but randomly
>> > I would like to send Cancel mail request so if there is any email
>> > request which is being processed by cUrl, that should be cancelled
>> > and not delivered to Mail server. I have implemented a solution and
>> > I remove the handler in the middle of process but still in mail server,
>> > I receive empty emails because some header data is being sent by
>> > cUrl anyway. Is there any way in cUrl to cancel one mail request
>> > using smtp services? Kind of a clean up message or request which
>> > can be sent to Mail server by cUrl so we dont even receive an empty
>> > email.
>>
>> You should be able to return CURL_READFUNC_ABORT in your read function.
>>
>> If my understanding of the connection layer is correct this should close
>> down the connection but not send the QUIT command to the server. As such,
>> the server should then ignore any header / body content that may have been
>> sent to it.
>>
>> Kind Regards
>>
>> Steve
>>
>>
>>
>>
>> -------------------------------------------------------------------
>> List admin: http://cool.haxx.se/list/listinfo/curl-library
>> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://cool.haxx.se/pipermail/curl-library/attachments/20111219/8e62927a/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 19 Dec 2011 11:51:02 +0000
> From: Nazim Oztahtaci <nazim_oztahtaci_at_hotmail.com>
> To: <curl-library_at_cool.haxx.se>
> Subject: RE: Cancelling Mail Request
> Message-ID: <SNT121-W4863EE67A1904F914DF59496A70_at_phx.gbl>
> Content-Type: text/plain; charset="windows-1254"
>
>
> Actually when I read about this functionality on the previous implementations, I see that it is close to what we are doing. When I look the packages from Wireshark, I see that when we do not send any QUIT message to server, we close the connection in the middle and as I know if that happens Smtp server should skip this mail request. Am I right?
>
>> From: steve_holme_at_hotmail.com
>> To: curl-library_at_cool.haxx.se
>> Subject: RE: Cancelling Mail Request
>> Date: Mon, 19 Dec 2011 10:00:47 +0000
>>
>> Hi Nazim,
>>
>> > In my Smtp module, I send email requests recursively but randomly
>> > I would like to send Cancel mail request so if there is any email
>> > request which is being processed by cUrl, that should be cancelled
>> > and not delivered to Mail server. I have implemented a solution and
>> > I remove the handler in the middle of process but still in mail server,
>> > I receive empty emails because some header data is being sent by
>> > cUrl anyway. Is there any way in cUrl to cancel one mail request
>> > using smtp services? Kind of a clean up message or request which
>> > can be sent to Mail server by cUrl so we dont even receive an empty
>> > email.
>>
>> You should be able to return CURL_READFUNC_ABORT in your read function.
>>
>> If my understanding of the connection layer is correct this should close
>> down the connection but not send the QUIT command to the server. As such,
>> the server should then ignore any header / body content that may have been
>> sent to it.
>>
>> Kind Regards
>>
>> Steve
>>
>>
>>
>>
>> -------------------------------------------------------------------
>> List admin: http://cool.haxx.se/list/listinfo/curl-library
>> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://cool.haxx.se/pipermail/curl-library/attachments/20111219/bcbe20cf/attachment-0001.html>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 19 Dec 2011 12:59:14 +0100
> From: Marcin Adamski <mass85_at_tlen.pl>
> To: curl-library_at_cool.haxx.se
> Subject: Progress function for FTP upload is called always with
> ultotal set to -1
> Message-ID: <701ba41.42cf891e.4eef2712.5a172_at_tlen.pl>
> Content-Type: text/plain; charset="UTF-8"
>
> I'm using multi interface of libcurl 7.23.1. Whenever I configure FTP in order to resume interrupted upload (CURLOPT_UPLOAD = 1, CURLOPT_RESUME_FROM = -1, CURLOPT_APPEND = -1), progress function is called with total number of bytes to upload(ultotal) set to -1.
>
> Couldn't it provide the number of remaining to transfer bytes? Without this number I can not estimate progress of whole file transfer, because I don't know how much data FTP server really recieved during previous, interrupted transfer.
>
> Marcin Adamski
>
>
>
> ------------------------------
>
> Message: 4
> Date: Mon, 19 Dec 2011 13:11:34 +0100 (CET)
> From: Daniel Stenberg <daniel_at_haxx.se>
> To: libcurl development <curl-library_at_cool.haxx.se>
> Subject: RE: Cancelling Mail Request
> Message-ID: <alpine.DEB.2.00.1112191308130.25106_at_tvnag.unkk.fr>
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>
> On Mon, 19 Dec 2011, Nazim Oztahtaci wrote:
>
>> Actually when I read about this functionality on the previous
>> implementations, I see that it is close to what we are doing. When I look
>> the packages from Wireshark, I see that when we do not send any QUIT message
>> to server, we close the connection in the middle and as I know if that
>> happens Smtp server should skip this mail request. Am I right?
>
> I wouldn't be surprised if there are servers who would send it off anyway, but
> the SMTP spec in RFC 2821 section 4.1.1.10 for QUIT is quite clear:
>
> The sender MUST NOT intentionally close the transmission
> channel until it sends a QUIT command and SHOULD wait until it
> receives the reply (even if there was an error response to a previous
> command). If the connection is closed prematurely due to violations
> of the above or system or network failure, the server MUST cancel any
> pending transaction
>
> --
>
> / daniel.haxx.se
>
>
> ------------------------------
>
> Message: 5
> Date: Mon, 19 Dec 2011 12:37:40 +0000
> From: Nazim Oztahtaci <nazim_oztahtaci_at_hotmail.com>
> To: <curl-library_at_cool.haxx.se>
> Subject: RE: Cancelling Mail Request
> Message-ID: <SNT121-W59159954FB016078D8925996A70_at_phx.gbl>
> Content-Type: text/plain; charset="windows-1254"
>
>
> Yes. I tested two different servers actually. One of them is really basic so I dont care it that much but another server, SmarterMail is more professional edition and it sends it emails anyway as you said. I will look this in more deeply and inform you about if there is an alternative solution independent from cUrl.
>
> Thanks for your quick answers all
>
>> Date: Mon, 19 Dec 2011 13:11:34 +0100
>> From: daniel_at_haxx.se
>> To: curl-library_at_cool.haxx.se
>> Subject: RE: Cancelling Mail Request
>>
>> On Mon, 19 Dec 2011, Nazim Oztahtaci wrote:
>>
>> > Actually when I read about this functionality on the previous
>> > implementations, I see that it is close to what we are doing. When I look
>> > the packages from Wireshark, I see that when we do not send any QUIT message
>> > to server, we close the connection in the middle and as I know if that
>> > happens Smtp server should skip this mail request. Am I right?
>>
>> I wouldn't be surprised if there are servers who would send it off anyway, but
>> the SMTP spec in RFC 2821 section 4.1.1.10 for QUIT is quite clear:
>>
>> The sender MUST NOT intentionally close the transmission
>> channel until it sends a QUIT command and SHOULD wait until it
>> receives the reply (even if there was an error response to a previous
>> command). If the connection is closed prematurely due to violations
>> of the above or system or network failure, the server MUST cancel any
>> pending transaction
>>
>> --
>>
>> / daniel.haxx.se
>> -------------------------------------------------------------------
>> List admin: http://cool.haxx.se/list/listinfo/curl-library
>> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://cool.haxx.se/pipermail/curl-library/attachments/20111219/036af9c3/attachment-0001.html>
>
> ------------------------------
>
> Message: 6
> Date: Mon, 19 Dec 2011 08:02:43 -0500
> From: "SuperWare Support" <thesupermanager_at_gmail.com>
> To: "'libcurl development'" <curl-library_at_cool.haxx.se>
> Subject: Setting Local Directory for an ftpget
> Message-ID: <01ab01ccbe4e$800acde0$802069a0$@gmail.com>
> Content-Type: text/plain; charset="us-ascii"
>
> All,
>
>
>
> I'm implementing an ftp get using libcurl. I searched the documentation,
> but couldn't find an option for setting the local directory to write the
> file to. Do I just have to issue a chdir to set the active directory before
> issuing the command? I know I could modify the file_is_comming callback
> function to set it to a static location, but I want to be able to have a
> variable location and wasn't sure how to get that into the callback
> function. Is there a setting that dictates this?
>
>
>
> Thanks,
>
> David
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://cool.haxx.se/pipermail/curl-library/attachments/20111219/38a4d3e0/attachment-0001.html>
>
> ------------------------------
>
> Message: 7
> Date: Mon, 19 Dec 2011 14:17:16 +0100 (CET)
> From: Daniel Stenberg <daniel_at_haxx.se>
> To: libcurl development <curl-library_at_cool.haxx.se>
> Subject: Re: Setting Local Directory for an ftpget
> Message-ID: <alpine.DEB.2.00.1112191415220.25106_at_tvnag.unkk.fr>
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>
> On Mon, 19 Dec 2011, SuperWare Support wrote:
>
>> I'm implementing an ftp get using libcurl. I searched the documentation,
>> but couldn't find an option for setting the local directory to write the
>> file to.
>
> This sounds like you've not really looked into the documentation. libcurl
> won't save to any file name at all, you never provide that. You take care of
> the saving basically. Have a look at this example:
>
> http://curl.haxx.se/libcurl/c/ftpget.html
>
>> I know I could modify the file_is_comming callback function to set it to a
>> static location
>
> Why would you have it static if you want to have it changeable? Just change it
> as you like!
>
> --
>
> / daniel.haxx.se
>
>
> ------------------------------
>
> _______________________________________________
> curl-library mailing list
> curl-library_at_cool.haxx.se
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-library
>
>
> End of curl-library Digest, Vol 76, Issue 37
> ********************************************
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-02-21