Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

If I try to download the some http files, Then wget works just fine(eg: wget download_link). But when i try to download https files using wget then I'm getting the following error

http request sent 
403 forbidden

My problem is, I can't download http files in my college wifi. So when I try to download the file, wget will send the http request to the server. Eventually,download will be blocked.

To download the https file, I've used the following command

wget https://download_link

How to download https files(username and password is there in the download link too)

Are there any extra options needed with wget?

Update:

Initially wget does not support the https downloads in some destribution. We need to compile the source code manually using openssl. After that we can do https downloads

Link to compile the wget using openssl :

How to compile the wget source code

share|improve this question
    
BTW, just for confirmation, what version of Ubuntu are you using? –  Braiam Aug 29 '13 at 14:42
add comment

3 Answers

In order to use the https protocol you will have to add the --secure-protocol=protocol option. The protocol argument can be one of:

  • auto
  • SSLv2
  • SSLv3
  • TLSv1

There are also further related options like --no-check-certificate telling wget to not check server's certificate and many more.

This will prompt for password

wget --user=username --ask-password --no-check-certificate https://foo.bar.com

In this you will have to provide the password

wget --user=username --password --no-check-certificate https://foo.bar.com

Source: GNU Wget manual

share|improve this answer
    
I have already tried all the options, But its still unable to download. Major problem is wget sending its first request in http format, Because of that i'm getting the error message –  Roshan shetty Aug 29 '13 at 13:02
1  
@Roshanshetty is impossible that wget sends the first part as http, since wget do first a ssl handshake directly with the server, then it start to transmit headers and such. I recommend you to edit your question and provide the results of each try. –  Braiam Aug 29 '13 at 13:54
    
@Braiam Finally i got the anwer, initially wget doesn't support https downloads in some destribution, We have to compile the source code and then we can do the https downloads –  Roshan shetty Aug 29 '13 at 13:57
add comment

eg. wget --user=user --password=password --no-check-certificate https://host.domain.tld/directory/file.ext

if the certificate check works you might as well just

wget https://user:password@host.domain.tld/directory/file.ext
share|improve this answer
    
Thanks for the replay I have already tried all the options, But its still unable to download. Major problem is wget sending its first request in http format, Because of that i'm getting the error message –  Roshan shetty Aug 29 '13 at 13:01
1  
Try: sudo apt-get -y install curl && curl https://user:password@host.domain.tld/directory/file.ext -O –  Feczo Aug 29 '13 at 13:27
    
@Roshanshetty why you marked this as your accepted answer if you still have problems? –  Braiam Aug 29 '13 at 13:55
    
@Braiam Because, HTTPS download doesn't wotk without compiling the source code. But once we compiled the source code, We need the some options(described in the above answer) to download the https files –  Roshan shetty Aug 29 '13 at 14:49
    
@Braiam both are answers(my answer as well as Feczo's answer, But i cant make my answer as "solution" till 2 days –  Roshan shetty Aug 29 '13 at 14:51
add comment
up vote 1 down vote accepted

Initially wget does not support the https downloads in some destribution. We need to compile the source code manually using openssl. After that we can do https downloads

Link to compile the wget using openssl :

compile wget using openssl

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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