09-20-2005 05:16 PM
I am trying to find out how to manually issue an HTTP GET from the CSS and received the respond to be able to select the proper keep alive setting. I have been able to follow the logic of the current configurations and know that the admin can do it (he is on a 3 weeks trip) but can't remember how.
Any help would be welcome.
Btw, is it possible to access this list by NNTP? I can't remember the name of the Cisco nntp server.
Solved! Go to Solution.
09-21-2005 11:48 PM
Here is a script to do what you need.
if ${ARGS}[#] "NEQ" "3"
echo "Usage: httpget \'Hostname Port WebPage\'"
exit script 1
endbranch
! Defines:
set HostName "${ARGS}[1]"
set WebPage "${ARGS}[3]"
set Port "${ARGS}[2]"
! Connect to the remote Host
set EXIT_MSG "Connection Failure"
socket connect host ${HostName} port ${Port} tcp 2000
! Send the GET request for the web page
set EXIT_MSG "Send: Failed"
socket send ${SOCKET} "GET ${WebPage} HTTP/1.0\n\n"
! Get Response
set EXIT_MSG "Receive: Failed"
socket receive ${SOCKET} 2000
! Display Response
set EXIT_MSG "Inspect: Failed"
socket inspect ${SOCKET} pretty
no set EXIT_MSG
socket disconnect ${SOCKET}
exit script 0
Example on how to use it
CSS11503# script play httpget "192.168.30.27 80 /index.html"
CSS11503# if ${ARGS}[#] "NEQ" "3"
echo "Usage: httpget \'Hostname Port WebPage\'"
exit script 1
endbranch
CSS11503# set HostName "${ARGS}[1]"
CSS11503# set WebPage "${ARGS}[3]"
CSS11503# set Port "${ARGS}[2]"
CSS11503# set EXIT_MSG "Connection Failure"
CSS11503# socket connect host ${HostName} port ${Port} tcp 2000
Connect(-) 192.168.30.27
Connected to 192.168.30.27:80 using socket 73
CSS11503# set EXIT_MSG "Send: Failed"
CSS11503# socket send ${SOCKET} "GET ${WebPage} HTTP/1.0\n\n"
CSS11503# set EXIT_MSG "Receive: Failed"
CSS11503# socket receive ${SOCKET} 2000
CSS11503# set EXIT_MSG "Inspect: Failed"
CSS11503# socket inspect ${SOCKET} pretty
Current Contents of Receive Buffer for socket (73): 3069 Bytes
48 54 54 50 2F 31 2E 31 20 32 30 30 20 4F 4B 0D HTTP/1.1 200 OK.
0A 44 61 74 65 3A 20 54 68 75 2C 20 32 32 20 53 .Date: Thu, 22 S
65 70 20 32 30 30 35 20 30 39 3A 30 34 3A 30 36 ep 2005 09:04:06
20 47 4D 54 0D 0A 53 65 72 76 65 72 3A 20 41 70 GMT..Server: Ap
61 63 68 65 2F 32 2E 30 2E 34 36 20 28 52 65 64 ache/2.0.46 (Red
Gilles.
09-20-2005 11:22 PM
CSS11503(debug)# icp probe host 192.168.30.27 "/index.html"
Probing 192.168.30.27:80(-) Probing SSL..
IP Address: 192.168.30.27
Port: 80
URL: /index.html
HTTP Version: 1.1
Server Model: Apache/2.0.46 (Red Hat)
Server Date: Wed, 21 Sep 2005 08:37:38 GMT
HEAD Response: 200 OK
HEAD Support: Yes
Persistence: Yes
Keep-Alive: Yes
Request Depth: 100
TBR: 44
Hash: 2c9975fbc81737f7883f08e4f6beb7e3
Connect Time: 1 ms
Rqst/Rsp Time: 2 ms
Pipeline: No
SSL: No
Not sure about this list on nntp.
Gilles.
09-21-2005 05:30 AM
Thank you, I didn't know about this option. I will try it. After sending the 1st msg, I start looking at the build-in script and it look like it would be possible to use one of the script as a starting point with socket to issue query and print the result.
Anybody ever write such a script? I start with cisco router and switches a long time ago but the CSS is another world. I just print some of the manuals and I am happy to have fast printer!!!
09-21-2005 11:48 PM
Here is a script to do what you need.
if ${ARGS}[#] "NEQ" "3"
echo "Usage: httpget \'Hostname Port WebPage\'"
exit script 1
endbranch
! Defines:
set HostName "${ARGS}[1]"
set WebPage "${ARGS}[3]"
set Port "${ARGS}[2]"
! Connect to the remote Host
set EXIT_MSG "Connection Failure"
socket connect host ${HostName} port ${Port} tcp 2000
! Send the GET request for the web page
set EXIT_MSG "Send: Failed"
socket send ${SOCKET} "GET ${WebPage} HTTP/1.0\n\n"
! Get Response
set EXIT_MSG "Receive: Failed"
socket receive ${SOCKET} 2000
! Display Response
set EXIT_MSG "Inspect: Failed"
socket inspect ${SOCKET} pretty
no set EXIT_MSG
socket disconnect ${SOCKET}
exit script 0
Example on how to use it
CSS11503# script play httpget "192.168.30.27 80 /index.html"
CSS11503# if ${ARGS}[#] "NEQ" "3"
echo "Usage: httpget \'Hostname Port WebPage\'"
exit script 1
endbranch
CSS11503# set HostName "${ARGS}[1]"
CSS11503# set WebPage "${ARGS}[3]"
CSS11503# set Port "${ARGS}[2]"
CSS11503# set EXIT_MSG "Connection Failure"
CSS11503# socket connect host ${HostName} port ${Port} tcp 2000
Connect(-) 192.168.30.27
Connected to 192.168.30.27:80 using socket 73
CSS11503# set EXIT_MSG "Send: Failed"
CSS11503# socket send ${SOCKET} "GET ${WebPage} HTTP/1.0\n\n"
CSS11503# set EXIT_MSG "Receive: Failed"
CSS11503# socket receive ${SOCKET} 2000
CSS11503# set EXIT_MSG "Inspect: Failed"
CSS11503# socket inspect ${SOCKET} pretty
Current Contents of Receive Buffer for socket (73): 3069 Bytes
48 54 54 50 2F 31 2E 31 20 32 30 30 20 4F 4B 0D HTTP/1.1 200 OK.
0A 44 61 74 65 3A 20 54 68 75 2C 20 32 32 20 53 .Date: Thu, 22 S
65 70 20 32 30 30 35 20 30 39 3A 30 34 3A 30 36 ep 2005 09:04:06
20 47 4D 54 0D 0A 53 65 72 76 65 72 3A 20 41 70 GMT..Server: Ap
61 63 68 65 2F 32 2E 30 2E 34 36 20 28 52 65 64 ache/2.0.46 (Red
Gilles.
09-22-2005 03:29 PM
Thank you very much, I will play with it tomorrow
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide