module Robots:sig..end
Functions for generating responses to requests for /robots.txt.
A /robots.txt response is a sequence of records; each record
consists of a User-agent field and one or more Disallow fields.
You can construct a corresponding algebraic data type and
Restful.Robots.some will generate a response from it.
type user_agent =
| |
User_agent of |
The type of User-agent fields.
type disallow =
| |
Disallow of |
The type of Disallow fields.
typerecord =user_agent * disallow *
disallow list
The type of robots.txt records.
The following functions each take and return a function
compatible with Restful.SERVICE.main, modifying it so that it
automatically processes /robots.txt requests.
val all : ('a -> 'b -> Netcgi.cgi -> Nethttp.http_status) ->
'a -> 'b -> Netcgi.cgi -> Nethttp.http_statusall main: convert main into a function that also answers
/robots.txt requests with a response that allows all
robots to access all URI's.
Restful.SERVICE.mainval none : ('a -> 'b -> Netcgi.cgi -> Nethttp.http_status) ->
'a -> 'b -> Netcgi.cgi -> Nethttp.http_statusnone main: convert main into a function that also answers
/robots.txt requests with a response that refuses all
robots access to any URI's.
Restful.SERVICE.mainval some : ?text:string ->
?file:string ->
?robots:(user_agent * disallow *
disallow list)
list ->
('a -> 'b -> Netcgi.cgi -> Nethttp.http_status) ->
'a -> 'b -> Netcgi.cgi -> Nethttp.http_statussome ?text ?file ?robots main: convert main into a function
that also answers /robots.txt requests with a customized
response. Exactly one of ~text, ~file or ~robots must be provided.
The difference between expressing your robots.txt with ~text
and ~robots is that with ~robots Restful will statically guarantee you
a syntactically-correct robots.txt; in addition, with ~robots
you can obviously generate a robots.txt algorithmically.
Restful.SERVICE.maintext : the complete text of your robots.txt responsefile : the name of a file containing your robots.txt responserobots : list of records expressing your robots.txt response