MB-11699 Use HTTP status code to detect successful upload.

curl doesn't indicate HTTP errors by setting non-zero exit status
unless --fail flag is used. The latter though said to be unreliable in
the man page. So we ask curl to print http status code to stdout and
use it to detect if upload was successful.

Change-Id: I333ff7ca416989b3c88eac8e926c9bb4451b3959
Reviewed-on: http://review.couchbase.org/39331
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>