📄 readme
字号:
Scriptable test client for project 2.This is a perl program that interprets a small script languagesuitable for testing project 2 (proxy web servers). The perl program is call "testclient" and the command line arguments are:hostname port_number script_filethe hostname and port_number identify the proxy server that will be tested andthe script_file contains a series of commands that will control the testing.The script language includes the following commands (case is not important):# CONNECT : establish a connection to the proxy server# (forces a close as well)# SEND string : send the specified string# CLOSE : close the TCP socket the proxy# READLINE : read one line from proxy and toss away# READALL : read from proxy until EOF (tossing away)# SAVEALL file : read from proxy until EOF and save in file# SAVECONTENT : skip headers and save content in file# ECHOLINE : read one line from proxy and print# ECHOALL : read from proxy until EOF and print# EXPECT file : read from proxy until EOF and compare to a file# EXPECTCONTENT file : read from proxy, until EOF and compare to a file# tosses headers before comparing# PRINT string : print the string to STDOUT# EVAL string : eval the perl commandprint the string to STDOUTEach script file contains a series of these commands. The script filesI've come up with so far:simple - some simple tests every server should pass.tcpread - send the request in chunks (not lines).stress - grabs a graphic file and compares to copy using the EXPECTCONTENT command - does this 100 times.epipe - should generate a broken pipe in the proxy server, then sees if the server is still runningSample usage:Start the server:dishwasher.cs.rpi.edu> ./proxy68770In another window run the test script named "simple":eggbeater.cs.rpi.edu> ./testclient dishwasher 68770 simple</BODY></HTML># Second test - Try an imageEXPECT checks OK# Second test - send request in small chunksECHO ALLHTTP/1.1 404 File Not FoundDate: Sun, 22 Feb 1998 21:08:52 GMTServer: Apache/1.2.5Connection: closeContent-Type: text/html<HTML><HEAD><TITLE>404 File Not Found</TITLE></HEAD><BODY><H1>File Not Found</H1>The requested URL /foo was not found on this server.<P></BODY></HTML>Run the script epipeeggbeater.cs.rpi.edu> ./testclient dishwasher 68770 epipe # Generate broken pipe by closing client prematurly# Now make sure the proxy is still runningHTTP/1.1 200 OKDate: Sun, 22 Feb 1998 21:09:54 GMTServer: Apache/1.2.5Last-Modified: Sun, 22 Feb 1998 20:51:42 GMTETag: "f204c-12-34f08fde"Content-Length: 18Accept-Ranges: bytesConnection: closeContent-Type: text/plainSeems to be OK!!!Run the script stresstest:# First test - get graphic image and save content only# now go get it a bunch of timesRepetition # 0 EXPECT checks OKRepetition # 1 EXPECT checks OKRepetition # 2 EXPECT checks OKRepetition # 3 EXPECT checks OKRepetition # 4 ... and so on for 100 checks.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -