The following diff proposes to
remove the network functionality of SoX.

It is none of SoX's business to open network sockets
or spawn processes that make DNS queries and all that.
The whole thing is a pipeline anyway, so just run the pipe, e.g.
curl -o - http://amp.cesnet.cz:8000/cro-d-dur-256.ogg | play -

Different systems use different tools to download from
the net (ftp, curl, wget), so don't hardcode one of them,
let alone distributing its binary.

Also, systems that support restricting a piece of software
in terms of what it is allow to do (such as OpenBSD's pledge)
can now restrict SoX to what it needs to do, namely file IO.

Jan





diff --git a/README.osx b/README.osx
index 35789e30..710c6073 100644
--- a/README.osx
+++ b/README.osx
@@ -38,18 +38,6 @@ The sox exectables included in this package makes use of the 
following projects:
Enjoy,
The SoX Development Team

-Appendix - wget Support
------------------------
-
-SoX can make use of the wget command line utility to load files over
-the internet or listen to shoutcast streams.  It only needs to be
-somewhere in your path to be used by SoX.
-
-Please consult wget's homepage for access to source code as well
-as further instructions on configuring and installing.
-
-http://www.gnu.org/software/wget
-
Appendix - MP3 Support
----------------------
 
diff --git a/README.win32 b/README.win32
index 0ed7815a..9ca432d6 100644
--- a/README.win32
+++ b/README.win32
@@ -59,29 +59,9 @@ further information on how it was compiled and packaged.
 
   WavPack - http://www.wavpack.com
 
-  wget - http://www.gnu.org/software/wget
-
 Enjoy,
 The SoX Development Team
 
-Appendix - wget Support
------------------------
-
-SoX can make use of the wget command line utility to load files over
-the internet.  A binary copy of wget has been included with this
-package of SoX for your convience.
-
-For SoX to make use of wget, it must be located either in your PATH or
-within the same directory that SoX is ran from.
-
-Custom configuration of wget can be made by editing the file wget.ini
-contained in the same directory as wget.exe.
-
-Please consult wget's homepage for access to source code as well as
-further instructions on configuring.
-
-http://www.gnu.org/software/wget
-
 Appendix - MP3 Support
 ----------------------
 
diff --git a/cygbuild b/cygbuild
index 4fc602bf..c9d880f5 100755
--- a/cygbuild
+++ b/cygbuild
@@ -7,11 +7,6 @@
 # requires to already have several external libraries already installed
 # under /usr/local.
 #
-# And last, it will optional package a wget compiled with VC++ instead
-# of cygwin version (which has no DLL's to distribute) if found
-# in wget-1.11.4 directory.  If not found, it will distribute the
-# cygwin version and various DLL's it requires.
-#
 # Various notes:
 #
 # Script makes use of "-static" option to tell compiler to prefer static
@@ -94,8 +89,6 @@ done
 
 binaries=src/sox
 
-[ ! -r "../wget-1.11.4/wget.exe" -a -r /usr/bin/wget ] && binaries+=" 
/usr/bin/wget"
-
 binaries=$(for f in `cygcheck $binaries|dos2unix`
     do cygpath -u $f; done|sort|uniq|grep -v ^/cygdrive/)
 
@@ -109,15 +102,5 @@ cp -p \
 
 unix2dos $dir/batch-example.bat
 
-if test -r "../wget-1.11.4/wget.exe"; then
-  cp ../wget-1.11.4/wget.exe $dir
-  cp ../wget-1.11.4/wget.ini $dir
-else
-  if test -r /usr/bin/wget -a -r /etc/wgetrc; then
-    cp -p /etc/wgetrc $dir/wget.ini
-    chmod +r $dir/wget.ini
-  fi
-fi
-
 zip -r $dir-cygwin32.zip $dir
 rm -rf $dir
diff --git a/mingwbuild b/mingwbuild
index 60b1f005..3ad6b581 100755
--- a/mingwbuild
+++ b/mingwbuild
@@ -6,9 +6,6 @@
 # It is used on a Fedora box with mingw32 cross compiler and wine to
 # test.
 #
-# It will optionally package up VC++ version of wget if found in
-# ../wget-1.11.4.
-#
 # Various notes:
 #
 # The following command lines were used to generate the external libraries
@@ -126,11 +123,6 @@ mv $dir/libFLAC-8.dll $dir/libflac-8.dll
 
 unix2dos $dir/batch-example.bat
 
-if test -r "../wget-1.11.4/wget.exe"; then
-  cp ../wget-1.11.4/wget.exe $dir
-  cp ../wget-1.11.4/wget.ini $dir
-fi
-
 zip -r $dir-win32.zip $dir
 
 # Optionally, create windows installer if nsiswrapper exists.
diff --git a/osxbuild b/osxbuild
index a61ede35..51fe28eb 100755
--- a/osxbuild
+++ b/osxbuild
@@ -102,9 +102,6 @@ done
 
 binaries=src/sox
 
-# TODO: Distribute wget binary
-#[ -r "../wget-1.11.4/wget" ] && binaries+=" ../wget-1.11.4/wget"
-
 cp -p \
   $binaries \
   sox.txt \
@@ -115,9 +112,5 @@ cp -p \
 
 (cd $dir; ln -s sox soxi; ln -s sox play; ln -s sox rec)
 
-#if test -r "../wget-1.11.4/wget"; then
-#  cp ../wget-1.11.4/wget.ini $dir
-#fi
-
 zip --symlinks -r $dir-macosx.zip $dir
 rm -rf $dir
diff --git a/sox.1 b/sox.1
index 1ea7694a..84689bd0 100644
--- a/sox.1
+++ b/sox.1
@@ -615,12 +615,7 @@ has a time period or sample count to determine the stopping
 point. The trim effect is an example of this.  Once all
 effects chains have stopped then SoX will also stop.
 .SH FILENAMES
-Filenames can be simple file names, absolute or relative path names,
-or URLs (input files only).  Note that URL support requires that
-.BR wget (1)
-is available.
-.SP
-Note:
+Filenames can be simple file names or absolute or relative path names.
 Giving SoX an input or output filename that is the same as a SoX
 effect-name will not work since SoX will treat it as an effect
 specification.  The only work-around to this is to avoid such
@@ -4191,8 +4186,7 @@ Please report any bugs found in this version of SoX to 
the mailing list
 .br
 .BR audacity (1),
 .BR gnuplot (1),
-.BR octave (1),
-.BR wget (1)
+.BR octave (1)
 .br
 The SoX web site at http://sox.sourceforge.net
 .br
diff --git a/soxformat.7 b/soxformat.7
index 532fd2db..7d8f9e70 100644
--- a/soxformat.7
+++ b/soxformat.7
@@ -503,23 +503,6 @@ and
 \&\fB.paf\fR, \fB.fap\fR (optional)
 Ensoniq PARIS file format (big and little-endian respectively).
 .TP
-.B .pls
-A
-.I playlist
-format; contains a list of audio files.
-SoX can read, but not write this file format.
-See [2] for details of this format.
-.SP
-Note: SoX support for SHOUTcast PLS relies on
-.BR wget (1)
-and is only partially supported: it's necessary to
-specify the audio type manually, e.g.
-.EX
-       play \-t mp3 \(dqhttp://a.server/pls?rn=265&file=filename.pls\(dq
-.EE
-and SoX does not know about alternative servers\*mhit Ctrl-C twice in
-quick succession to quit.
-.TP
 .B .prc
 Psion Record. Used in Psion EPOC PDAs (Series 5, Revo and similar) for
 System alarms and recordings made by the built-in Record application.
@@ -790,8 +773,7 @@ Fasttracker 2 Extended Instrument format.
 .BR sox (1),
 .BR soxi (1),
 .BR libsox (3),
-.BR octave (1),
-.BR wget (1)
+.BR octave (1)
 .SP
 The SoX web page at http://sox.sourceforge.net
 .br
diff --git a/src/formats.c b/src/formats.c
index 3fcf4382..b652a765 100644
--- a/src/formats.c
+++ b/src/formats.c
@@ -360,14 +360,6 @@ static int sox_checkformat(sox_format_t * ft)
   return SOX_SUCCESS;
 }
 
-static sox_bool is_url(char const * text) /* detects only wget-supported URLs 
*/
-{
-  return !(
-      strncasecmp(text, "http:" , (size_t)5) &&
-      strncasecmp(text, "https:", (size_t)6) &&
-      strncasecmp(text, "ftp:"  , (size_t)4));
-}
-
 static int xfclose(FILE * file, lsx_io_type io_type)
 {
   return
@@ -436,21 +428,6 @@ static FILE * xfopen(char const * identifier, char const * 
mode, lsx_io_type * i
     incr_pipe_size(f);
 #else
     lsx_fail("this build of SoX cannot open pipes");
-#endif
-    return f;
-  }
-  else if (is_url(identifier)) {
-    FILE * f = NULL;
-#ifdef HAVE_POPEN
-    char const * const command_format = "wget --no-check-certificate -q -O- 
\"%s\"";
-    char * command = lsx_malloc(strlen(command_format) + strlen(identifier));
-    sprintf(command, command_format, identifier);
-    f = popen(command, POPEN_MODE);
-    incr_pipe_size(f);
-    free(command);
-    *io_type = lsx_io_url;
-#else
-    lsx_fail("this build of SoX cannot open URLs");
 #endif
     return f;
   }
@@ -493,7 +470,7 @@ static sox_format_t * open_read(
 {
   sox_format_t * ft = lsx_calloc(1, sizeof(*ft));
   sox_format_handler_t const * handler;
-  char const * const io_types[] = {"file", "pipe", "file URL"};
+  char const * const io_types[] = {"file", "pipe"};
   char const * type = "";
   size_t   input_bufsiz = sox_globals.input_bufsiz?
       sox_globals.input_bufsiz : sox_globals.bufsiz;
@@ -1183,7 +1160,7 @@ int sox_parse_playlist(sox_playlist_callback_t callback, 
void * p, char const *
       if (begin != end) {
         char const * id = text + begin;
 
-        if (!dirname[0] || is_url(id) || IS_ABSOLUTE(id))
+        if (!dirname[0] || IS_ABSOLUTE(id))
           filename = lsx_strdup(id);
         else {
           filename = lsx_malloc(strlen(dirname) + strlen(id) + 2);
@@ -1201,7 +1178,7 @@ int sox_parse_playlist(sox_playlist_callback_t callback, 
void * p, char const *
       lsx_fail("error reading playlist file `%s': %s", listname, 
strerror(errno));
       result = SOX_EOF;
     }
-    if (xfclose(file, io_type) && io_type == lsx_io_url) {
+    if (xfclose(file, io_type)) {
       lsx_fail("error reading playlist file URL `%s'", listname);
       result = SOX_EOF;
     }
diff --git a/src/sox.h b/src/sox.h
index bac50354..41d8d00f 100644
--- a/src/sox.h
+++ b/src/sox.h
@@ -588,14 +588,12 @@ enum sox_loop_flags_t {
 };
 
 /**
-Plugins API:
-Is file a real file, a pipe, or a url?
+Plugins API: real file or a pipe?
 */
 typedef enum lsx_io_type
 {
     lsx_io_file, /**< File is a real file = 0. */
-    lsx_io_pipe, /**< File is a pipe (no seeking) = 1. */
-    lsx_io_url   /**< File is a URL (no seeking) = 2. */
+    lsx_io_pipe /**< File is a pipe (no seeking) = 1. */
 } lsx_io_type;
 
 /*****************************************************************************
@@ -1531,7 +1529,7 @@ struct sox_format_t {
   int              sox_errno;       /**< Failure error code */
   char             sox_errstr[256]; /**< Failure error text */
   void             * fp;            /**< File stream pointer */
-  lsx_io_type      io_type;         /**< Stores whether this is a file, pipe 
or URL */
+  lsx_io_type      io_type;         /**< Is this is a file or a pipe */
   sox_uint64_t     tell_off;        /**< Current offset within file */
   sox_uint64_t     data_start;      /**< Offset at which headers end and sound 
data begins (set by lsx_check_read_params) */
   sox_format_handler_t handler;     /**< Format handler for this file */


_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

Reply via email to