i on the other hand just had a situation where i was forced to recompile curl to link with openssl.
linking with gnutls caused connecting to a particular IIS web service to throw this "-9 unexpected length" error. [1] found no medicine other than to stick with openssl. [1]: http://curl.haxx.se/mail/archive-2011-02/0005.html