开发者

PuTTY returns jumbled HTML when testing my server

I'm writing a small web-server to generate a web interface for a project. The environment I'm using is LabVIEW, because it's what I'm most familiar with.

The problem is that when I send it GET / HTTP/1.1 with PuTTY, it returns

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
<html>
Content-Length: 52
<head>
foo
</head>
<body>
bar
</body>
</html>

LabVIEW says the string being sent out is:

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 52
<html>
<head>
foo
</head>
<body>
bar
</body>
</html>

When opening the HTML file in the web browser directly, it opens properly. When requesting it from the server program, the page doesn't finish loading, and never displays anything. I'm fairly sure the HTML is valid.

How can I debug this better? Am I missing a setting in P开发者_开发技巧uTTY? Do I need to talk to National Instruments?


First, note that this isn't valid HTTP as there's supposed to be a blank line after the last header; that might be the problem with viewing in a browser.

Secondly, I bet you're not printing all the text at once, but rather printing the headers through some channel separate from the HTML, so they can get interleaved. Make sure you're using the same pipe to send all the data.


You could try to connect using windows telnet from the command line. Might possibly give you another clue.

Also, try to turn on logging in PuTTY and have a look at the logfile with a HEX-Editor. Maybe there are some "weird" characters in between which confuse the output - you never know.

And: Check that you are connecting with PuTTY using the "Raw" connection type and not "Telnet".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