Allow NULL as value for CURLOPT_CUSTOMREQUEST option.

Added test case.

Refactored the code to isolate the string handling. Fixed return values to use SUCCESS and FAILURE.

Removed unused error variable.

Indentation fix.
Removed the ugly goto.
Fixed expected output of a few cURL test cases