Mail Archives: cygwin/2013/08/11/16:36:23
X-Recipient: | archive-cygwin AT delorie DOT com
|
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
|
| :list-unsubscribe:list-subscribe:list-archive:list-post
|
| :list-help:sender:message-id:date:from:mime-version:to:cc
|
| :subject:content-type; q=dns; s=default; b=WbIxKZHXz6GHgPPItmjsB
|
| 4ssm9ydqJTnDRHWeYJDDyTCh5E+fOFTSYEGdBoTqPs7aZzJag7OXZ2KBXLmUqbBI
|
| orTvEoDnUwIfST31RWzOaG4L41JdSL/lgyFDhCqbbspRLNYAjwr3p4M95aozW1Et
|
| nU6h8nwvpvrZnbK/qEceEY=
|
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
|
| :list-unsubscribe:list-subscribe:list-archive:list-post
|
| :list-help:sender:message-id:date:from:mime-version:to:cc
|
| :subject:content-type; s=default; bh=ZEuF0SYgAC6MX6amgIhDDVZrTiU
|
| =; b=e0NzXyzeGExnF3xwpWVTcFpOytqh43cmqb4jhBkymUXJXxwY11+lbjkUR1z
|
| nEDeFnP1K4y073pWQmbIMSuzkrfprYNUSFEkwtGRMziNbFkop060X1rVVEN5Bfdc
|
| WmVwvEjtLDcbNWMGfiunbHO7VJVBpc4JUoEOY3f75ThPk1d0=
|
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm
|
List-Id: | <cygwin.cygwin.com>
|
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com>
|
List-Archive: | <http://sourceware.org/ml/cygwin/>
|
List-Post: | <mailto:cygwin AT cygwin DOT com>
|
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
|
Sender: | cygwin-owner AT cygwin DOT com
|
Mail-Followup-To: | cygwin AT cygwin DOT com
|
Delivered-To: | mailing list cygwin AT cygwin DOT com
|
X-Spam-SWARE-Status: | No, score=-4.6 required=5.0 tests=BAYES_40,KHOP_PGP_SIGNED,RP_MATCHES_RCVD,URI_HEX autolearn=ham version=3.3.2
|
X-Spam-Score: | -2.923
|
Message-ID: | <5207F5B0.5070708@nt.tuwien.ac.at>
|
Date: | Sun, 11 Aug 2013 22:36:00 +0200
|
From: | Andreas Winkelbauer <andreas DOT winkelbauer AT nt DOT tuwien DOT ac DOT at>
|
User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8
|
MIME-Version: | 1.0
|
To: | cygwin AT cygwin DOT com
|
CC: | daniel AT haxx DOT se
|
Subject: | [64-bit] curl: fix -i option (include headers)
|
OpenPGP: | id=F0FE489D
|
X-Virus-Found: | No
|
--------------enig9984FF2EFDDF71A83EF2D918
Content-Type: multipart/mixed;
boundary="------------060301030909070209080102"
This is a multi-part message in MIME format.
--------------060301030909070209080102
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi,
recently I stumbled across a bug in curl for 64-bit Cygwin regarding the
-i option. This bug has already been discussed in April 2013:
http://cygwin.1069669.n5.nabble.com/Difference-in-32-64-bit-curl-td98083.ht=
ml
(I can't reply directly since I was not subscribed to this mailinglist
back then.)
The problem is that the current version of curl always includes the
protocol headers in the output (no matter if -i or --include or
--no-include are used or not). This bug breaks scripts which use curl
and expect it to not include the headers in the output.
After some debugging I found out that the cause of the problem is a
missing cast of the third argument of my_setopt in tool_operate.c:886
(line numbers from curl 7.29.0)
my_setopt(curl, CURLOPT_HEADER, config->include_headers);
Here, config->include_headers is of type bool (1 byte) and my_setopt is
a macro which calls curl_easy_setopt() and is defined in tool_setopt.h
as follows:
#define my_setopt(x,y,z) \
SETOPT_CHECK(tool_setopt(x, FALSE, config, #y, y, z))
tool_setopt() is implemented in tool_setopt.c and uses va_arg(arg, long)
to get the value of its sixth argument (which is
config->include_headers). However, sizeof(long) =3D=3D 8, but sizeof(bool)
=3D=3D 1 and thus va_arg(arg, long) returns a value !=3D 0 even if
config->include_headers =3D=3D 0.
I am not sure why there is no problem with other boolean configuration
options like CURLOPT_FAILONERROR (corresponding to -f or --fail) which
are processed in exactly the same way, e.g., in tool_operate.c:930
my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror);
Also, there is no problem in 32-bit Cygwin and in 32/64-bit Linux. Maybe
the bug is triggered by some missing or incorrect (alignment related)
compiler switches?
Anyway, I have attached an updated cygport file together with a patch to
fix this bug (tested with cygport --32 and cygport --64).
@Yaakov: Could you please test my patch and update the curl package?
Best regards,
Andreas
--------------060301030909070209080102
Content-Type: text/plain; charset=UTF-8;
name="curl.cygport"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="curl.cygport"
NAME=3D"curl"
VERSION=3D7.29.0
RELEASE=3D1
CATEGORY=3D"Net Web"
SUMMARY=3D"Multi-protocol file transfer tool"
DESCRIPTION=3D"curl is a command line tool and library for transferring fil=
es
with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP,
TELNET, DICT, and FILE. curl supports SSL certificates, HTTP POST, HTTP
PUT, FTP uploading, HTTP form based upload, proxies, cookies,
user+password authentication (Basic, Digest, NTLM, Negotiate...), file
transfer resume, proxy tunneling and a busload of other useful tricks."
HOMEPAGE=3D"http://curl.haxx.se/"
SRC_URI=3D"http://curl.haxx.se/download/${P}.tar.lzma"
PKG_NAMES=3D"${PN} lib${PN}4 lib${PN}-devel"
curl_CONTENTS=3D"usr/bin/curl.exe usr/share/doc/ usr/share/man/man1/curl.*"
libcurl4_SUMMARY=3D"Multi-protocol file transfer library (runtime)"
libcurl4_CONTENTS=3D"usr/bin/cygcurl-4.dll"
libcurl_devel_SUMMARY=3D"Multi-protocol file transfer library (development)"
libcurl_devel_CONTENTS=3D"usr/bin/curl-config usr/include/ usr/lib/
usr/share/man/man1/curl-config.* usr/share/man/man3=
/"
PATCH_URI=3D"include-headers-cygwin.patch"
DIFF_EXCLUDES=3D"Makefile curlbuild.h curl_config.h"
# librtmp: not in Fedora due to unchallenged DMCA action
CYGCONF_ARGS=3D"
--enable-debug --enable-optimize
--disable-hidden-symbols
--disable-ares
--enable-ldap
--disable-sspi
--with-gssapi
--without-krb4
--with-libidn
--with-libmetalink
--without-librtmp
--with-libssh2
--without-spnego
--with-ssl
--with-zlib
--with-ca-bundle=3D/usr/ssl/certs/ca-bundle.crt
"
DOCS=3D"docs/BINDINGS docs/BUGS docs/CONTRIBUTE docs/DISTRO-DILEMMA docs/FAQ
docs/FEATURES docs/HISTORY docs/HTTP-COOKIES docs/INTERNALS docs/KNOW=
N_BUGS
docs/LICENSE-MIXING docs/MAIL-ETIQUETTE docs/MANUAL docs/RESOURCES
docs/SSLCERTS docs/THANKS docs/TheArtOfHttpScripting docs/TODO docs/V=
ERSIONS"
KEEP_LA_FILES=3D"none"
--------------060301030909070209080102
Content-Type: text/x-patch;
name="include-headers-cygwin.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="include-headers-cygwin.patch"
diff -uNpr curl-7.29.0/src/tool_operate.c curl-7.29.0/src/tool_operate.c
--- curl-7.29.0/src/tool_operate.c 2013-02-06 10:47:19.000000000 +0100
+++ curl-7.29.0/src/tool_operate.c 2013-08-11 21:21:47.397377700 +0200
@@ -877,13 +877,13 @@ int operate(struct Configurable *config,
my_setopt(curl, CURLOPT_NOPROGRESS, config->noprogress);
if(config->no_body) {
my_setopt(curl, CURLOPT_NOBODY, 1);
- my_setopt(curl, CURLOPT_HEADER, 1);
+ my_setopt(curl, CURLOPT_HEADER, (long)1);
}
/* If --metalink is used, we ignore --include (headers in
output) option because mixing headers to the body will
confuse XML parser and/or hash check will fail. */
else if(!config->use_metalink)
- my_setopt(curl, CURLOPT_HEADER, config->include_headers);
+ my_setopt(curl, CURLOPT_HEADER, (long)config->include_headers);
=20
#if !defined(CURL_DISABLE_PROXY)
{
--------------060301030909070209080102--
--------------enig9984FF2EFDDF71A83EF2D918
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/
iQIcBAEBAgAGBQJSB/WwAAoJEFdM/Crw/kid8/4P/RSLpaYnM55sxPadVHoRvu/Q
f68n9t5w9SehwsLRNeCUOzwZqQGXgXfbI06r5cnvX4FT/O3lVu4gFDkiwV9kPJWM
JBsVa/JddsImVp0FKseXXuPuh3JyYr4HAa6UwAlMECuCdANO6LehicA3ZZnogilO
X5n2Cvnwl9oD7qivCiW1Zpt51PErkG40RB5SghXZqDkLlyW7/ytNRJ9Tzl3C6Mq0
1g2TTjR5t9s2lITLbTLhQX2J1OLvZZgQRN8nfw1mFCm7B8ZKSYcHbmVddl0Z5Naz
6xBUOal6oUVWqq09DDjYfsPWfEZns8Rh3uVd/V9lQVLk9og+BgXjXFSwUNCdbBCC
O88pg6uArwmrlvJ5lq++7zYIWEEeXDz6BTU9wLr8Hx62MBPW8mRnW8RFkWVxpfUH
nvoP2SryuIxWtVyzD0kgAYkYIezqy7ig86hb1q009BieOeOOL3kvuwXZKnyZ7ueY
gQs5ktggYNNIWKzIwpZJOu71nxkKpWPM1/60cqmUcKWaK3up9H24lTDSWtYa5Fa4
MCGkXpyr0eEdx9iff2HtZ5O6YmVJZW1y/PPx8dBK4WMg1SdsHwNGjZqpsfAm9tM2
qel4fp46lrbqEWYrhSSc73bFYY3sn2KM2c5O/3CY3Ddml289r0rF5itAhCd+DYp3
LqWAQt4J9a8UZ3APCrRD
=Aukc
-----END PGP SIGNATURE-----
--------------enig9984FF2EFDDF71A83EF2D918--
- Raw text -