404 not found in telnet, works fine in browser

I have a very annoying problem when I open the URL ( http://celebs.widewallpapers.net/md/a/adriana-lima/1440/Adriana-Lima-1440x900-002.jpg ) in the browser, it works fine .. but when I try to access it via telnet on bash, I get 404 not found !!

my exact terminal:

$ telnet celebs.widewallpapers.net 80

HEAD / md / a / adriana-lima / 1440 / Adriana-Lima-1440x900-002.jpg HTTP / 1.0 [login] [login]

HTTP / 1.1 404 Not Found

Server: nginx

Date: Sun, May 23, 2010 9:36:05 PM GMT

Content-Type: text / html; encoding = windows-1251

Content-Length: 166 Connection: close

please help me with this as I am trying to make a C-batch bootloader that almost works the same as telnet.

+4
source share
1 answer

You are not passing the host header. In accordance with HTTP / 1.1, you need to tell the web server which virtual host you want to talk to. And 99% of servers today will only speak HTTP / 1.1, even if you specify HTTP / 1.0 in the request.

jb@apto % telnet celebs.widewallpapers.net 80 ... HEAD /md/a/adriana-lima/1440/Adriana-Lima-1440x900-002.jpg HTTP/1.1 Host: celebs.widewallpapers.net HTTP/1.1 200 OK Server: nginx Date: Sun, 23 May 2010 22:08:36 GMT Content-Type: image/jpeg Connection: close Last-Modified: Sun, 27 Apr 2008 14:30:17 GMT ETag: "4784e0-264b0-48148df9" Accept-Ranges: bytes Content-Length: 156848 Connection closed by foreign host. 
+10
source

Source: https://habr.com/ru/post/1310672/


All Articles