Re: [PATCH RFC3.5 08/12] send-email: Move Subject sanitization from --compose code to send_message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 19, 2009 at 09:13, Jay Soffian <jaysoffian@xxxxxxxxx> wrote:
> I think I was not clear. My suggestion was to move the /[^[:ascii:]]/
> check to the inside of quote_rfc2047 exactly so that it doesn't always
> change its input. i.e.

Ah. However, there is still the question of whether the actual email
headers are present to declare the right encoding. I don't know enough
to comment on this, though; before this patch, this quoting was
performed by code that new to right the correct "Content-Type" and
"Content-Transfer-Encoding" headers. I suppose I'll have to read the
RFC.

>
>>        sub quote_rfc2047 {
>>                local $_ = shift;
>
> Add this:
>                 return $_ unless /[^[:ascii:]]/;
>
>>                my $encoding = shift || 'utf-8';
>>                s/([^-a-zA-Z0-9!*+\/])/sprintf("=%02X", ord($1))/eg;
>>                s/(.*)/=\?$encoding\?q\?$1\?=/;
>>                return $_;
>>        }
>
> This simplifies things for the function caller I think.

I'm morally opposed to this kind of thing. The caller should be
required to test whether quote_rfc2047() is required, as it's not the
job of quote_rfc2047 to validate. Suppose that quote_rfc2047 were
actually part of a library of useful functions that my program
imports. Perhaps my program knows that it must always quote some piece
of text. Why, then, should my program be forced to waste the cycles to
perform a useless test?

IMnsHO, verification should always be done by the caller with one
exception: Interactive (human) input should always be verified,
because humans represent an unreliable component in the system (in
terms of digital systems, their asynchronous input must be
synchronized with the clocked system). WIth this model, there's are
fewer wasted cycles, because you can reuse verification across similar
functions, and the code (particularly library code) is easier to
understand.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]