Revize 1970
Přidáno uživatelem Michal Kliment před více než 11 roky(ů)
freenetis/branches/1.1/application/vendors/redirection/freenetis-http-302-redirection.py | ||
---|---|---|
self.listener.listen(25) # max connection in same time
|
||
self.on = True
|
||
# debug
|
||
logging.info("FreenetIS HTTP 302 Redirector is active (port: %d)\n" % (self.port))
|
||
logging.info("FreenetIS HTTP 302 Redirector is active (port: %d)\n" % (self.port))
|
||
|
||
##
|
||
# Close socket
|
||
... | ... | |
# Signal hadler
|
||
#
|
||
def signal_handler(self, signum, frame):
|
||
logging.info("Catch signal %d." % (signum))
|
||
logging.info("Catch signal %d." % (signum))
|
||
self.on = False
|
||
|
||
##
|
||
... | ... | |
origin = origin_host + origin_path
|
||
|
||
# debug
|
||
logging.info("Origin: %s" % (origin))
|
||
logging.info("Origin: %s" % (origin))
|
||
|
||
# check readed data if wring set some other common url
|
||
if not self.pattern_url.match(origin):
|
||
... | ... | |
"<html><body>Moved temporarily. Please go to <a href=\"" + url + "\">" + url + "</a> for this service.</body></html>\r\n\r\n")
|
||
|
||
# debug
|
||
logging.info("Redirecting to %s" % (url))
|
||
logging.info("Redirecting to %s" % (url))
|
||
|
||
finally:
|
||
# close connecting
|
||
conn.close()
|
||
# debug
|
||
logging.info("Closing connection.\n")
|
||
logging.info("Closing connection.\n")
|
||
|
||
##
|
||
# Listens for incoming connection (every 1ms).
|
||
... | ... | |
client_socket, client_addr = self.listener.accept()
|
||
|
||
# debug
|
||
logging.info("Accepting connection from: %s:%d." % (client_addr[0], client_addr[1]))
|
||
logging.info("Accepting connection from: %s:%d." % (client_addr[0], client_addr[1]))
|
||
|
||
# invoke thread
|
||
thread.start_new_thread(self._client_thread, (client_socket,))
|
Také k dispozici: Unified diff
Oprava spatneho odsazeni v HTTP redirektoru.