Send HTTP request manually via socket

后端 未结 4 691
[愿得一人]
[愿得一人] 2020-11-28 05:15

When I send a normal HTTP request via a socket, the server does not respond with an OK response. I copied the HTTP header from Firefox. Here is the code:

Soc         


        
4条回答
  •  失恋的感觉
    2020-11-28 06:07

    Two things:

    1. You should use println instead of print to print your entries to separate lines.
    2. HTTP request should end in a blank line (link). So add pw.println("");

提交回复
热议问题