GraphicsMagick: ReadURLImage(): Deal with libxml2 not offering H...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.33455.1645886850.1607.graphicsmagick-commit@lists.sourceforge.net>
changeset e05b8a44b227 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=e05b8a44b227
summary: ReadURLImage(): Deal with libxml2 not offering HTTP or FTP capabilities.

diffstat:

 ChangeLog                              |   6 ++++++
 VisualMagick/installer/inc/version.isx |   4 ++--
 VisualMagick/magick/magick_config.h.in |  11 ++++++++++-
 coders/url.c                           |  23 +++++++++++++++++++----
 configure                              |  13 +++++++++++++
 configure.ac                           |   2 ++
 magick/magick_config.h.in              |   6 ++++++
 magick/version.h                       |   4 ++--
 www/Changelog.html                     |   5 +++++
 9 files changed, 65 insertions(+), 9 deletions(-)

diffs (223 lines):

diff -r a3360dcff7d1 -r e05b8a44b227 ChangeLog
--- a/ChangeLog	Thu Feb 24 08:17:32 2022 -0600
+++ b/ChangeLog	Sat Feb 26 08:47:09 2022 -0600
@@ -1,3 +1,9 @@
+2022-02-26  Bob Friesenhahn  <[email protected]>
+
+        * coders/url.c (ReadURLImage): Deal with libxml2 not offering HTTP
+        or FTP capabilities.  It seems that support for FTP has now been
+        removed by default.
+
 2022-02-06  Bob Friesenhahn  <[email protected]>
 
         * README.txt: Recomend using JasPer 3.0.0 (or later).
diff -r a3360dcff7d1 -r e05b8a44b227 VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx	Thu Feb 24 08:17:32 2022 -0600
+++ b/VisualMagick/installer/inc/version.isx	Sat Feb 26 08:47:09 2022 -0600
@@ -10,5 +10,5 @@
 
 #define public MagickPackageName "GraphicsMagick"
 #define public MagickPackageVersion "1.4"
-#define public MagickPackageVersionAddendum ".020220206"
-#define public MagickPackageReleaseDate "snapshot-20220206"
+#define public MagickPackageVersionAddendum ".020220226"
+#define public MagickPackageReleaseDate "snapshot-20220226"
diff -r a3360dcff7d1 -r e05b8a44b227 VisualMagick/magick/magick_config.h.in
--- a/VisualMagick/magick/magick_config.h.in	Thu Feb 24 08:17:32 2022 -0600
+++ b/VisualMagick/magick/magick_config.h.in	Sat Feb 26 08:47:09 2022 -0600
@@ -229,5 +229,14 @@
 //
 // The remaining defines should not require user modification.
 //
+/* Define to 1 if you have the <sys/types.h> header file. */
 #define HAVE_SYS_TYPES_H 1
-#define HAVE_LCMS2_H 1  // Using LCMS2
+
+/* Define if you have the <lcms2.h> header file. */
+#define HAVE_LCMS2_H 1
+
+/* Define to 1 if you have the `xmlNanoFTPNewCtxt' function. */
+#define HAVE_XMLNANOFTPNEWCTXT 1
+
+/* Define to 1 if you have the `xmlNanoHTTPOpen' function. */
+#define HAVE_XMLNANOHTTPOPEN 1
diff -r a3360dcff7d1 -r e05b8a44b227 coders/url.c
--- a/coders/url.c	Thu Feb 24 08:17:32 2022 -0600
+++ b/coders/url.c	Sat Feb 26 08:47:09 2022 -0600
@@ -91,6 +91,7 @@
 extern "C" {
 #endif
 
+#if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT
 static void GetFTPData(void *userdata,const char *data,int length)
 {
   FILE
@@ -103,6 +104,7 @@
     return;
   (void) fwrite(data,length,1,file);
 }
+#endif /* if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT */
 
 #if defined(__cplusplus) || defined(c_plusplus)
 }
@@ -113,7 +115,6 @@
 #define MaxBufferExtent  8192
 
   char
-    buffer[MaxBufferExtent],
     filename[MaxTextExtent];
 
   FILE
@@ -125,9 +126,6 @@
   ImageInfo
     *clone_info;
 
-  void
-    *context;
-
   ConfirmAccessMode
     access_mode=UndefinedConfirmAccessMode;
 
@@ -173,6 +171,13 @@
         }
       if (LocaleCompare(clone_info->magick,"http") == 0)
         {
+#if defined(HAVE_XMLNANOHTTPOPEN) && HAVE_XMLNANOHTTPOPEN
+          char
+            buffer[MaxBufferExtent];
+
+          void
+            *context;
+
           char
             *type;
 
@@ -189,9 +194,14 @@
               xmlFree(type);
               xmlNanoHTTPCleanup();
             }
