Implement seek function for multi-pass authentication uploads

As per the documentation: This function gets called by libcurl to seek
to a certain position in the input stream and can be used to fast
forward a file in a resumed upload (instead of reading all uploaded
bytes with the normal read function/callback). It is also called to
rewind a stream when doing a HTTP PUT or POST with a multi-pass
authentication method.
trim newlines from empty lines
extend test case to show the return bug