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.

I´m using proxy and don´t have problems with anything except cURL.

Anytime i try to do:

curl -L http://link.to.something

i receive:

curl: (5) Couldn't resolve proxy 'http'

Nevertheless:

curl --proxy http://myproxy.com:8080 -L http://link.to.something

will work good.

Is there any solution for not writing --proxy everytime?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

From man curl:

-x, --proxy <[protocol://][user@password]proxyhost[:port]>

 Use the specified HTTP proxy. 
 If the port number is not specified, it is assumed at port 1080.

For general use, declare environment variables for http/https

export http_proxy=http://your.proxy.server:port/
export https_proxy=$http_proxy
  1. edit /etc/bash.bashrc add to the end of file :
    export http_proxy=http://username:password@proxyserver.com:port/
    export https_proxy=$http_proxy
    export ftp_proxy=http://username:password@proxyserver.com:port/
  • OR proxy no username and password case - :
    export http_proxy=http://proxyserver.com:port/
    export https_proxy=$http_proxy
    export ftp_proxy=http://proxyserver.com:port/
share|improve this answer
    
seems like i lacked export https_proxy=$http_proxy line in my ~/.bashrc. Thank you. –  ted Feb 8 '13 at 8:35
add comment

What happens is that you have a http_proxy environment variable set. By default curl tries to use that first. Your http_proxy is also apparently invalid. To see what you have there, type:

echo $http_proxy

You'd need to check where you're setting http_proxy and fixing that so that it points to the correct one.

The other answer is much more complete than mine :)

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.