[34418] trunk/base/src/pextlib1.0/curl.c
afb at macports.org
afb at macports.org
Sun Feb 24 06:02:29 PST 2008
Revision: 34418
http://trac.macosforge.org/projects/macports/changeset/34418
Author: afb at macports.org
Date: 2008-02-24 06:02:28 -0800 (Sun, 24 Feb 2008)
Log Message:
-----------
work around remote-time bug in old libcurl version on tiger
Modified Paths:
--------------
trunk/base/src/pextlib1.0/curl.c
Modified: trunk/base/src/pextlib1.0/curl.c
===================================================================
--- trunk/base/src/pextlib1.0/curl.c 2008-02-24 04:13:23 UTC (rev 34417)
+++ trunk/base/src/pextlib1.0/curl.c 2008-02-24 14:02:28 UTC (rev 34418)
@@ -360,6 +360,45 @@
(void) fclose( theFile );
theFile = NULL;
+#if LIBCURL_VERSION_NUM == 0x070d01 /* work around broken Tiger version of cURL */
+ if (remotetime) {
+ FILE *fp;
+ char *tmp, *p;
+ char buf[BUFSIZ];
+ size_t size;
+
+ tmp = tmpnam(NULL);
+ fp = fopen(tmp, "w");
+ if (fp == NULL) {
+ Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
+ theResult = TCL_ERROR;
+ break;
+ }
+ theFile = fopen( theFilePath, "r");
+ if (theFile == NULL) {
+ Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
+ theResult = TCL_ERROR;
+ break;
+ }
+ if ( (p = fgets(buf, BUFSIZ, theFile)) != NULL) {
+ /* skip stray header escaping into output */
+ if (strncmp(p, "Last-Modified:", 14) != 0)
+ fwrite(p, 1, strlen(p), fp);
+ }
+ while ( (size = fread(buf, 1, BUFSIZ, theFile)) > 0) {
+ fwrite(buf, 1, size, fp);
+ }
+ (void) fclose( theFile );
+ theFile = NULL;
+ fclose(fp);
+ if (rename(tmp, theFilePath) != 0) {
+ Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
+ theResult = TCL_ERROR;
+ break;
+ }
+ }
+#endif
+
#ifdef HAVE_UTIME_H
if (remotetime) {
theCurlCode = curl_easy_getinfo(theHandle, CURLINFO_FILETIME, &theFileTime);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080224/24e82660/attachment-0001.html
More information about the macports-changes
mailing list