Re: Patch for mailto: link urlencoding
Jon Nathan <[email protected]>
| Newsgroups | gmane.mail.squirrelmail.devel |
|---|---|
| Message-ID | <[email protected]> |
* Michael A. Puls II <[email protected]> [01-06-2010 23:03]: > > 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> SM doesn't recognize this as a valid mailto: link, either with or without my patch. > <mailto:?to=1+2&subject=1+2&body=1+2&cc=1+2&bcc=1+2> It sees this as a mailto: link and sets: To: 1+2&subject with my patch. Looks like I am urlencoding the ampersand unnecessarily. Without my patch, it sets: To: 1 2 Cc: 1 2 Bcc: 1 2 Subject: 1 2 Body: 1 2 That is, it sets them all properly, albeit without the plus sign.. > -------- > > in the message body and send it, in the received message, will SM show > them via the following markup? > > <pre> > <<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>> > > <<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>> > </pre> > > That might be something to test. > > -- > Michael Thanks for your feedback. What do you think the appropriate way to adress this is? I'd hate to only urlencode specific characters. Thanks, -Jon ------------------------------------------------------------------------------ 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