merge patch from Janez Troha for cors handling

This is largely untested by me but is relatively minor in impact. It adds the options
method and returns some extra headers for html5 parsing. Some minor fixups from original
patch for expected use.
compile fix up if no libcurl in the build

just a function move into an ifdef test to avoid compiling.