Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

name being used to stringify keywords #50

Open
trevor opened this issue Jul 27, 2014 · 0 comments
Open

name being used to stringify keywords #50

trevor opened this issue Jul 27, 2014 · 0 comments

Comments

@trevor
Copy link

trevor commented Jul 27, 2014

1-

In message.clj there's:

(defn add-extra! [^javax.mail.Message jmsg msgrest]
  (doseq [[n v] msgrest]
    (.addHeader jmsg (if (keyword? n) (name n) n) v))
  jmsg)

However name treats the slash / character as a delimiter.

For instance, the nonstandard header field as a keyword:

(send-message {:from "[email protected]"
               :to "[email protected]"
               :subject "Hi!"
               :body "Test."
               :X-ISO/IEC-ID-1 "test1"
               "X-ISO/IEC-ID-2" "test2"})

Is truncated to:

IEC-ID-1: test1
X-ISO/IEC-ID-2: test2

Maybe some sort of helper function like this to replace instances of name?

(defn k2s [k]
  (if (keyword? k)
    (subs (str k) 1)
    k))

2-

I wasn't sure, but it looks like slashes are valid characters for header fields according to the RFC.

Header fields are lines composed of a field name, followed by a colon
(":"), followed by a field body, and terminated by CRLF.  A field
name MUST be composed of printable US-ASCII characters (i.e.,
characters that have values between 33 and 126, inclusive), except
colon.

http://tools.ietf.org/html/rfc2822#section-2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant