1 |
sping 11/09/02 17:39:01 |
2 |
|
3 |
Added: gimp-2.6.11-file-uri.patch |
4 |
Log: |
5 |
media-gfx/gimp: Apply file-uri patch by upstream (bug #372941) |
6 |
|
7 |
(Portage version: 2.1.10.11/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 media-gfx/gimp/files/gimp-2.6.11-file-uri.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-gfx/gimp/files/gimp-2.6.11-file-uri.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-gfx/gimp/files/gimp-2.6.11-file-uri.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: gimp-2.6.11-file-uri.patch |
16 |
=================================================================== |
17 |
--- plug-ins/file-uri/uri-backend-libcurl.c.orig 2011-09-01 09:06:13.307741499 -0500 |
18 |
+++ plug-ins/file-uri/uri-backend-libcurl.c 2011-09-01 09:09:09.066152187 -0500 |
19 |
@@ -62,7 +62,7 @@ |
20 |
|
21 |
vinfo = curl_version_info (CURLVERSION_NOW); |
22 |
|
23 |
- protocols = g_string_new ("http:,ftp:"); |
24 |
+ protocols = g_string_new ("http:,ftp:,gopher:"); |
25 |
|
26 |
if (vinfo->features & CURL_VERSION_SSL) |
27 |
{ |
28 |
@@ -153,6 +153,11 @@ |
29 |
CURL *curl_handle; |
30 |
CURLcode result; |
31 |
gint response_code; |
32 |
+ gchar *eff_url = NULL; |
33 |
+ gchar *proto = NULL; |
34 |
+ gboolean is_http = FALSE; |
35 |
+ gboolean is_ftp = FALSE; |
36 |
+ gboolean is_gopher = FALSE; |
37 |
|
38 |
gimp_progress_init (_("Connecting to server")); |
39 |
|
40 |
@@ -194,13 +199,52 @@ |
41 |
|
42 |
curl_easy_getinfo (curl_handle, CURLINFO_RESPONSE_CODE, &response_code); |
43 |
|
44 |
- if (response_code != 200) |
45 |
+ /* protocol could be not specified in provided uri |
46 |
+ get complete url guessed by curl */ |
47 |
+ curl_easy_getinfo (curl_handle, CURLINFO_EFFECTIVE_URL, &eff_url); |
48 |
+ |
49 |
+ /* detect uri protocol */ |
50 |
+ if (! g_ascii_strncasecmp (eff_url, "http://", 7)) |
51 |
+ { |
52 |
+ is_http = TRUE; |
53 |
+ proto = "HTTP"; |
54 |
+ } |
55 |
+ else |
56 |
+ if (! g_ascii_strncasecmp (eff_url, "https://", 8)) |
57 |
+ { |
58 |
+ is_http = TRUE; |
59 |
+ proto = "HTTPS"; |
60 |
+ } |
61 |
+ else |
62 |
+ if (! g_ascii_strncasecmp (eff_url, "ftp://", 6)) |
63 |
+ { |
64 |
+ is_ftp = TRUE; |
65 |
+ proto = "FTP"; |
66 |
+ } |
67 |
+ else |
68 |
+ if (! g_ascii_strncasecmp (eff_url, "ftps://", 7)) |
69 |
+ { |
70 |
+ is_ftp = TRUE; |
71 |
+ proto = "FTPS"; |
72 |
+ } |
73 |
+ else |
74 |
+ if (! g_ascii_strncasecmp (eff_url ,"gopher://", 9)) |
75 |
+ { |
76 |
+ is_gopher = TRUE; |
77 |
+ proto = "GOPHER"; |
78 |
+ } |
79 |
+ else |
80 |
+ { |
81 |
+ proto = "UNKNOWN"; |
82 |
+ } |
83 |
+ |
84 |
+ if (! ((is_http && response_code == 200) || (is_ftp && response_code == 226) || (is_gopher))) |
85 |
{ |
86 |
fclose (out_file); |
87 |
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, |
88 |
- _("Opening '%s' for reading resulted in HTTP " |
89 |
+ _("Opening '%s' for reading resulted in %s " |
90 |
"response code: %d"), |
91 |
- uri, response_code); |
92 |
+ uri, proto, response_code); |
93 |
curl_easy_cleanup (curl_handle); |
94 |
return FALSE; |
95 |
} |