最小 http 服务器回复 [英] minimum http server reply
问题描述
我正在尝试使用 AVR + ESP8266 构建 http 服务器.
Iam trying to build a http server with and AVR + ESP8266.
我可以通过 telnet 来回发送命令,但现在我想实现一个 Web 界面
I can send commands back and forth via telnet, but now i want to implement a web interface
作为起点,我尝试建立一个输出文本"的网站但是,浏览器会显示一个空白页面.有人可以让我知道将页面解释为 html 的最低要求吗?
As a starting point I tred to setup a website that outputs "text" however, the browser displays an empty page. Can someone please let me know the minimum requirements for interpreting the page as html?
远程登录 192.168.2.26 81正在尝试 192.168.2.26...连接到 192.168.2.26.转义字符是^]".
telnet 192.168.2.26 81 Trying 192.168.2.26... Connected to 192.168.2.26. Escape character is '^]'.
GET/HTTP/1.1
GET / HTTP/1.1
下面的 AVR 答案
HTTP/1.1 200 OK
Content-Type: text/html
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Zeitschaltuhr</title></head>
<body>
Text
</body></html>
Connection closed by foreign host.
推荐答案
Minimal http answer:
Minimal http answer:
HTTP/1.1 404
Content-Length: 0
最小文本答案:
HTTP/1.1 200 OK
Content-Length: 13
Content-Type: text/plain; charset=utf-8
Hello World!
它对您不起作用的原因是您忘记了 Content-Length: 标头
The reason it does not work for you is that you forgot the Content-Length: header
这篇关于最小 http 服务器回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!