Refactor for adapters

Since we couldn't get the timeouts working properly using fopen, adding an adapter for curl that is "close enough". This required some decoupling in the original library.

Also, made it rain with doc blocks and comments, so there's that.