An extract from the manual for the curl package reads:

Using --anyauth is not recommended if you are doing uploads from stdin, since it may require the data to be sent twice and the client must be able to rewind

So my two questions here are why specifically would the data be required to be sent twice, since this just seems to not make sense in itself, and what does it mean when it refers to the client being capable of "rewind"?


The description of --anyauth says

Tells curl to figure out authentication method by itself, and use the most secure one the remote site claims to support. This is done by first doing a request and checking the response-headers, thus possibly inducing an extra network round-trip.

It works by sending the request with no authentication, and then determining from the response (a) whether another request is necessary and (b) which form of authentication it should use. The typical scenario is that the server responds to the request with a 401, with information in the headers indicating which types of authentication it will accept.

To be able to send the request twice, curl needs to be able to re-read the data (it doesn’t memorise it) — this is what is meant by “rewind”. Pipes are not seekable, so a pipe used to feed data to curl reading from its standard input means that curl can’t re-read the input data, and thus --anyauth can’t be used reliably.

  • Thanks Stephen as far as developing a working understanding of everything related to this package,Is it the right idea to be reading these RFC1630 and RFC1736 documents referenced in the manual, or is too much of it likely to go over the top of my head at a novice stage? – Adam May 6 '19 at 19:23
  • 1
    1630 and 1736 aren’t the easiest ones to start with; I’d suggest 2616 which explains HTTP quite well and will tell you more about what curl does. Once you’ve worked your way through that, read 7230–7235 which are the current definition of HTTP/1.1. (Or you could try starting with 7230; I’m biased in favour of 2616 and its predecessor, 2068, because that’s where I learned /1.1 back in the day.) – Stephen Kitt May 6 '19 at 19:30
  • great very helpful indeed that's really what I needed, like a chronology or order to properly digest them before I even start I mean its a lot of information to take in and having a quick look at 1630 and 1736 didn't give me much encouragement as you said, but gut instinct wise as far as what ive read about the internet from a historical perspective they seem like pretty fundamental things I need to understand, just sad im literally the laziest human being on earth when it comes to reading lol – Adam May 6 '19 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.