+#endif /* if defined(HAVE_XMLNANOHTTPOPEN) && HAVE_XMLNANOHTTPOPEN */
         }
       else if (LocaleCompare(clone_info->magick,"ftp") == 0)
         {
+#if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT
+          void
+            *context;
+
           xmlNanoFTPInit();
           context=xmlNanoFTPNewCtxt(filename);
           if (context != (void *) NULL)
@@ -201,6 +211,7 @@
                                      (char *) NULL);
               (void) xmlNanoFTPClose(context);
             }
+#endif /* if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT */
         }
       (void) fclose(file);
       if (!IsAccessibleAndNotEmpty(clone_info->filename))
@@ -249,6 +260,7 @@
   MagickInfo
     *entry;
 
+#if defined(HAVE_XMLNANOHTTPOPEN) && HAVE_XMLNANOHTTPOPEN
   entry=SetMagickInfo("HTTP");
   entry->decoder=(DecoderHandler) ReadURLImage;
   entry->description="Uniform Resource Locator (http://)";
@@ -256,7 +268,9 @@
   entry->extension_treatment=IgnoreExtensionTreatment;
   entry->coder_class=UnstableCoderClass;
   (void) RegisterMagickInfo(entry);
+#endif /* if defined(HAVE_XMLNANOHTTPOPEN) && HAVE_XMLNANOHTTPOPEN */
 
+#if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT
   entry=SetMagickInfo("FTP");
   entry->decoder=(DecoderHandler) ReadURLImage;
   entry->description="Uniform Resource Locator (ftp://)";
@@ -264,6 +278,7 @@
   entry->extension_treatment=IgnoreExtensionTreatment;
   entry->coder_class=UnstableCoderClass;
   (void) RegisterMagickInfo(entry);
+#endif /* if defined(HAVE_XMLNANOFTPNEWCTXT) && HAVE_XMLNANOFTPNEWCTXT */
 
   entry=SetMagickInfo("FILE");
   entry->decoder=(DecoderHandler) ReadURLImage;
diff -r a3360dcff7d1 -r e05b8a44b227 configure
--- a/configure	Thu Feb 24 08:17:32 2022 -0600
+++ b/configure	Sat Feb 26 08:47:09 2022 -0600
@@ -28011,6 +28011,19 @@
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
         have_xml='yes'
+        for ac_func in xmlNanoHTTPOpen \
+                        xmlNanoFTPNewCtxt
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
     fi
     else
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
diff -r a3360dcff7d1 -r e05b8a44b227 configure.ac
--- a/configure.ac	Thu Feb 24 08:17:32 2022 -0600
+++ b/configure.ac	Sat Feb 26 08:47:09 2022 -0600
@@ -2779,6 +2779,8 @@
         AC_DEFINE([HasXML],[1],[Define if you have XML library])
         AC_MSG_RESULT([yes])
         have_xml='yes'
+        AC_CHECK_FUNCS([xmlNanoHTTPOpen \
+                        xmlNanoFTPNewCtxt])
     fi
     else
         AC_MSG_RESULT([no])
diff -r a3360dcff7d1 -r e05b8a44b227 magick/magick_config.h.in
--- a/magick/magick_config.h.in	Thu Feb 24 08:17:32 2022 -0600
+++ b/magick/magick_config.h.in	Sat Feb 26 08:47:09 2022 -0600
@@ -393,6 +393,12 @@
 /* Define to 1 if you have the <wincrypt.h> header file. */
 #undef HAVE_WINCRYPT_H
 
+/* Define to 1 if you have the `xmlNanoFTPNewCtxt' function. */
+#undef HAVE_XMLNANOFTPNEWCTXT
+
+/* Define to 1 if you have the `xmlNanoHTTPOpen' function. */
+#undef HAVE_XMLNANOHTTPOPEN
+
 /* Define to 1 if you have the `_exit' function. */
 #undef HAVE__EXIT
 
diff -r a3360dcff7d1 -r e05b8a44b227 magick/version.h
--- a/magick/version.h	Thu Feb 24 08:17:32 2022 -0600
+++ b/magick/version.h	Sat Feb 26 08:47:09 2022 -0600
@@ -38,8 +38,8 @@
 #define MagickLibVersion  0x262300
 #define MagickLibVersionText  "1.4"
 #define MagickLibVersionNumber 26,23,0
-#define MagickChangeDate   "20220206"
-#define MagickReleaseDate  "snapshot-20220206"
+#define MagickChangeDate   "20220226"
+#define MagickReleaseDate  "snapshot-20220226"
 
 /*
   The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r a3360dcff7d1 -r e05b8a44b227 www/Changelog.html
--- a/www/Changelog.html	Thu Feb 24 08:17:32 2022 -0600
+++ b/www/Changelog.html	Sat Feb 26 08:47:09 2022 -0600
@@ -35,6 +35,11 @@
 <div class="document">
 
 
+<p>2022-02-26  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
+<blockquote>
+* coders/url.c (ReadURLImage): Deal with libxml2 not offering HTTP
+or FTP capabilities.  It seems that support for FTP has now been
+removed by default.</blockquote>
 <p>2022-02-06  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
 <p>* README.txt: Recomend using JasPer 3.0.0 (or later).</p>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.