cURL / Mailing Lists / curl-users / Single Mail

curl-users

Handling MultiPart response in CURL

From: Prashant Pharate <prashantpharate_at_gmail.com>
Date: Fri, 18 Jul 2014 15:39:30 +0530

I found this http://curl.haxx.se/mail/lib-2011-11/0290.html
and its mentioned there ibcurl does not support parsing of
multipart/mixed responses

I didn't find any link where CURL handles MultiPart response
I execute CURL from command prompt and I am not using c or php or any
other.

On Fri, Jul 18, 2014 at 3:30 PM, <curl-users-request_at_cool.haxx.se> wrote:

> Send curl-users mailing list submissions to
> curl-users_at_cool.haxx.se
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
> or, via email, send a message with subject or body 'help' to
> curl-users-request_at_cool.haxx.se
>
> You can reach the person managing the list at
> curl-users-owner_at_cool.haxx.se
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of curl-users digest..."
>
>
> Today's Topics:
>
> 1. Handling MultiPart response in CURL (Prashant Pharate)
> 2. [RELEASE] curl and libcurl 7.37.1 (Daniel Stenberg)
> 3. Inconsistent request with dubious return code (gilles)
> 4. Re: Handling MultiPart response in CURL (Dan Fandrich)
> 5. Re: Handling MultiPart response in CURL (Prashant Pharate)
> 6. Re: Handling MultiPart response in CURL (Dan Fandrich)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 17 Jul 2014 15:43:08 +0530
> From: Prashant Pharate <prashantpharate_at_gmail.com>
> To: curl-users_at_cool.haxx.se
> Subject: Handling MultiPart response in CURL
> Message-ID:
> <
> CAEK_uuoteaSwQ+nV9sbu9Cew-APPxz7BhEhX4ytmZv6ZsCJgmg_at_mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi,
>
> I have requirement. I will send 2 files in
> com.sun.jersey.multipart.MultiPart BodyPart and will add multiPart object
> in response
>
> My question is how I will get files from the response using CURL
>
> My curl version is curl 7.19.7 (powerpc-ibm-aix5.3.0.0) libcurl/7.19.7
> OpenSSL/0.9.8r
>
> Protocols: tftp ftp telnet dict http file https ftps
>
> Features: IPv6 Largefile NTLM SSL
>
> --
> *Regards,*
> *Prashant Pharate*
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://cool.haxx.se/pipermail/curl-users/attachments/20140717/c4feb251/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Wed, 16 Jul 2014 16:42:27 +0200 (CEST)
> From: Daniel Stenberg <daniel_at_haxx.se>
> To: Curl Announce -- curl users <curl-users_at_cool.haxx.se>,
> curl-announce_at_cool.haxx.se, libcurl hacking
> <curl-library_at_cool.haxx.se>
> Subject: [RELEASE] curl and libcurl 7.37.1
> Message-ID: <alpine.DEB.2.00.1407161641150.32653_at_tvnag.unkk.fr>
> Content-Type: text/plain; charset="iso-8859-2"; Format="flowed"
>
> Hello!
>
> I'm happy to announce than I've just published a new release on the web
> site,
> the 7.37.1 version.
>
> Enjoy!
>
> Curl and libcurl 7.37.1
>
> Public curl releases: 140
> Command line options: 162
> curl_easy_setopt() options: 208
> Public functions in libcurl: 58
> Contributors: 1155
>
> This release includes the following changes:
>
> o bits.close: introduce connection close tracking
> o darwinssl: Add support for --cacert
> o polarssl: add ALPN support
> o docs: Added new option man pages
>
> This release includes the following bugfixes:
>
> o build: Fixed incorrect reference to curl_setup.h in Visual Studio files
> o build: Use $(TargetDir) and $(TargetName) macros for .pdb and .lib
> output
> o curl.1: clarify that -u can't specify a user with colon [1]
> o openssl: Fix uninitialized variable use in NPN callback
> o curl_easy_reset: reset the URL [2]
> o curl_version_info.3: returns a pointer to a static struct
> o url-parser: only use if_nametoindex if detected by configure [3]
> o select: with winsock, avoid passing unsupported arguments to select()
> [4]
> o gnutls: don't use deprecated type names anymore
> o gnutls: allow building with nghttp2 but without ALPN support
> o tests: Fix portability issue with the tftpd server
> o curl_sasl_sspi: Fixed corrupt hostname in DIGEST-MD5 SPN
> o curl_sasl: extended native DIGEST-MD5 cnonce to be a 32-byte hex string
> o random: use Curl_rand() for proper random data [5]
> o Curl_ossl_init: call OPENSSL_config for initing engines [6]
> o config-win32.h: Updated for VC12 [7]
> o winbuild: Don't USE_WINSSL when WITH_SSL is being used
> o getinfo: HTTP CONNECT code not reset between transfers [8]
> o Curl_rand: Use a fake entropy for debug builds when CURL_ENTROPY set
> o http2: avoid segfault when using the plain-text http2
> o conncache: move the connection counter to the cache struct
> o http2: better return code error checking
> o curlbuild: fix GCC build on SPARC systems without configure script
> o tool_metalink: Support polarssl as digest provider
> o curl.h: reverse the enum/define setup for old symbols
> o curl.h: moved two really old deprecated symbols
> o curl.h: renamed CURLOPT_DEPRECATEDx to CURLOPT_OBSOLETEx
> o buildconf: do not search tools in current directory.
> o OS400: make it compilable again. Make RPG binding up to date
> o nss: do not abort on connection failure (failing tests 305 and 404)
> o nss: make the fallback to SSLv3 work again
> o tool: prevent valgrind from reporting possibly lost memory (nss only)
> o progress callback: skip last callback update on errors [9]
> o nss: fix a memory leak when CURLOPT_CRLFILE is used
> o compiler warnings: potentially uninitialized variables [10]
> o url.c: Fixed memory leak on OOM
> o gnutls: ignore invalid certificate dates with VERIFYPEER disabled
> o gnutls: fix SRP support with versions of GnuTLS from 2.99.0
> o gnutls: fixed a couple of uninitialized variable references
> o gnutls: fixed compilation against versions < 2.12.0
> o build: Fixed overridden compiler PDB settings in VC7 to VC12
> o ntlm_wb: Fixed buffer size not being large enough for NTLMv2 sessions
> [11]
> o netrc: don't abort if home dir cannot be found
> o netrc: fixed thread safety problem by using getpwuid_r if available
> o cookie: avoid mutex deadlock [12]
> o configure: respect host tool prefix for krb5-config
> o gnutls: handle IP address in cert name check
>
> This release includes the following known bugs:
>
> o see docs/KNOWN_BUGS (http://curl.haxx.se/docs/knownbugs.html)
>
> This release would not have looked like this without help, code, reports
> and
> advice from friends like these:
>
> Alessandro Ghedini, Brad Spencer, Chris Young, Colin Hogben, Dan
> Fandrich,
> Daniel Stenberg, David Woodhouse, Dimitrios Siganos, Fabian Frank,
> Glen A Johnson Jr., Hubert Kario, Jeff Pohlmeyer, Jonathan Cardoso
> Machado,
> Kamil Dudka, Lindley French, Marcel Raad, Michał Górny, Nick Zitzmann,
> Patrick Monnerat, Ray Satiro, Steve Holme, Tatsuhiro Tsujikawa,
> Vilmos Nebehaj, Yousuke Kimoto, Dmitry Falko
>
> Thanks! (and sorry if I forgot to mention someone)
>
> References to bug reports and discussions on issues:
>
> [1] = http://curl.haxx.se/bug/view.cgi?id=1375
> [2] = http://curl.haxx.se/mail/lib-2014-05/0235.html
> [3] = http://curl.haxx.se/mail/lib-2014-05/0260.html
> [4] = http://curl.haxx.se/mail/lib-2014-05/0278.html
> [5] = http://curl.haxx.se/mail/lib-2014-06/0001.html
> [6] = http://curl.haxx.se/mail/lib-2014-06/0003.html
> [7] = http://curl.haxx.se/bug/view.cgi?id=1378
> [8] = http://curl.haxx.se/bug/view.cgi?id=1380
> [9] = http://curl.haxx.se/mail/lib-2014-06/0062.html
> [10] = http://curl.haxx.se/bug/view.cgi?id=1391
> [11] = http://curl.haxx.se/mail/lib-2014-07/0103.html
> [12] = http://curl.haxx.se/mail/lib-2014-02/0184.html
>
> --
>
> / daniel.haxx.se
>
> ------------------------------
>
> Message: 3
> Date: Thu, 17 Jul 2014 12:13:52 -0400
> From: "gilles" <g1201_at_myriade.ca>
> To: curl-users_at_cool.haxx.se
> Subject: Inconsistent request with dubious return code
> Message-ID: <20140717153815.M4391_at_riq.qc.ca>
> Content-Type: text/plain; charset=iso-8859-1
>
>
> I was testing an upload to a FTP server under the same file name,
> such as:
>
> curl -T uploadfile -u user:passwd ftp://ftp.upload.com/
>
> But I mistakenly wrote -O instead of -T.
>
> So my request is inconsistent because -O is for a download and
> I specified no file name.
>
> I got "Remote file name has no length!" which is ok.
>
> And curl returned a directory listing instead [should programs
> interpret an incorrectly formed request?].
>
> But the return code is 0!
>
> I would definitely expect to have a meaningful return code
> in this case, because the intended action was not achieved.
>
> ~ Gilles
>
>
>
> ------------------------------
>
> Message: 4
> Date: Thu, 17 Jul 2014 23:15:59 +0200
> From: Dan Fandrich <dan_at_coneharvesters.com>
> To: curl-users_at_cool.haxx.se
> Subject: Re: Handling MultiPart response in CURL
> Message-ID: <20140717211559.GC4197_at_coneharvesters.com>
> Content-Type: text/plain; charset=iso-8859-1
>
> On Thu, Jul 17, 2014 at 03:43:08PM +0530, Prashant Pharate wrote:
> > I have requirement. I will send 2 files in
> com.sun.jersey.multipart.MultiPart
> > BodyPart and will add multiPart object in response
> >
> > My question is how I will get files from the response using CURL
>
> curl will provide the same data to the client as was sent by the server.
> It's up to the client application to perform any processing of that
> response,
> which includes splitting a multipart/form-data or other MIME-style
> multipart
> response.
>
> >>> Dan
>
>
> ------------------------------
>
> Message: 5
> Date: Fri, 18 Jul 2014 14:28:33 +0530
> From: Prashant Pharate <prashantpharate_at_gmail.com>
> To: curl-users_at_cool.haxx.se
> Subject: Re: Handling MultiPart response in CURL
> Message-ID:
> <CAEK_uuqZt0MT5vxDjajLi9Y60xB2HRPqK=
> XT7QDytePWCo7OQA_at_mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> On Thu, Jul 17, 2014 at 03:43:08PM +0530, Prashant Pharate wrote:
> *> I have requirement. I will send 2 files in
> com.sun.jersey.multipart.MultiPart *
> *> BodyPart and will add multiPart object in response *
> *> *
> *> My question is how I will get files from the response using CURL *
>
> curl will provide the same data to the client as was sent by the server.
> It's up to the client application to perform any processing of that
> response,
> which includes splitting a multipart/form-data or other MIME-style
> multipart
> response.
>
> *>>> Dan *
>
> *Problem is how to split multipart response.*
>
> Added files in BodyParts---I tried following
>
> curl -o sal.htm -o sal.pdf
>
> But pdf garbage data get mix with html file
>
> Please share if you have example
>
>
>
>
> On Thu, Jul 17, 2014 at 3:43 PM, Prashant Pharate <
> prashantpharate_at_gmail.com
> > wrote:
>
> > Hi,
> >
> > I have requirement. I will send 2 files in
> > com.sun.jersey.multipart.MultiPart BodyPart and will add multiPart
> object
> > in response
> >
> > My question is how I will get files from the response using CURL
> >
> > My curl version is curl 7.19.7 (powerpc-ibm-aix5.3.0.0) libcurl/7.19.7
> > OpenSSL/0.9.8r
> >
> > Protocols: tftp ftp telnet dict http file https ftps
> >
> > Features: IPv6 Largefile NTLM SSL
> >
> > --
> > *Regards,*
> > *Prashant Pharate*
> >
>
>
>
> --
> *Regards,*
> *Prashant Pharate*
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://cool.haxx.se/pipermail/curl-users/attachments/20140718/f3f9f93a/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 6
> Date: Fri, 18 Jul 2014 11:31:38 +0200
> From: Dan Fandrich <dan_at_coneharvesters.com>
> To: curl-users_at_cool.haxx.se
> Subject: Re: Handling MultiPart response in CURL
> Message-ID: <20140718093138.GA15221_at_coneharvesters.com>
> Content-Type: text/plain; charset=iso-8859-1
>
> On Fri, Jul 18, 2014 at 02:28:33PM +0530, Prashant Pharate wrote:
> > Problem is how to split multipart response.
> >
> > Added files in BodyParts---I tried following
> >
> > curl -o sal.htm -o sal.pdf
> >
> > But pdf garbage data get mix with html file
>
> Right, that's how multipart works.
>
> > Please share if you have example
>
> I suggest you search for a library to handle it for you. See for example
> this question
>
> http://stackoverflow.com/questions/2265038/is-there-a-lightweight-multipart-form-data-parser-in-c-or-c
> or this one
> http://stackoverflow.com/questions/218089/simple-c-mime-parser
> or many other online suggestions. I don't recall anyone suggesting one in
> particular on this list, but if you find a good one, listing it on
> http://curl.haxx.se/libcurl/relatedlibs.html would be a great idea.
>
> >>> Dan
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> curl-users mailing list
> curl-users_at_cool.haxx.se
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
>
>
> ------------------------------
>
> End of curl-users Digest, Vol 107, Issue 4
> ******************************************
>

-- 
*Regards,*
*Prashant Pharate*

-------------------------------------------------------------------
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
Received on 2014-07-18