Tags 531218 patch
thanks

Hi,

Here's a patch which allows https to work with approx.


From d4393514ec99b8926f1821ef12dce852769567e5 Mon Sep 17 00:00:00 2001
From: Andres Salomon <dilin...@collabora.co.uk>
Date: Mon, 1 Jun 2009 08:29:30 -0400
Subject: [PATCH] approx: add https support

This is a preliminary patch to add https support.  Curl already supports
https, but approx's url library doesn't see "https" as a valid protocol.
This patch allows https to match properly.

Note that this could certainly be improved; currently, if https fails
(ie, due to an invalid cert), there's not a useful error message
(simply a 404).

Signed-off-by: Andres Salomon <dilin...@collabora.co.uk>
---
 approx.ml |    4 ++--
 url.ml    |    3 ++-
 url.mli   |    2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/approx.ml b/approx.ml
index 58c1f1c..f7fc677 100644
--- a/approx.ml
+++ b/approx.ml
@@ -294,7 +294,7 @@ let process_body resp cgi str pos len =
       cgi#output#really_output str pos len
   end
 
-(* Download a file from an HTTP repository *)
+(* Download a file from an HTTP or HTTPS repository *)
 
 let download_http resp url name ims cgi =
   let headers =
@@ -336,7 +336,7 @@ let download_ftp resp url name ims cgi =
 let download_url url name ims cgi =
   let dl =
     match Url.protocol url with
-    | Url.HTTP -> download_http
+    | Url.HTTP | Url.HTTPS -> download_http
     | Url.FTP | Url.FILE -> download_ftp
   in
   let resp = new_response url name in
diff --git a/url.ml b/url.ml
index 88376ab..bdf15d0 100644
--- a/url.ml
+++ b/url.ml
@@ -24,12 +24,13 @@ let translate_file file =
   let dist, path = split_cache_path file in
   Config_file.get dist ^/ path
 
-type protocol = HTTP | FTP | FILE
+type protocol = HTTP | HTTPS | FTP | FILE
 
 let protocol url =
   try
     match String.lowercase (substring url ~until: (String.index url
':')) with | "http" -> HTTP
+    | "https" -> HTTPS
     | "ftp" -> FTP
     | "file" -> FILE
     | proto -> invalid_arg ("unsupported URL protocol " ^ proto)
diff --git a/url.mli b/url.mli
index 6e4834c..a8188cd 100644
--- a/url.mli
+++ b/url.mli
@@ -12,7 +12,7 @@ val translate_request : string -> string * string
 
 val translate_file : string -> string
 
-type protocol = HTTP | FTP | FILE
+type protocol = HTTP | HTTPS | FTP | FILE
 
 val protocol : string -> protocol
 
-- 
1.5.6.5




--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to