curl-users
Re: cURL/Big Brother / Https Content
Date: Sat, 15 Feb 2003 01:33:36 -0600
The scripts I've been writing look pretty much like this:
CURLOPTS="-s -S -L -connect-time 45 -m 90 -b cookies -c cookies"
# Grab the page and save it
curl $CURLOPTS -o <filepath>.html https://secure.somewhere.com/
retval=$?
# Important: is the file empty...?
if [ -s <filepath>.html -a "$retval -eq "0" ]; then
# Count the number of times our test string occurs on the page
check=`grep -ic "something on the page" <filepath>.html`
#
if [ "$check" -gt "0" ]; then
MESSAGE="got a good page"
COLOR=green
else
MESSAGE="failed to find test string"
COLOR=red
fi
else
MESSAGE="got an empty file. curl error code: $retval"
COLOR=red
fi
I've got it down to where it's generic enough (in a lot of cases) to be able to
use a MySQL database to hold the urls, the test strings and the success/fail
messages. Right now I'm working on C program that pulls test cases from a
message queue and pops off multiple threads to check the pages. There's a
separate program that's kicked off by cron on a regular basis to extract
database entries based on <whatever> criteria and insert them in the message
queue.
The cases where this doesn't work (yet) are where I have to login to the web
sites to get to the content I need to test. The logins work fine in the Bourne
shell, using the above code fragment repeatedly to get the login page, post the
login info, etc, but they're almost all unique, so it'll be tedious to convert
them to C & MySQL.
Ralph Mitchell
Rich Lichvar wrote:
> For Ralph Mitchell or anyone else who uses cURL for http/https monitoring in
> Big Brother: do any of you have a script which uses cURL to fetch content
> from an https web page? I'm trying to monitor a blank page situation on an
> https site using the cont (or cont2) script from deadcat. All I get is the
> standard https connectivity check rather than a check for the string I'm
> trying to fetch on the page. (Can't fetch the string? Blank page!)
>
> RichLich
>
> -------------------------------------------------------
> This SF.NET email is sponsored by: FREE SSL Guide from Thawte
> are you planning your Web Server Security? Click here to get a FREE
> Thawte SSL guide and find the answers to all your SSL security issues.
> http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
Received on 2003-02-15