Ricardo Vila | 2 Feb 12:54
Favicon

Character encoding problem in windows when using --data-binary and special characters like 'Ñ'

Hi.
I'm Ricardo Vila and i'm new to this mailing list.

Briefly: i'm facing a problem using command line curl in windows
platforms to send data stored in properties files. I hope somebody can
point me a solution.

Te complete situation is as follows. At Teimas, we have one app wich
accepts REST requests. This requests has a lot of fields so our
clients store the parameters in a properties file and then send it
with curl and the --data-binary option. Something like this (windows
example):

curl.exe -i -u :'some_token' -H "Accept: application/x-yaml" -H
"Content-type: text/plain" http://ourserver.com/api/nt/ --data-binary
@file.properties -X POST

This works fine running curl form linux and windows. But in windows
appears one problem when in the properties file, appears something
like this:

    documento.productor.centro.nombre=XESTION A CORUÑA, S.A.

The Ñ character is encoded (in windows clients) in a way that our
server cannot handle it and the rest of the line is trunked. So the
value on our server for this example is 'XESTION A CORU'

We have tried many things like:

  - Use --data-urlencode option (with and without changing content-type)
(Continue reading)

Javier Barroso | 2 Feb 15:14
Picon

Reading url request from a file ?

Hi,

I would like to use curl but reading headers which I send from a file
such http://pastebin.com/TcP0UVbd

I'm thiniking in shell scripting (perl, awk ..), but maybe there is
another easy method to do it

I would like something like curl --read-request-from-file myfile

I didn't find any like it in internet, but probabbly someone though
in that before

Do you have any idea or  I need to write an bash function which
convert headers to -H curl switch , and use $() bash operator (and add
data post which is included in the file too)?

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

Dan Fandrich | 2 Feb 20:10
Favicon

Re: Character encoding problem in windows when using --data-binary and special characters like 'Ñ'

On Thu, Feb 02, 2012 at 12:54:58PM +0100, Ricardo Vila wrote:
> curl.exe -i -u :'some_token' -H "Accept: application/x-yaml" -H
> "Content-type: text/plain" http://ourserver.com/api/nt/ --data-binary
> @file.properties -X POST
>
> This works fine running curl form linux and windows. But in windows
> appears one problem when in the properties file, appears something
> like this:
> 
>     documento.productor.centro.nombre=XESTION A CORUÑA, S.A.
> 
> The Ñ character is encoded (in windows clients) in a way that our
> server cannot handle it and the rest of the line is trunked. So the
> value on our server for this example is 'XESTION A CORU'
> 
> We have tried many things like:
> 
>   - Use --data-urlencode option (with and without changing content-type)
>   - Use --data option
>   - Use --data-urlencode with -crlf
>   - May combination of the above options
> 
> I know that de manual page says ' The contents of the file must
> already be URL-encoded.' but i wonder if i can let curl command manage
> this.
> ¿I'm missing something? ¿Any idea?

curl is undoubtedly sending the file to the remote server exactly as
requested. If so, then the problem won't be solved by adding a curl option
but rather by converting the file into the format that the server
(Continue reading)

Javier Barroso | 4 Feb 16:07
Picon

Re: Reading url request from a file ?

On Thu, Feb 2, 2012 at 3:14 PM, Javier Barroso <javibarroso <at> gmail.com> wrote:
> Hi,
>
> I would like to use curl but reading headers which I send from a file
> such http://pastebin.com/TcP0UVbd
>
> I'm thiniking in shell scripting (perl, awk ..), but maybe there is
> another easy method to do it
>
> I would like something like curl --read-request-from-file myfile
>
> I didn't find any like it in internet, but probabbly someone though
> in that before
>
> Do you have any idea or  I need to write an bash function which
> convert headers to -H curl switch , and use $() bash operator (and add
> data post which is included in the file too)?
Well, finally I did a perl script,sharing here:

#!/usr/bin/perl -w
use strict;

