0

I am beginner. I am trying to load HTTP URL using curl in my Ubuntu terminal.

The command I am using is

curl -L 'http://google.com'

But instead of getting source code. I am getting below error

curl: (56) Recv failure: Connection reset by peer

when I change the URL to https://google.com then no error is coming and perfectly working.

Why and how to make it work even for HTTP?

3
  • Strangely, I do get a response: $ curl -L http://google.com <!doctype html><html itemscope="" ... and the same for https: $ curl -L https://google.com <!doctype html><html itemscope="" You can try and telnet to it on port 80 (telnet google.co.uk 80) and it'll hang for ages. Type ^] to get out of it, and you'll see a load of HTML come back. When I do the same with HTTPS (telnet google.co.uk 443), you don't get anything back. Commented Dec 20, 2022 at 0:44
  • Telnet on port 80: $ telnet google.com 80 Trying 172.217.169.78... Connected to google.com. Escape character is '^]'. ^] HTTP/1.0 400 Bad Request Content-Type: text/html; charset=UTF-8 Referrer-Policy: no-referrer Content-Length: 1555 Commented Dec 20, 2022 at 0:46
  • Telnet on port 443: $ telnet google.com 443 Trying 172.217.169.78... Connected to google.com. Escape character is '^]'. ^] FConnection closed by foreign host. Commented Dec 20, 2022 at 0:47

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.