* [gentoo-commits] gentoo-x86 commit in media-gfx/gimp/files: gimp-2.6.11-file-uri.patch
@ 2011-09-02 17:39 Sebastian Pipping (sping)
0 siblings, 0 replies; only message in thread
From: Sebastian Pipping (sping) @ 2011-09-02 17:39 UTC (permalink / raw
To: gentoo-commits
sping 11/09/02 17:39:01
Added: gimp-2.6.11-file-uri.patch
Log:
media-gfx/gimp: Apply file-uri patch by upstream (bug #372941)
(Portage version: 2.1.10.11/cvs/Linux x86_64)
Revision Changes Path
1.1 media-gfx/gimp/files/gimp-2.6.11-file-uri.patch
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
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
Index: gimp-2.6.11-file-uri.patch
===================================================================
--- plug-ins/file-uri/uri-backend-libcurl.c.orig 2011-09-01 09:06:13.307741499 -0500
+++ plug-ins/file-uri/uri-backend-libcurl.c 2011-09-01 09:09:09.066152187 -0500
@@ -62,7 +62,7 @@
vinfo = curl_version_info (CURLVERSION_NOW);
- protocols = g_string_new ("http:,ftp:");
+ protocols = g_string_new ("http:,ftp:,gopher:");
if (vinfo->features & CURL_VERSION_SSL)
{
@@ -153,6 +153,11 @@
CURL *curl_handle;
CURLcode result;
gint response_code;
+ gchar *eff_url = NULL;
+ gchar *proto = NULL;
+ gboolean is_http = FALSE;
+ gboolean is_ftp = FALSE;
+ gboolean is_gopher = FALSE;
gimp_progress_init (_("Connecting to server"));
@@ -194,13 +199,52 @@
curl_easy_getinfo (curl_handle, CURLINFO_RESPONSE_CODE, &response_code);
- if (response_code != 200)
+ /* protocol could be not specified in provided uri
+ get complete url guessed by curl */
+ curl_easy_getinfo (curl_handle, CURLINFO_EFFECTIVE_URL, &eff_url);
+
+ /* detect uri protocol */
+ if (! g_ascii_strncasecmp (eff_url, "http://", 7))
+ {
+ is_http = TRUE;
+ proto = "HTTP";
+ }
+ else
+ if (! g_ascii_strncasecmp (eff_url, "https://", 8))
+ {
+ is_http = TRUE;
+ proto = "HTTPS";
+ }
+ else
+ if (! g_ascii_strncasecmp (eff_url, "ftp://", 6))
+ {
+ is_ftp = TRUE;
+ proto = "FTP";
+ }
+ else
+ if (! g_ascii_strncasecmp (eff_url, "ftps://", 7))
+ {
+ is_ftp = TRUE;
+ proto = "FTPS";
+ }
+ else
+ if (! g_ascii_strncasecmp (eff_url ,"gopher://", 9))
+ {
+ is_gopher = TRUE;
+ proto = "GOPHER";
+ }
+ else
+ {
+ proto = "UNKNOWN";
+ }
+
+ if (! ((is_http && response_code == 200) || (is_ftp && response_code == 226) || (is_gopher)))
{
fclose (out_file);
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
- _("Opening '%s' for reading resulted in HTTP "
+ _("Opening '%s' for reading resulted in %s "
"response code: %d"),
- uri, response_code);
+ uri, proto, response_code);
curl_easy_cleanup (curl_handle);
return FALSE;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-09-02 17:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-02 17:39 [gentoo-commits] gentoo-x86 commit in media-gfx/gimp/files: gimp-2.6.11-file-uri.patch Sebastian Pipping (sping)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox