1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Fix perl segfault due to changes in header callback behaviour since curl-7.8.1-pre3

This commit is contained in:
Cris Bailiff 2001-09-10 09:17:02 +00:00
parent 3f5227dfc7
commit 96c7253cea
3 changed files with 17 additions and 6 deletions

View File

@ -1,6 +1,10 @@
Revision history for Perl extension Curl::easy. Revision history for Perl extension Curl::easy.
Check out the file README for more info. Check out the file README for more info.
1.1.6 Mon Sep 10 2001: - Cris Bailiff <c.bailiff@devsecure.com>
- Fix segfault due to changes in header callback behaviour
since curl-7.8.1-pre3
1.1.5 Fri Apr 20 2001: - Cris Bailiff <c.bailiff@devsecure.com> 1.1.5 Fri Apr 20 2001: - Cris Bailiff <c.bailiff@devsecure.com>
- Add latest CURLOPT_ and CURLINFO_ constants to the constants list - Add latest CURLOPT_ and CURLINFO_ constants to the constants list

View File

@ -110,7 +110,7 @@ CURLINFO_CONTENT_LENGTH_UPLOAD
USE_INTERNAL_VARS USE_INTERNAL_VARS
); );
$VERSION = '1.1.5'; $VERSION = '1.1.6';
$Curl::easy::headers = ""; $Curl::easy::headers = "";
$Curl::easy::content = ""; $Curl::easy::content = "";
@ -254,7 +254,7 @@ indicate an error.
Georg Horn <horn@koblenz-net.de> Georg Horn <horn@koblenz-net.de>
Additional callback,pod and tes work by Cris Bailiff <c.bailiff@devsecure.com> Additional callback,pod and test work by Cris Bailiff <c.bailiff@devsecure.com>
and Forrest Cahoon <forrest.cahoon@merrillcorp.com> and Forrest Cahoon <forrest.cahoon@merrillcorp.com>
=head1 SEE ALSO =head1 SEE ALSO

View File

@ -101,12 +101,14 @@ fwrite_wrapper (const void *ptr,
if (stream == stdout) { if (stream == stdout) {
sv = newSViv(0); /* FIXME: should cast stdout to GLOB somehow? */ sv = newSViv(0); /* FIXME: should cast stdout to GLOB somehow? */
} else if (stream == NULL) {
sv = &PL_sv_undef;
} else { /* its already an SV */ } else { /* its already an SV */
sv = stream; sv = stream;
} }
if (ptr != NULL) { if (ptr != NULL) {
XPUSHs(sv_2mortal(newSVpvn(ptr, size * nmemb))); XPUSHs(sv_2mortal(newSVpvn((char *)ptr, (STRLEN)(size * nmemb))));
} else { } else {
XPUSHs(sv_2mortal(newSVpv("", 0))); XPUSHs(sv_2mortal(newSVpv("", 0)));
} }
@ -130,15 +132,20 @@ fwrite_wrapper (const void *ptr,
} else { } else {
/* default to a normal 'fwrite' */ /* default to a normal 'fwrite' */
/* stream could be a FILE * or an SV * */ /* stream could be a FILE * or an SV * */
/* or NULL since libcurl-7.8.1pre3 */
FILE *f; FILE *f;
if (stream == stdout) { /* the only possible FILE ? Think so */ if (stream == stdout ||
stream == NULL) { /* the only possible FILE ? Think so */
f = stream; f = stream;
} else { /* its a GLOB */ } else { /* its a GLOB */
f = IoIFP(sv_2io(stream)); /* may barf if not a GLOB */ f = IoIFP(sv_2io(stream)); /* may barf if not a GLOB */
} }
if (f)
return fwrite(ptr, size, nmemb, f); return fwrite(ptr, size, nmemb, f);
else
return (size_t) size*nmemb;
} }
} }