Use the port number from the URL

- http://www.somewhere.com:8001/somepath should work properly now
Handle http errors so node.js doesn't crash.
Fix content length calculation

Before, the length was 2 bytes shorter than the data being sent, so the
remote end would reset the connection before all the data was sent.

Used Buffer.byteLength() instead of plain string length so that we don't
run into trouble when non-ASCII characters are present.
Let the user specify the content type directly.
Use text as the default MIME type.
Merge pull request #3 from gburca/master

Use the port number from the URL