how to create 400 bad request so that I can verify

2019-07-22 11:42发布

问题:

currently I am doing a work to handle the 400 bad request status error. I am wondering how to create a request that server will return 400 status.

回答1:

A HTTP 400 error occurs due to bad syntax in the request.

To create a request that forces the server to return a 400 error, you can:

  1. Open a TCP connection to port 80 on your server
  2. Send junk
  3. Observe response.


回答2:

I found an easy way to generate 400 Bad Request Error:

Appending /% at the end of the URL should work for most websites.

For example:

http://abc.go.com/%
http://www.checkupdown.com/%
https://www.oath.com/%
https://www.apple.com/%

The above URLs generate the following page:

Note that this method doesn't work for ALL websites on the internet.

Since the server can decide what to do when seeing /%.



标签: http