我正在编写一个C套接字程序,以将http2请求发送到我的Microsoft IIS服务器。以下是我当前发送的请求:
char *msg ="HEADERS\r\n+END_STREAM\r\n+END_HEADERS\r\n:method=GET\r\n:scheme=https\r\n:path=/\r\nhost=newsite.xyz.com\r\naccept=*/*\r\n\r\n";
我是http2协议的新手,也是我第一次基于RFC7540
提出请求在执行上述语句的套接字程序执行后,出现以下错误:
Connected with ECDHE-RSA-AES256-GCM-SHA384 encryption
Received: "HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Tue, 02 Jul 2019 16:25:32 GMT
Connection: close
Content-Length: 326
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Verb</h2>
<hr><p>HTTP Error 400. The request verb is invalid.</p>
</BODY></HTML>
"
C Socket程序的其他部分正确,并且已经针对其他https请求进行了测试。