{"action":"created","issue":{"url":"https://api.github.com/repos/OCA/server-tools/issues/343","labels_url":"https://api.github.com/repos/OCA/server-tools/issues/343/labels{/name}","comments_url":"https://api.github.com/repos/OCA/server-tools/issues/343/comments","events_url":"https://api.github.com/repos/OCA/server-tools/issues/343/events","html_url":"https://github.com/OCA/server-tools/pull/343","id":129454801,"number":343,"title":"8.0 avoid a crash in log_forwarded_for_ip (even when the module is not installed)","user":{"login":"alexis-via","id":1157917,"avatar_url":"https://avatars.githubusercontent.com/u/1157917?v=3","gravatar_id":"","url":"https://api.github.com/users/alexis-via","html_url":"https://github.com/alexis-via","followers_url":"https://api.github.com/users/alexis-via/followers","following_url":"https://api.github.com/users/alexis-via/following{/other_user}","gists_url":"https://api.github.com/users/alexis-via/gists{/gist_id}","starred_url":"https://api.github.com/users/alexis-via/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexis-via/subscriptions","organizations_url":"https://api.github.com/users/alexis-via/orgs","repos_url":"https://api.github.com/users/alexis-via/repos","events_url":"https://api.github.com/users/alexis-via/events{/privacy}","received_events_url":"https://api.github.com/users/alexis-via/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-28T13:35:22Z","updated_at":"2016-01-28T13:57:06Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/OCA/server-tools/pulls/343","html_url":"https://github.com/OCA/server-tools/pull/343","diff_url":"https://github.com/OCA/server-tools/pull/343.diff","patch_url":"https://github.com/OCA/server-tools/pull/343.patch"},"body":"I sometimes have this in my odoo logs:\r\n\r\n```\r\n2016-01-20 13:49:23,463 440 ERROR prod1 openerp.service.server: Worker (440) Exception occured, exiting...\r\nTraceback (most recent call last):\r\n  File \"/home/odoo/erp/odoo/openerp/service/server.py\", line 756, in run\r\n    self.process_work()\r\n  File \"/home/odoo/erp/odoo/openerp/service/server.py\", line 788, in process_work\r\n    self.process_request(client, addr)\r\n  File \"/home/odoo/erp/odoo/openerp/service/server.py\", line 779, in process_request\r\n    self.server.process_request(client, addr)\r\n  File \"/usr/lib/python2.7/SocketServer.py\", line 321, in process_request\r\n    self.finish_request(request, client_address)\r\n  File \"/usr/lib/python2.7/SocketServer.py\", line 334, in finish_request\r\n    self.RequestHandlerClass(request, client_address, self)\r\n  File \"/usr/lib/python2.7/SocketServer.py\", line 649, in __init__\r\n    self.handle()\r\n  File \"/usr/lib/python2.7/dist-packages/werkzeug/serving.py\", line 200, in handle\r\n    rv = BaseHTTPRequestHandler.handle(self)\r\n  File \"/usr/lib/python2.7/BaseHTTPServer.py\", line 340, in handle\r\n    self.handle_one_request()\r\n  File \"/usr/lib/python2.7/dist-packages/werkzeug/serving.py\", line 234, in handle_one_request\r\n    elif self.parse_request():\r\n  File \"/usr/lib/python2.7/BaseHTTPServer.py\", line 253, in parse_request\r\n    self.send_error(400, \"Bad request version (%r)\" % version)\r\n  File \"/usr/lib/python2.7/BaseHTTPServer.py\", line 364, in send_error\r\n    self.log_error(\"code %d, message %s\", code, message)\r\n  File \"/usr/lib/python2.7/dist-packages/werkzeug/serving.py\", line 256, in log_error\r\n    self.log('error', *args)\r\n  File \"/usr/lib/python2.7/dist-packages/werkzeug/serving.py\", line 262, in log\r\n    _log(type, '%s - - [%s] %s\\n' % (self.address_string(),\r\n  File \"/home/odoo/erp/server-tools/log_forwarded_for_ip/__init__.py\", line 9, in address_string\r\n    forwarded_for = self.headers.get('X-Forwarded-For', '').split(',')\r\nAttributeError: 'WSGIRequestHandler' object has no attribute 'headers'\r\n```\r\n\r\nand the module  log_forwarded_for_ip is not installed.\r\n\r\nSo I propose the patch to protect against this kind of crash. Beware that I didn't test this patch."},"comment":{"url":"https://api.github.com/repos/OCA/server-tools/issues/comments/176195397","html_url":"https://github.com/OCA/server-tools/pull/343#issuecomment-176195397","issue_url":"https://api.github.com/repos/OCA/server-tools/issues/343","id":176195397,"user":{"login":"alexis-via","id":1157917,"avatar_url":"https://avatars.githubusercontent.com/u/1157917?v=3","gravatar_id":"","url":"https://api.github.com/users/alexis-via","html_url":"https://github.com/alexis-via","followers_url":"https://api.github.com/users/alexis-via/followers","following_url":"https://api.github.com/users/alexis-via/following{/other_user}","gists_url":"https://api.github.com/users/alexis-via/gists{/gist_id}","starred_url":"https://api.github.com/users/alexis-via/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexis-via/subscriptions","organizations_url":"https://api.github.com/users/alexis-via/orgs","repos_url":"https://api.github.com/users/alexis-via/repos","events_url":"https://api.github.com/users/alexis-via/events{/privacy}","received_events_url":"https://api.github.com/users/alexis-via/received_events","type":"User","site_admin":false},"created_at":"2016-01-28T13:57:06Z","updated_at":"2016-01-28T13:57:06Z","body":"Oh yes, you are right, we should do that ! At Akretion, we call that the \"Guewen trick\" :)"}}