Skip to content

Commit

Permalink
[Issue #206] Replacing stringByAddingPercentEncodingWithAllowedCharac…
Browse files Browse the repository at this point in the history
…ters with CFURLCreateStringByAddingPercentEscapes to prevent out-of-memory exception
  • Loading branch information
mattt committed Nov 6, 2014
1 parent 66fde65 commit 28df82e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Alamofire.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public enum ParameterEncoding {
}

func escape(string: String) -> String {
let allowedCharacters = NSCharacterSet(charactersInString:" =\"#%/<>?@\\^`{}[]|&+").invertedSet
return string.stringByAddingPercentEncodingWithAllowedCharacters(allowedCharacters) ?? string
let legalURLCharactersToBeEscaped: CFStringRef = ":/?&=;+!@#$()',*"
return CFURLCreateStringByAddingPercentEscapes(nil, string, nil, legalURLCharactersToBeEscaped, CFStringBuiltInEncodings.UTF8.rawValue)
}
}

Expand Down

0 comments on commit 28df82e

Please sign in to comment.