cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Bookmark
|
Subscribe
|
714
Views
0
Helpful
4
Replies

using script to parse the 302 response

davidm101
Level 1
Level 1

Try to use the script keepalive to check the health of a web server...

No problem to connect to the web server, send a get request and receive a 302 object moved response from the web server. Is it possible to parse the response and generate the get request using the new location indicated in the 302 message?

Thanks.

4 Replies 4

jfoerster
Level 4
Level 4

HI,

in theory I would say yes as you can setup a scripted keepalive but I assume that it will be hard coding as you have to check what to waitfor to see which string is given by the server. From this point you've to initiate another request to the given value and probe this one.

Maybe the following link gives you an idea how to do this on a CSS:

http://www.cisco.com/en/US/customer/products/hw/contnetw/ps789/products_tech_note09186a00801e1dfb.shtml

The same should be true for a CSM but the CSM uses another scripting language (TCL) for programming keepalives.

Kind Regards,

Joerg

The inital get request to web server 1.1.1.1 for "/test/start?ENV=xyz" will result a 302 message containning new location information - "http/1.1/ 302 Obejct Moved..Location: http://1.1.1.1/test/EXEC/0/12345678?ENV=xyz..Server ".

I need to send out a 2nd get request with "/test/EXEC/0/12345678?ENV=xyz". Please be aware the string "/0/12345678" will change to a different value next time - e.g. "/0/87654321". Can I do it using the css11800 scripting language? Thanks.

I guess you are. Unfortunatley I do not have a CSS close right now but from the idea which is behind I guess it might work like that (beware this is only pure theory I did not proove this so far):

1)parse the return code for the value

2)asign this value to a variable

3)issue a 2nd request with the variable

I guess you've to do some engineering on this.

Sorry that I do not have more details on this...

Kind Regards,

Joerg

socket inspect & grep.

I was not able to build the 2nd request using the socket inspect, pipe and grep. Is there a sample script will show me how to retrieve selective data string from the socket input buffer? Thanks.

Review Cisco Networking for a $25 gift card