projects
/
functorrent.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f53654d
)
refactor urlEncode
author
Ramakrishnan Muthukrishnan
<ram@rkrishnan.org>
Sun, 15 Feb 2015 10:17:32 +0000
(15:47 +0530)
committer
Ramakrishnan Muthukrishnan
<ram@rkrishnan.org>
Sun, 15 Feb 2015 10:17:32 +0000
(15:47 +0530)
src/Tracker.hs
patch
|
blob
|
history
diff --git
a/src/Tracker.hs
b/src/Tracker.hs
index 75c3a00c09505ab737e34fcdf6f97e912a608a1d..51877d72963352a19e704c33e2b4a7dd662cacda 100644
(file)
--- a/
src/Tracker.hs
+++ b/
src/Tracker.hs
@@
-22,15
+22,12
@@
urlEncode bs = concatMap (encode . BC.unpack) (splitN 2 bs)
in
escape c c1 c2
encode _ = ""
- escape i c1 c2 | isAsciiUpper i ||
- isAsciiLower i ||
- isDigit i ||
- i == '-' ||
- i == '_' ||
- i == '.' ||
- i == '~'
- = [i]
+ escape i c1 c2 | i `elem` nonSpecialChars = [i]
| otherwise = "%" ++ [c1] ++ [c2]
+ where nonSpecialChars = ['A'..'Z'] ++
+ ['a'..'z'] ++
+ ['0'..'9'] ++
+ ['-', '_', '.', '~']
-- (chr . read . ("0x" ++) . BC.unpack)
-- connect :: Url -> String -> IO (Benc.BVal)