Why is the GET method faster than POST in HTTP?

后端 未结 8 2049
暗喜
暗喜 2020-11-30 02:53

I am new to web programming and just curious to know about the GET and POST methods of sending data from one page to another.

It is said that the GET method is faste

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-30 03:33

    Looking at the http protocol, POST or GET should be equally easy and fast to parse. I would argue, there is no performance difference.

    Take a look at the raw HTTP headers

    http GET

    GET /index.html?userid=joe&password=guessme HTTP/1.1
    Host: www.mysite.com
    User-Agent: Mozilla/4.0
    

    http POST

    POST /login.jsp HTTP/1.1
    Host: www.mysite.com
    User-Agent: Mozilla/4.0
    Content-Length: 27
    Content-Type: application/x-www-form-urlencoded
    
    userid=joe&password=guessme
    

    From my point of view, performance should not be considered when comparing GET and POST.

提交回复
热议问题