Subject:
|
Re: summaries on main page
|
Newsgroups:
|
lugnet.admin.general
|
Date:
|
Fri, 24 Mar 2000 21:34:50 GMT
|
Highlighted:
|
(details)
|
Viewed:
|
939 times
|
| |
| |
Dan:
> On Fri, 24 Mar 2000 20:48:38 GMT sparre@sys-323.risoe.dk (Jacob Sparre Andersen) wrote
[...]
> > If you want to be really nice, you can make the script
> > generating the preview page check the URL's, and mark those
> > that return an error status in a distinct colour.
>
> that'd be scary - while it's possible to make it safe to do so, I
> wouldn't want users to be able to tell my server to get arbitrary bits
> of html. There's just a lot of things that can go wrong. :/
Since the script wouldn't have to grab any HTML at all, I
can't see what the problem is. You just do a HEAD request
and check if the result is below 400.
Checking the URL http://www.lugnet.com/boats/ can for
example be done as follows:
Me....: telnet www.lugnet.com 80
Lugnet: Trying 209.68.63.236...
Lugnet: Connected to lugnet.com.
Lugnet: Escape character is '^]'.
Me....: HEAD /boats/ HTTP/1.0
Me....:
* Lugnet: HTTP/1.1 200 OK
Lugnet: Date: Fri, 24 Mar 2000 21:29:46 GMT
Lugnet: Server: Apache/1.2.6
Lugnet: Connection: close
Lugnet: Content-Type: text/html
Lugnet:
Lugnet: Connection closed by foreign host.
It's the line marked with an asterisk that is interesting.
Numbers below 400 correspond to working URL's. 400 and above
are error messages.
I have appended a (t)csh script for checking URL's.
If it is done correctly, the /robots.txt should probably be
checked before the script checks for the existance of the
resource.
Play well,
Jacob
------------------------------------------------------------
-- E-mail: sparre@cats.nbi.dk --
-- Web...: <URL: http://hugin.ldraw.org/LEGO/Biler/ > --
------------------------------------------------------------
#!/bin/tcsh
#-----------------------------------------------------------------------------
#-- Check parameter:
if ( "$1" == "") then
echo "Programmet kræver et HTTP URL som argument."
exit 1
endif
#-----------------------------------------------------------------------------
#-- Split parameter:
set protokol=`echo $1 | cut -d':' -f1`
set maskine=`echo $1 | cut -d':' -f2- | cut -d'/' -f3`
set resource=/`echo $1 | cut -d':' -f2- | cut -d'/' -f4-`
#-----------------------------------------------------------------------------
#-- Prøv telnet:
if ( "$protokol" == "http" ) then
( echo "HEAD $resource /HTTP 1.0"; \
echo ""; \
sleep 10s ) \
| telnet $maskine 80 \
|& grep HTTP > /tmp/HTTP-resultat
set resultat=`cut -d" " -f2- /tmp/HTTP-resultat`
echo $protokol\://$maskine$resource $resultat
else
echo "Ukendt protokol."
exit 2
endif
#-----------------------------------------------------------------------------
|
|
Message is in Reply To:
| | Re: summaries on main page
|
| On Fri, 24 Mar 2000 20:48:38 GMT sparre@sys-323.risoe.dk (Jacob Sparre Andersen) wrote concerning 'Re: summaries on main page': (...) that'd be scary - while it's possible to make it safe to do so, I wouldn't want users to be able to tell my server (...) (25 years ago, 24-Mar-00, to lugnet.admin.general)
|
19 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|