Squid url redirector

Check-in [46225bbe65]
anonymous

Check-in [46225bbe65]

Overview
Comment:fixing bug with too big error message flowing to syslog
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 46225bbe65145f7fe061916ae5d79145aab0e701909bc9b94aef4bff59ef6bc9
User & Date: arcade@b1t.name on 2013-01-24 13:38:14.000
Other Links: branch diff | manifest | tags
Context
2013-03-13
17:22
support for substituting domain and path when redirecting check-in: a326d03ba1 user: arcade@b1t.name tags: master, trunk
2013-01-24
13:38
fixing bug with too big error message flowing to syslog check-in: 46225bbe65 user: arcade@b1t.name tags: master, trunk
2012-12-10
13:04
extra space, support for IPv6 check-in: 5d265df0fc user: arcade@b1t.name tags: master, trunk
Changes
105
106
107
108
109
110
111

112





113
114
115
116
117
118
119
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
120
121
122
123
124







+
-
+
+
+
+
+







		logging.handlers.SysLogHandler.__init__(self, '/dev/log')
		self._tail = gevent.queue.Queue()
		self._worker = None

	def emit(self, record):
		# my syslog is broken and cannot into UTF-8 BOM
		record.msg = record.msg.encode('utf-8')
		try:
		self._tail.put(record)
			self._tail.put(record)
		except (KeyboardInterrupt, SystemExit):
			raise
		except:
			self.handleError(record)
		if self._worker == None:
			# in case queue is empty we will spawn new worker
			# all workers are logged so we can kill them on close()
			self._worker = gevent.spawn(self._writer)

	def _writer(self):
		# here we are locking the queue so we can be sure we are the only one