reconstructure curl code

reconstructure curl code
add a detect function for config arguments.