Use Telnet to send HTTP requests for testing

Source: Internet
Author: User

use Telnet to send HTTP requests for testing

In the daily work may send the HTTP request frequently to the server to test, if uses the specialized tool to appear inconvenient, also compared time consuming. And Telnet is one of the more convenient tools.

The first step: Telnet to the target port:

Telnet www.baidu.com 80

If the target machine is normal, the following will occur:

[Root ~]# telnet www.baidu.com 80
Trying 202.108.22.43 ...
Connected to Www.baidu.com (202.108.22.43).
Escape character is ' ^] '.

At this point enter

get/http/1.1
Host:www.baidu.com
Add two return, if everything is OK, the system will return as follows.

[Root ~]# telnet www.baidu.com 80
Trying 202.108.22.43 ...
Connected to Www.baidu.com (202.108.22.43).
Escape character is ' ^] '.
get/http/1.1
Host:www.baidu.com

http/1.1 OK
Date:mon, Nov 2009 07:50:56 GMT
server:bws/1.0
content-length:3520
Content-type:tex t/html;charset=gb2312
Cache-control:private
Expires:mon, Nov 2009 07:50:56 GMT
set-cookie:baiduid= ce207c279a7c9f5a3b05535ebc8e81f0:fg=1; Expires=mon, 09-nov-39 07:50:56 GMT; path=/; domain=.baidu.com
p3p:cp= "OTI DSP COR IVA our IND com"

<body><div Id=u><a href=http://passport.baidu.com/?login&tpl=mn>µçâ¼</a></div> <center><br ><br><br><br><table cellpadding=0 cellspacing=0 Id=l><tr><td><div id=m ><a Onclick=s (This) href=http://news.baidu.com>ðâ&nbsp; îå</a><b>íø&nbsp; Ò³</b><a Onclick=s (This) href=http://tieba.baidu.com>ìù&nbsp;°é</a><a onclick=s (This) Href=http://zhidao.baidu.com>öª&nbsp;µà</a><a Onclick=s (This) Href=http://mp3.baidu.com>mp3 </a><a Onclick=s (This) href=http://image.baidu.com>í¼&nbsp; Ƭ</a><a Onclick=s (This) href=http://video.baidu.com>êó&nbsp; Ƶ</a></div></td></tr></table>
<table cellpadding=0 cellspacing=0 style= "margin-left:15px" ><tr valign=top><td "style= height:62px"; padding-left:92px "Nowrap><form name=f action=s><input type=text name=wd id=kw size=42 maxlength=100> <input type=submit Value=°ù¶èò»ïâid=sb><span id=hp><a href=/gaoji/preferences.html>éèöã</a ><br><a href=/gaoji/advanced.html>¸ß¼¶</a></span></form></td></tr> </table>
<p id=km><a Href=http://hi.baidu.com>¿õ¼ä</a>&nbsp;&nbsp;<a href=http:// Www.hao123.com>hao123</a>&nbsp;|&nbsp;<a Href=/more/>¸ü¶à<span style= "font-family:ëîìå ">>></span></a></p>
<p style=height:60px><table cellpadding=0 cellspacing=0 id=lk><tr><td></td></tr ></table></p>
<p style=height:30px><a onclick= "this.style.behavior= ' url (#default #homepage) '; This.sethomepage (' http:// Www.baidu.com ') "href=http://utility.baidu.com/traf/click.php?id=215&url=http://www.baidu.com>°ñ°ù¶èéèîª Ö÷ò³</a></p><p Style=height:14px><a href=http://e.baidu.com>¼óèë°ù¶èíæ¹ã</a> | <a Href=http://top.baidu.com>ëñë÷ çôæ°ñ</a> | <a href=http://home.baidu.com>¹øóú°ù¶è</a> | <a href=http://ir.baidu.com>about baidu</a></p><p id=b>&copy;2009 Baidu <a href=http ://www.baidu.com/duty/>ê¹óã°ù¶èç°±ø¶á</a> <a href=http://www.miibeian.gov.cn target=_blank>¾©ICPÖ¤ 030173ºå</a> </p><map Name=mp><area shape= Rect coords= "43,22,227,91" Href=http://hi.baidu.com/baidu/target=_blank title= "Μã´ë½øèë°ù¶è¿õ¼ä" ></map> </center></body>
<script>var w=document.f.wd;function S (o) {if (w.value.length>0) {var h=o.href;var q=encodeuricomponent ( W.value); if (H.indexof ("q=")!=-1) {O.href=h.replace (New RegExp ("q=[^&$]*"), "q=" +q)}else{o.href+= "Q=}}}};( function () {if (New RegExp ("q= ([^&]+)"). Test (Location.search)) {w.value=decodeuricomponent (regexp.$1)}}) (); if ( Navigator.cookieenabled&&!/sug?=0/.test (Document.cookie)) {document.write (' <script src=http:// Www.baidu.com/js/bdsug.js?v=1.1.0.3><//script> ')};if (window.attachevent) {window.attachEvent ("onload"), function () {W.focus ();})} Else{window.addeventlistener (' Load ', function () {w.focus ()},true)};window.onunload=function () {};</script>

Connection closed by foreign host.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.