curl-users
Curl malloc fails
Date: Tue, 26 Jun 2012 18:43:34 +0300
Hi,
I'm trying to convince curl to do a "Transfer-Encoding: chunked" POST request. Here is what I tried so far:
1. "curl -N -d @- http://localhost:2004/test"
It doesn't work as expected, or I expect the wrong things :) -N stands for no-buffer. One would expect that the moment something is read from input (in our case stdin) to be automatically put on the output. Well, that doesn't quite happen. I have to press CTRL+D (EOF on my mac) to signal curl that my input has ended. After that, it does what is supposed to do: create a nice "Transfer-Encoding: chunked" request but with only one chunk. -d works great vs --data-binary (detects crlf and stuff like that) but is not relevant for our problem
2. "curl --data-binary @/Volumes/Storage/media/mp4/Avatar_long.mp4 http://localhost:2004/test"
3. "curl -N --data-binary @/Volumes/Storage/media/mp4/Avatar_long.mp4 http://localhost:2004/test"
4. "curl --data-binary @/Volumes/Storage/media/mp4/Avatar_long.mp4 -H "Transfer-Encoding: chunked" http://localhost:2004/test"
5. "curl -N --data-binary @/Volumes/Storage/media/mp4/Avatar_long.mp4 -H "Transfer-Encoding: chunked" http://localhost:2004/test"
All of the above fails with a crash:
curl(51078) malloc: *** mmap(size=140737488359424) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
curl: option --data-binary: out of memory
curl: try 'curl --help' or 'curl --manual' for more information
Bottom line: Is there any way of convincing curl command line to do a POST HTTP request with "Transfer-Encoding: chunked" having more than one chunk (step 1)? Because I bet that number 1 will also fail with the same mem error if the bash would actually allow you to type more than X characters :)
My curl:
/opt/local/bin/curl --version
curl 7.26.0 (x86_64-apple-darwin11.3.0) libcurl/7.26.0 OpenSSL/1.0.1c zlib/1.2.7 libidn/1.25
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
Best regards,
Andrei
------
C++ RTMP Server
Web: http://www.rtmpd.com
-------------------------------------------------------------------
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
- application/pkcs7-signature attachment: smime.p7s