Included a bunch of code from http-conduit