This can be caused by session ID caching.
Some SSL implementations don't like it and raise the unknown protocol error. Using the --no-sessionid option in the curl command can fix this.