Bug fix for setCustomPostDataEncodingHandler, and additional support for iOS 4

See commit descriptions for details