mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Add configuration variable supybot.servers.http.robots.
This commit is contained in:
parent
4b805a6178
commit
be438b45c2
10
src/conf.py
10
src/conf.py
@ -1080,9 +1080,13 @@ registerGlobalValue(supybot.servers.http, 'port',
|
|||||||
registry.Integer(8080, _("""Determines what port the HTTP server will
|
registry.Integer(8080, _("""Determines what port the HTTP server will
|
||||||
bind.""")))
|
bind.""")))
|
||||||
registerGlobalValue(supybot.servers.http, 'keepAlive',
|
registerGlobalValue(supybot.servers.http, 'keepAlive',
|
||||||
registry.Boolean(False, _("""Defines whether the server will stay alive if
|
registry.Boolean(False, _("""Determiness whether the server will stay
|
||||||
no plugin is using it. This also means that the server will start even
|
alive if no plugin is using it. This also means that the server will
|
||||||
if it is not used.""")))
|
start even if it is not used.""")))
|
||||||
|
registerGlobalValue(supybot.servers.http, 'robots',
|
||||||
|
registry.String('', _("""Determines the content of the robots.txt file,
|
||||||
|
served on the server to search engine. All \\n will be converted to line
|
||||||
|
breaks.""")))
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -84,6 +84,8 @@ class SupyHTTPRequestHandler(BaseHTTPRequestHandler):
|
|||||||
def do_X(self, callbackMethod, *args, **kwargs):
|
def do_X(self, callbackMethod, *args, **kwargs):
|
||||||
if self.path == '/':
|
if self.path == '/':
|
||||||
callback = SupyIndex()
|
callback = SupyIndex()
|
||||||
|
elif self.path == '/robots.txt':
|
||||||
|
callback = RobotsTxt()
|
||||||
else:
|
else:
|
||||||
subdir = self.path.split('/')[1]
|
subdir = self.path.split('/')[1]
|
||||||
try:
|
try:
|
||||||
@ -191,6 +193,18 @@ class SupyIndex(SupyHTTPServerCallback):
|
|||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write(response)
|
self.wfile.write(response)
|
||||||
|
|
||||||
|
class RobotsTxt(SupyHTTPServerCallback):
|
||||||
|
"""Serves the robot.txt file to robots."""
|
||||||
|
name = 'robotstxt'
|
||||||
|
defaultResponse = _('Request not handled')
|
||||||
|
def doGet(self, handler, path):
|
||||||
|
response = conf.supybot.servers.http.robots().replace('\\n', '\n')
|
||||||
|
handler.send_response(200)
|
||||||
|
self.send_header('Content_type', 'text/html')
|
||||||
|
self.send_header('Content-Length', len(response))
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(response)
|
||||||
|
|
||||||
httpServer = None
|
httpServer = None
|
||||||
|
|
||||||
def startServer():
|
def startServer():
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
"""stick the various versioning attributes in here, so we only have to change
|
"""stick the various versioning attributes in here, so we only have to change
|
||||||
them once."""
|
them once."""
|
||||||
version = '0.83.4.1+limnoria (2011-10-28T22:44:09+0200)'
|
version = '0.83.4.1+limnoria (2011-10-29T12:13:09+0200)'
|
||||||
|
Loading…
Reference in New Issue
Block a user