my %headers;
open my $tmpfile, ">tmpfile";
while (<>)
{
	if (1 .. /^$/)
	{
		chomp;
		next if (/^$/);
(Continue reading)

Daniel Stenberg | 5 Feb 12:07
Picon
Favicon
Gravatar

-f regression

FYI,

Bug report #3481223 properly identified a regression when -f is used with a 
[]-range in a URL. It worked in 7.22 and the commit that broke the old 
behavior is fa775b56de777.

I've come up with a test case for this, test1328 is attached.

I've not yet produced a proper fix, as my first naive approach turned out to 
fix this problem but break some existing tests.

--

-- 

  / daniel.haxx.se
<testcase>
<info>
<keywords>
HTTP
HTTP GET
-f
</keywords>
</info>

<reply>
<data>
HTTP/1.1 404 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Content-Length: 6
Funny-head: yesyes
(Continue reading)

Daniel Stenberg | 6 Feb 18:28
Picon
Favicon
Gravatar

Re: -f regression

On Sun, 5 Feb 2012, Daniel Stenberg wrote:

> I've not yet produced a proper fix, as my first naive approach turned out to 
> fix this problem but break some existing tests.

Ah, I figured out a fairly clean fix and it has now been committed.

--

-- 

  / 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

David Bonham | 6 Feb 19:34

7.24.0 curl windows exe download not available

http://www.gknw.net/mirror/curl/win32/curl-7.24.0-ssl-sspi-zlib-static-bin-w32.zip is not available (at least for me).  I've tried for the last couple days.

Is there a mirror for this?
-------------------------------------------------------------------
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 Feb 22:50
Picon
Favicon
Gravatar

Re: 7.24.0 curl windows exe download not available

On Mon, 6 Feb 2012, David Bonham wrote:

> http://www.gknw.net/mirror/curl/win32/curl-7.24.0-ssl-sspi-zlib-static-bin-w32.zipis 
> not available (at least for me).  I've tried for the last couple days.
>
> Is there a mirror for this?

I'm not aware of any mirror for that, no. I know however that the machine 
running that site broke down and that Guenter (the admin of the site) is 
working on getting it back up again.

--

-- 

  / 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

Hello! hello | 10 Feb 19:04
Picon

undefined reference to `curl_global_init'

Hi,

I encounter a problem while compile attached sourcecode which require libcurl

From following log generated by ld, libcurl.so was loaded, definition of 'curl_global_init' was also there,
but the compiler still complain without any success

Thanks for any help

Package for libcurl:
libcurl4-openssl-dev

Compile Command:
gcc -L/usr/lib/i386-linux-gnu -lcurl -Wl,-M,-t,-y,curl_global_init couch_example1.c

Log:

/usr/bin/ld: mode elf_i386
/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crt1.o
/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crti.o
/usr/lib/gcc/i686-linux-gnu/4.6.1/crtbegin.o
-lcurl (/usr/lib/i386-linux-gnu/libcurl.so)
/tmp/ccT5ZAF5.o
-lgcc_s (/usr/lib/gcc/i686-linux-gnu/4.6.1/libgcc_s.so)
/lib/i386-linux-gnu/libc.so.6
Archive member included because of file (symbol)

/usr/lib/i386-linux-gnu/libc_nonshared.a(elf-init.oS)
                              /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crt1.o (__libc_csu_init)
(/usr/lib/i386-linux-gnu/libc_nonshared.a)elf-init.oS
/usr/lib/i386-linux-gnu/libc_nonshared.a(stat.oS)
                              /tmp/ccT5ZAF5.o (stat)
(/usr/lib/i386-linux-gnu/libc_nonshared.a)stat.oS
/lib/i386-linux-gnu/ld-linux.so.2
-lgcc_s (/usr/lib/gcc/i686-linux-gnu/4.6.1/libgcc_s.so)
/usr/lib/gcc/i686-linux-gnu/4.6.1/crtend.o
/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crtn.o

Allocating common symbols
Common symbol       size              file

fp                  0x4               /tmp/ccT5ZAF5.o
curl                0x4               /tmp/ccT5ZAF5.o
file_info           0x58              /tmp/ccT5ZAF5.o

Discarded input sections

 .note.GNU-stack
                0x0000000000000000        0x0 /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crt1.o
 .gnu_debuglink
                0x0000000000000000        0xc /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crt1.o
 .note.GNU-stack
                0x0000000000000000        0x0 /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crti.o
 .gnu_debuglink
                0x0000000000000000        0xc /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crti.o
 .note.GNU-stack
                0x0000000000000000        0x0 /usr/lib/gcc/i686-linux-gnu/4.6.1/crtbegin.o
 .note.GNU-stack
                0x0000000000000000        0x0 /tmp/ccT5ZAF5.o
 .group         0x0000000000000000        0x8 /usr/lib/i386-linux-gnu/libc_nonshared.a(elf-init.oS)
 .note.GNU-stack
                0x0000000000000000        0x0 /usr/lib/i386-linux-gnu/libc_nonshared.a(elf-init.oS)
 .group         0x0000000000000000        0x8 /usr/lib/i386-linux-gnu/libc_nonshared.a(stat.oS)
 .text.__i686.get_pc_thunk.bx
                0x0000000000000000        0x4 /usr/lib/i386-linux-gnu/libc_nonshared.a(stat.oS)
 .note.GNU-stack
                0x0000000000000000        0x0 /usr/lib/i386-linux-gnu/libc_nonshared.a(stat.oS)
 .note.GNU-stack
                0x0000000000000000        0x0 /usr/lib/gcc/i686-linux-gnu/4.6.1/crtend.o
 .note.GNU-stack
                0x0000000000000000        0x0 /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crtn.o
 .gnu_debuglink
                0x0000000000000000        0xc /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crtn.o

Memory Configuration

Name             Origin             Length             Attributes
*default*        0x0000000000000000 0xffffffffffffffff

Linker script and memory map

LOAD /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crt1.o
LOAD /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crti.o
LOAD /usr/lib/gcc/i686-linux-gnu/4.6.1/crtbegin.o
LOAD /usr/lib/i386-linux-gnu/libcurl.so
LOAD /tmp/ccT5ZAF5.o
LOAD /usr/lib/gcc/i686-linux-gnu/4.6.1/libgcc.a
LOAD /usr/lib/gcc/i686-linux-gnu/4.6.1/libgcc_s.so
LOAD /usr/lib/i386-linux-gnu/libc.so
START GROUP
LOAD /lib/i386-linux-gnu/libc.so.6
LOAD /usr/lib/i386-linux-gnu/libc_nonshared.a
LOAD /lib/i386-linux-gnu/ld-linux.so.2
END GROUP
LOAD /usr/lib/gcc/i686-linux-gnu/4.6.1/libgcc.a
LOAD /usr/lib/gcc/i686-linux-gnu/4.6.1/libgcc_s.so
LOAD /usr/lib/gcc/i686-linux-gnu/4.6.1/crtend.o
LOAD /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crtn.o
 ...
.gnu.attributes
 *(.gnu.attributes)

/DISCARD/
 *(.note.GNU-stack)
 *(.gnu_debuglink)
 *(.gnu.lto_*)
OUTPUT(a.out elf32-i386/usr/lib/i386-linux-gnu/libcurl.so: definition of curl_global_init
/tmp/ccT5ZAF5.o: reference to curl_global_init
/tmp/ccT5ZAF5.o: In function `main':
couch_example1.c:(.text+0xa0): undefined reference to `curl_global_init'
couch_example1.c:(.text+0xd5): undefined reference to `curl_easy_init'
couch_example1.c:(.text+0x10c): undefined reference to `curl_easy_setopt'
couch_example1.c:(.text+0x131): undefined reference to `curl_easy_setopt'
couch_example1.c:(.text+0x158): undefined reference to `curl_easy_setopt'
couch_example1.c:(.text+0x17f): undefined reference to `curl_easy_setopt'
couch_example1.c:(.text+0x19b): undefined reference to `curl_slist_append'
couch_example1.c:(.text+0x1c4): undefined reference to `curl_easy_setopt'
couch_example1.c:(.text+0x1d1): undefined reference to `curl_easy_perform'
couch_example1.c:(.text+0x1dd): undefined reference to `curl_slist_free_all'
couch_example1.c:(.text+0x1ea): undefined reference to `curl_easy_cleanup'
couch_example1.c:(.text+0x1fc): undefined reference to `curl_global_cleanup'
/usr/bin/ld: link errors found, deleting executable `a.out'
collect2: ld returned 1 exit status
)

Attachment (couch_example1.c): text/x-csrc, 1205 bytes
-------------------------------------------------------------------
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
Dan Fandrich | 10 Feb 22:49
Favicon

Re: undefined reference to `curl_global_init'

On Sat, Feb 11, 2012 at 02:04:43AM +0800, Hello! hello wrote:
> I encounter a problem while compile attached sourcecode which require libcurl
> 
> From following log generated by ld, libcurl.so was loaded, definition of
> 'curl_global_init' was also there,
> but the compiler still complain without any success
> 
> Thanks for any help
> 
> Package for libcurl:
> libcurl4-openssl-dev
> 
> Compile Command:
> gcc -L/usr/lib/i386-linux-gnu -lcurl -Wl,-M,-t,-y,curl_global_init
> couch_example1.c

The reference to -lcurl must come after the file the references it. The
order of appearance on the command-line is important.

>>> Dan
-------------------------------------------------------------------
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