[plt-scheme] Mailto Not Working in Help Desk (see PR 6241)

From: Williams, M. Douglas (M.DOUGLAS.WILLIAMS at saic.com)
Date: Fri Dec 30 11:25:14 EST 2005

Would it be better to have: it never works (the current situation), works at
least sometimes (the current fix), it explicitly says it doesn't work (a
fairly easy fix), or fully implemented (maybe a hard fix)?  One can probably
justify any answer but the first.

The current (general) parser just breaks mailto: up into simple fields.
Does it always put the entire address into the path field?  If not, a very
simple parser can do this.  This would work for well-formed urls, but won't
catch bad ones.  

Is there any other PLT Scheme code using the mailto: url that does work?  

The code the browser (and thus the Help Desk) uses just turns it back into a
string and uses that.  Can we use a naïve parser for the browser until a
fully implemented one is available?

Just some thoughts.
Doug

> -----Original Message-----
> From: Robby Findler [mailto:robby at cs.uchicago.edu]
> Sent: Friday, December 30, 2005 8:58 AM
> To: Williams, M. Douglas
> Cc: plt-scheme
> Subject: Re: [plt-scheme] Mailto Not Working in Help Desk (see PR 6241)
> 
> The url parser is not really set up for mailto urls at all. The fix you
> suggest doesn't work in general.n According to rfc1738, this is the
> syntax of a mailto url:
> 
>  mailto:<rfc822-addr-spec>
> 
> and that syntax doesn't conform to the standard url syntax at all, so
> there needs to be specialized url parsing, and presumably a new struct,
> and this means that lots and lots of code may have to change.
> 
> That's why I haven't gotten to this yet.
> 
> Thanks,
> Robby
> 
> At Fri, 30 Dec 2005 07:36:40 -0800, "Williams, M. Douglas" wrote:
> > The Help Desk has a neat feature that when it shows doc.txt file, it
> scans
> > them for ftp and http urls and e-mail addresses and displays them as
> links.
> > Unfortunately, the e-mail links don't work correctly - they prepend
> '///' on
> > the front of the e-mail address.  Unfortunately, because of the way
> Outlook
> > works - I'm sure it's a feature - it isn't easy (or possible?) to get
> rid of
> > this in the address line in Outlook 2003.  I came across it when I was
> > submitting my packages to PLaneT and tried to follow the link and it
> didn't
> > work.  (And I then klutzed up typing it and it took even longer.)
> >
> >
> >
> > This bug has apparently been around for a while since Problem Report
> 6241
> > dated May 2, 2003 deals with it in Version 204 and it's still open.  The
> PR
> > is assigned to Robby Findler.
> >
> >
> >
> > It turns out that the problem is in the way urls are parsed into an
> internal
> > format and then turned back into strings.  There is no special parser
> for
> > mailto: urls and for some reason the general url->string function for
> these
> > generic urls adds the three slashes.
> >
> >
> >
> > The following fix to the url->string function in the url-unit.ss file in
> the
> > net collection corrects the problem, but needs to be verified.
> >
> >
> >
> >       (define url->string
> >
> >         (lambda (url)
> >
> >           (let ((scheme (url-scheme url))
> >
> >                 (user (url-user url))
> >
> >                 (host (url-host url))
> >
> >                 (port (url-port url))
> >
> >                 (path (url-path url))
> >
> >                 (query (url-query url))
> >
> >                 (fragment (url-fragment url)))
> >
> >             (cond
> >
> >              ((and scheme (string=? scheme "file"))
> >
> >               (string-append "file:"
> >
> >                        (url->file-path url)
> >
> >                              (or (and (not fragment) "")
> >
> >                                  (string-append "#" fragment))))
> >
> > ;;; added ---v
> >
> >              ((and scheme (string=? scheme "mailto"))
> >
> >               (string-append "mailto:"
> >
> >                              (car path)))
> >
> > ;;; ---------^
> >
> >              (else
> >
> >               (let ((sa string-append))
> >
> >                 (sa (if scheme (sa scheme "://") "")
> >
> >                     (if user (sa (uri-encode user) "@") "")
> >
> >                     (if host host "")
> >
> >                     (if port (sa ":" (number->string port)) "")
> >
> >                                         ; There used to be a "/" here,
> but
> > that causes an
> >
> >                                         ; extra leading slash -- wonder
> why
> > it ever worked!
> >
> >                     (combine-path-strings path)
> >
> >                     ;(if query (sa "?" (uri-encode query)) "")
> >
> >                     (if (null? query) "" (sa "?"  (alist->form-
> urlencoded
> > query)))
> >
> >                     (if fragment (sa "#" (uri-encode fragment))
> ""))))))))
> >
> >
> >
> > This fixes the particular problem with mailto: urls in the help desk.  I
> > can't see that it would break anything else.
> >
> >
> >
> > This fix is based on how the parser actually parses mailto: urls - with
> > url-scheme = "mailto" and url-path = ("<the address>").  One could
> debate
> > that there should be code in the parser to handle mailto: urls, but
> there
> > isn't.
> >
> >
> >
> > Doug
> >
> >
> >
> > M. Douglas Williams, Ph.D.
> >
> > Sr. Scientist
> >
> > Science Applications International Corporation
> >
> > 4B Inverness Drive East, Suite 210
> >
> > Englewood, CO  80112
> >
> > office: (303) 217-4421
> >
> > cell: (303) 229-0315
> >
> > m.douglas.williams at saic.com <mailto:m.douglas.williams at saic.com>
> >
> >
> >
> > _________________________________________________
> >   For list-related administrative tasks:
> >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.