Re: Patch for mailto: link urlencoding

"Michael A. Puls II" <[email protected]>
Newsgroups gmane.mail.squirrelmail.devel
Message-ID <op.u549h4rz1ejg13@sandra-svwliu01>
On Wed, 06 Jan 2010 13:30:54 -0500, Jon Nathan  
<[email protected]> wrote:

> We ran into an issue with squirrelmail 1.4.19.  When you click on
> a mailto: link that has special characters (plus signs, etc), the
> resulting compose.php pane replaces them with spaces.

This is very common with webmails. They often use http-based encoding,  
decoding and parsing functions when dealing with mailto URIs.  
mail.live.com, mail.yahoo.com and mail.google.com are all examples that  
have issues with this in one part of their code or another.

Unfortunately, '+' is allowed to be unencoded in an hfvalue in a mailto  
URI. You have to take that into account when you place that mailto data in  
an http URI. (Of course, an author of a mailto URI should just use %2B  
anyway when they want a + for good measure)

I address this as follows:

1. The function that percent-decodes a mailto hfvalue must not decode '+'  
to ' '.

2. The function that percent-encodes the resulting data gotten from #1  
must percent-encode all '+' to '%2B' if the data will end up in an HTTP  
URI. That way, stuff like PHP's #_GET[] etc. will produce a  
percent-decoded value that matches the original mailto data properly.

3. You can do without #1 though if you take the source mailto URI and  
replace all +'s in it with %2B before percent-decoding.

4. Another alternative is to manually parse the query string and treat the  
data as mailto data where a '+' is a '+' instead of http data where a '+'  
is a ' '.

I can confirm the problem in SM. I didn't test your patch though. Does it  
do the fix for all values (subject, send_to, send_to_cc, send_to_bcc and  
body)?

For example, if you compose a message and put:

--------
<mailto:1+2?subject=1+2&body=1+2&cc=1+2&bcc=1+2>

<mailto:?to=1+2&subject=1+2&body=1+2&cc=1+2&bcc=1+2>
--------

in the message body and send it, in the received message, will SM show  
them via the following markup?

<pre>
&lt;<a  
href="http://smserver.com/src/compose.php?send_to=1%2B2&subject=1%2B2&body=1%2B2&cc=1%2B2&bcc=1%2B2">mailto:1+2?subject=1+2&body=1+2&cc=1+2&bcc=1+2</a>&gt;

&lt;<a  
href="http://smserver.com/src/compose.php?send_to=1%2B2&subject=1%2B2&body=1%2B2&cc=1%2B2&bcc=1%2B2">mailto:?to=1+2&subject=1+2&body=1+2&cc=1+2&bcc=1+2</a>&gt;
</pre>

That might be something to test.

-- 
Michael

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.