Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ángel
evolution
Commits
c8a922ec
Commit
c8a922ec
authored
Oct 21, 2010
by
Milan Crha
Browse files
Bug #631526 - Loading images doesn't use proxy credentials
parent
bf5e4aed
Changes
1
Hide whitespace changes
Inline
Side-by-side
mail/em-utils.c
View file @
c8a922ec
...
...
@@ -1160,6 +1160,69 @@ em_utils_folder_is_outbox (CamelFolder *folder, const gchar *uri)
static
EProxy
*
emu_proxy
=
NULL
;
static
GStaticMutex
emu_proxy_lock
=
G_STATIC_MUTEX_INIT
;
/* encode to string this way, because soup_uri_to_string doesn't include passwords */
static
gchar
*
suri_to_string
(
SoupURI
*
suri
)
{
GString
*
uri
;
gchar
*
tmp
;
if
(
!
suri
)
return
NULL
;
uri
=
g_string_sized_new
(
20
);
if
(
suri
->
scheme
)
g_string_append_printf
(
uri
,
"%s:"
,
suri
->
scheme
);
if
(
suri
->
host
)
{
g_string_append
(
uri
,
"//"
);
if
(
suri
->
user
)
{
tmp
=
soup_uri_encode
(
suri
->
user
,
":/;#@?
\\
"
);
g_string_append
(
uri
,
tmp
);
g_free
(
tmp
);
}
if
(
suri
->
password
)
{
g_string_append_c
(
uri
,
':'
);
tmp
=
soup_uri_encode
(
suri
->
password
,
":/;#@?
\\
"
);
g_string_append
(
uri
,
tmp
);
g_free
(
tmp
);
}
if
(
suri
->
user
||
suri
->
password
)
g_string_append_c
(
uri
,
'@'
);
if
(
strchr
(
suri
->
host
,
':'
))
{
g_string_append_c
(
uri
,
'['
);
g_string_append
(
uri
,
suri
->
host
);
g_string_append_c
(
uri
,
']'
);
}
else
{
tmp
=
soup_uri_encode
(
suri
->
host
,
":/"
);
g_string_append
(
uri
,
tmp
);
g_free
(
tmp
);
}
if
(
suri
->
port
&&
!
soup_uri_uses_default_port
(
suri
))
g_string_append_printf
(
uri
,
":%d"
,
suri
->
port
);
if
(
!
suri
->
path
&&
(
suri
->
query
||
suri
->
fragment
))
g_string_append_c
(
uri
,
'/'
);
}
if
(
suri
->
path
&&
*
suri
->
path
)
g_string_append
(
uri
,
suri
->
path
);
if
(
suri
->
query
)
{
g_string_append_c
(
uri
,
'?'
);
g_string_append
(
uri
,
suri
->
query
);
}
if
(
suri
->
fragment
)
{
g_string_append_c
(
uri
,
'#'
);
g_string_append
(
uri
,
suri
->
fragment
);
}
return
g_string_free
(
uri
,
FALSE
);
}
static
gpointer
emu_proxy_setup
(
gpointer
data
)
{
...
...
@@ -1191,7 +1254,7 @@ em_utils_get_proxy_uri (const gchar *pUri)
}
if
(
e_proxy_require_proxy_for_uri
(
emu_proxy
,
pUri
))
uri
=
s
oup_
uri_to_string
(
e_proxy_peek_uri_for
(
emu_proxy
,
pUri
)
,
FALSE
);
uri
=
suri_to_string
(
e_proxy_peek_uri_for
(
emu_proxy
,
pUri
));
g_static_mutex_unlock
(
&
emu_proxy_lock
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment