Content-Range indicates which range of the original entity is contained in the body of either a request (like your PUT request) or a 206 partial response. Range is set by the client not the server in order to request a sub-range. I would assume that the server you are talking to will not respond with the uploaded chunk, so a Content-Range (and Range in no case) will not be present as a response header.

In your code snippet the actual upload range is missing for Content-Range (see the updated HTTP RFC). It has to have the form of:

Content-Range: bytes 42-1233/1234

which means: upload byte 42-1233 of an entity whose total size is 1234 byte.

Or when the complete length is unknown:

Content-Range: bytes 42-1233/*

So remove the check for the Range header and specify the complete upload range and you should be fine.