Requirements for GET HTTP/1.0 and Request Heads

Asked 1 years ago, Updated 1 years ago, 72 views

When I started learning about HTTP, I suddenly got an error and I don't know how to solve it, so let me ask you a question.

$telnet www.httpbin.org 80

Yes
GET/ip HTTP/1.0 as follows:

 Connected to www.httpbin.org.herokudns.com.
Escape character is'^]'.
GET/ip HTTP/1.0

HTTP/1.1400 Bad Request
Server:Cowboy
Date: Sun, 19 Aug 2018 09:27:06 GMT
Content-Length: 0

Connection closed by foreign host.

and Bad Request.It should say 302 Found, what should I do?

This is a rudimentary question, but I appreciate your cooperation

Add Questions
In the request header

Host: www.httpbin.org

It would be good to add that, but why do I need to do this?

http https

2022-09-30 21:33

1 Answers

There may not be enough headers in your request.The destination seems to be a virtual host, so I think you are requesting a Host: header.

$telnet www.httpbin.org 80
Trying 52.44.174.39...
Connected to www.httpbin.org.herokudns.com.
Escape character is'^]'.
GET/ip HTTP/1.1
Host: www.httpbin.org
Accept: */*

HTTP/1.1200 OK
Connection:keep-alive
Server:gunicorn/19.9.0
Date: Sun, 19 Aug 2018 10:28:07 GMT
Content-Type: application/json
Content-Length—32
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Via: 1.1 vegur

{
  "origin": "125.30.32.159"
}
Connection closed by foreign host.


2022-09-30 21:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.