【发布时间】:2012-11-21 20:01:39
【问题描述】:
我们使用 telnet 机制向服务器发送 http 请求并获得响应。 在使用 telnet 发送 HTTP GET 请求时,我们注意到了一件奇怪的事情。 第一种方法适用于大多数环境,但不适用于其中一个环境。但是第二种方法(而不是相对路径,使用完整路径)在这种环境下工作正常。
**
- 方法一:
**
(printf "GET /test.jsp HTTP/1.0\nAccept: */*\nUser-Agent: WatchDog\n\n"; sleep 9) |远程登录 xx.xx.xx.xx 8093 正在尝试 xx.xxx.xx.xx... 连接到 xx.xx.xx.xx。 转义字符是'^]'。
连接被外部主机关闭。
**
- 方法二:
**
(printf "GET http://xx.xx.xx.xx:8093/test.jsp HTTP/1.0\nAccept: */*\nUser-Agent: WatchDog\n\n"; sleep 9) |远程登录 xx.xx.xx.xx 8093
Trying xx.xx.xx.xx...
Connected to xx.xx.xx.xx.
Escape character is '^]'.
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=91643475E80038EA8770CE6803EE320C; Path=/
Content-Type: text/html;charset=UTF-8
Content-Language: zh-US
Content-Length: 42
Date: Mon, 03 Dec 2012 04:25:09 GMT
Connection: close
The Server is Running
Connection closed by foreign host.
为什么method1 不能只在一个环境中运行?我们需要在那个环境中检查一些东西吗?
请提出您的建议...
谢谢, 塞卡
【问题讨论】: