Brian Hurt
unread,Nov 9, 2009, 9:27:23 AM11/9/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to cloju...@googlegroups.com
Hi. At work we have a need for the ability to do a non-interning keyword lookup. Basically, we're getting data from the outside world that is sending us keywords. What we're afraid of is a DOS attack where a client sends us a whole bunch of garbage keywords which we then intern, sucking down all of our memory. On the other hand, maintaining a white list of known-good keywords is annoying and error prone. So what we want is a function that, given a string, returns the keyword of the string if that keyword has already been interned, or nil if it hasn't (and don't intern the new keyword). That way we bounce requests that use keywords we don't understand and don't run the risk of a DOS attack.
So what I'd like to add is a couple of small functions to the Keyword class- please see the attached diff. I don't think that Clojure wrapper functions are necessary. In the odd corner case these functions are necessary, the extra overhead of importing clojure.lang Keyword and calling the functions directly is not onerous.
Brian