Be aware of space when issuing HTTP request

Use netcat to issue HTTP request:

# nc -cv www.google.com https
Connection to www.google.com 443 port [tcp/https] succeeded!
......
GET / HTTP/1.1
Host: www.google.com
 Connection: close

HTTP/1.1 400 Bad Request
Content-Length: 54
Content-Type: text/html; charset=UTF-8
Date: Mon, 27 Aug 2018 09:37:22 GMT
Connection: close

<html><title>Error 400 (Bad Request)!!1</title></html>

A superfluous space before “Connection: close” will cause error response. Be aware of it!

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.