Basic HTTP Out - wget with cookies

I am using the following command to fetch data from a site:

wget http://www.example.com --user=joe --password=schmoe --auth-no-challenge

      

I am expanding this to be recursive, however my understanding is that this will retry HTTP Auth on every request.

Hence, is it possible to run Basic HTTP Auth once, grab the cookies, and then run a recursive download with those cookies?

This does not work:

wget --save-cookies=cookies.txt --user=joe --password=schmoe --auth-no-challenge http://www.example.com

      

Followed by:

 wget --load-cookies=cookies.txt -r -p http://www.example.com/pages.html

      

+3


source to share


1 answer


HTTP Basic authentication scheme is not persistent, cookie (e.g. Carrier Scheme (e.g. Oauth2), so credentials will have to be passed on all subsequent requests. The exception will be at the "application" level if the browser caches the credentials, but this is a browser convenience constructor (one of which minimum control ) and will not apply in this situation wget

.

Here is a good summary of the disadvantages of HTTP Basic, including the fact that credentials must be sent with every request .



Review the Hypertext Protocol (HTTP) Authentication Protocol for a complete list of authentication schemes.

+1


source







All Articles