Home > other >  Consult everybody a great god HTTP
Consult everybody a great god HTTP

Time:09-29

Recently to use C language make a HTTP client, URL should be true, but when send a POST request to the server, always receive a 401 error, using the browser login URL that is no problem, here's my POST request head, please have a look at what's the problem:
Post_head="HTTP/1.1 POST % s \ r \ n"
Host: "% s \ r \ n"
"Connect: keep - the alive \ r \ n"
"The user-agent: Mozilla \ r \ n"
"Catch - Control: no store \ r \ n"
"The content-type: application \ json \ r \ n"
"Accept: */* \ r \ n"
"The Content - Length: % d \ r \ n"
"The \ r \ n
""% s"

CodePudding user response:

It's convenient for the URL to send, generally do not need to Request to the Content - Length

CodePudding user response:

Just react, your method using the POST method, are commonly when browser to access the GET method, although the URL, but if the method is different, also considered to find resources,
Change the POST to GET,
  • Related