[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GSMimeParser scanToken: and empty quoted strings
From: |
Richard Frith-Macdonald |
Subject: |
Re: GSMimeParser scanToken: and empty quoted strings |
Date: |
Fri, 7 Oct 2011 19:31:13 +0100 |
On 7 Oct 2011, at 15:24, Niels Grewe wrote:
> Hello,
>
> I just ran into a little problem with the GSMimeParser in conjunction
> with the authentication stuff in NSURL:
> GSMimeParser's -scanToken: method returns nil if it scans an empty
> quoted string, and this causes problems if a HTTP server announces an
> empty realm for authentication because the corresponding
> NSURLProtectionSpace is not created correctly.
>
> The trivial fix is to return @"" instead of nil when scanning empty
> strings, but I wanted to check whether there was a good reason for the
> present behaviour.
I can't immediately think of one ... and a quick look at the usage of the
method in base seems to show that changing it to return an empty string would
do no harm.
In fact, having it scan "" as an empty string seems more consistent/intuitive
than returning nil.