Package: approx
Version: 2.7.0
Severity: wishlist
Tags: patch

Please, allow to specify additional curl options if user needs it in the
approx config file. I need to specify --limit-rate option to curl, and I'd
like to have an easy way to do it via approx.conf.
See attachment for a patch with my implementation of such a feature.

Thank you for your work,
    Alexandra

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (999, 'testing'), (150, 'unstable'), (50, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-686
Locale: LANG=, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)

Versions of packages approx depends on:
ii  adduser                      3.97        Add and remove users and groups
ii  bzip2                        1.0.3-6     high-quality block-sorting file co
ii  curl                         7.15.5-1    Get a file from an HTTP, HTTPS, FT
ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries
ii  libpcre3                     6.7-1       Perl 5 Compatible Regular Expressi
ii  lsb-base                     3.1-15      Linux Standard Base 3.1 init scrip

approx recommends no packages.

-- no debconf information

-- 
Regards,
        Sasha.
Alexandra N. Kossovsky, software engineer.
e-mail: [EMAIL PROTECTED]
diff -u -r approx-2.7.0/approx.ml approx-2.7.0-sasha/approx.ml
--- approx-2.7.0/approx.ml      2006-09-29 19:38:46.000000000 +0400
+++ approx-2.7.0-sasha/approx.ml        2006-10-13 06:55:56.046012025 +0400
@@ -52,6 +52,7 @@
   info_message "Interval:%s%s"
     (units "hour" (interval / 60)) (units "minute" (interval mod 60));
   info_message "Max wait: %d" max_wait;
+  info_message "curl options: %s" curl_options;
   info_message "Debug: %B" debug
 
 let http_time t =
diff -u -r approx-2.7.0/config.ml approx-2.7.0-sasha/config.ml
--- approx-2.7.0/config.ml      2006-09-29 19:38:46.000000000 +0400
+++ approx-2.7.0-sasha/config.ml        2006-10-13 06:58:00.180518756 +0400
@@ -54,9 +54,7 @@
     let lines = List.map words_of_line (lines_of_channel chan) in
     close_in chan;
     let enter = function
-      | [ key; value ] -> set key value
+      | key :: value -> set key (String.concat " " value)
       | [] -> ()
-      | words -> failwith ("malformed line in " ^ filename ^ ": " ^
-                          String.concat " " words)
     in
     List.iter enter lines)
diff -u -r approx-2.7.0/debian/changelog approx-2.7.0-sasha/debian/changelog
--- approx-2.7.0/debian/changelog       2006-09-29 19:38:46.000000000 +0400
+++ approx-2.7.0-sasha/debian/changelog 2006-10-13 06:55:55.894018739 +0400
@@ -1,3 +1,9 @@
+approx (2.7.0-sasha1) unstable; urgency=low
+
+  * Implement curl_options parameter.
+
+ -- Alexandra N. Kossovsky <[EMAIL PROTECTED]>  Thu, 12 Oct 2006 19:21:44 +0400
+
 approx (2.7.0) unstable; urgency=low
 
   * New version numbering with third component for packaging-only changes
diff -u -r approx-2.7.0/default_config.ml approx-2.7.0-sasha/default_config.ml
--- approx-2.7.0/default_config.ml      2006-09-29 19:38:46.000000000 +0400
+++ approx-2.7.0-sasha/default_config.ml        2006-10-13 06:55:56.046012025 
+0400
@@ -14,3 +14,4 @@
 let interval = get_int "interval" ~default: 720 (* minutes *)
 let max_wait = get_int "max_wait" ~default: 10 (* seconds *)
 let debug = get_bool "debug" ~default: false
+let curl_options = get "curl_options" ~default: ""
diff -u -r approx-2.7.0/default_config.mli approx-2.7.0-sasha/default_config.mli
--- approx-2.7.0/default_config.mli     2006-09-29 19:38:46.000000000 +0400
+++ approx-2.7.0-sasha/default_config.mli       2006-10-13 06:55:56.058011495 
+0400
@@ -10,3 +10,4 @@
 val interval : int  (* minutes *)
 val max_wait : int  (* seconds *)
 val debug : bool
+val curl_options : string
diff -u -r approx-2.7.0/doc/approx.conf.5 approx-2.7.0-sasha/doc/approx.conf.5
--- approx-2.7.0/doc/approx.conf.5      2006-09-29 19:38:46.000000000 +0400
+++ approx-2.7.0-sasha/doc/approx.conf.5        2006-10-13 06:55:56.018013262 
+0400
@@ -36,6 +36,11 @@
 .BR approx (8)
 process will wait for a concurrent download of a file to complete,
 before attempting to download the file itself (default: 10)
+.IP curl_options
+Specifies options to be passed to 
+.BR curl (1) 
+command. For example, this parameter
+is useful for passing --limit-rate option.
 .IP debug
 Specifies whether debugging messages should be printed
 (default:
diff -u -r approx-2.7.0/etc/approx.conf approx-2.7.0-sasha/etc/approx.conf
--- approx-2.7.0/etc/approx.conf        2006-09-29 19:38:46.000000000 +0400
+++ approx-2.7.0-sasha/etc/approx.conf  2006-10-13 20:24:24.757839674 +0400
@@ -6,6 +6,7 @@
 #port          9999
 #interval      720
 #max_wait      10
+#curl_options  ""
 #debug         false
 
 # Here are some examples of remote repository mappings.
Only in approx-2.7.0-sasha/etc: approx.conf~
diff -u -r approx-2.7.0/url.ml approx-2.7.0-sasha/url.ml
--- approx-2.7.0/url.ml 2006-09-29 19:38:46.000000000 +0400
+++ approx-2.7.0-sasha/url.ml   2006-10-13 06:55:56.058011495 +0400
@@ -20,7 +20,7 @@
     invalid_arg ("no method in URL " ^ url)
 
 let curl_command options url =
-  "/usr/bin/curl --fail --silent --location " ^
+  "/usr/bin/curl --fail --silent --location " ^ curl_options ^ " " ^
     String.concat " " options ^ " " ^ quoted_string url
 
 let head_command = curl_command ["--head"]

Reply via email to