Undefined variable referenced in StaticWeb logResponse()

Bug #887837 reported by Vipul Sabhaya
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Invalid
Undecided
Unassigned

Bug Description

pylint reports that an undefined variable is being used in the _log_response() method of swift.common.middleware.staticweb.StaticWeb. It seems that the variable 'the_request' should be referenced instead of 'req'.

(the bug is on the last line)

        the_request = quote(unquote(env['PATH_INFO']))
        if env.get('QUERY_STRING'):
            the_request = the_request + '?' + env['QUERY_STRING']
        # remote user for zeus
        client = env.get('HTTP_X_CLUSTER_CLIENT_IP')
        if not client and 'HTTP_X_FORWARDED_FOR' in env:
            # remote user for other lbs
            client = env['HTTP_X_FORWARDED_FOR'].split(',')[0].strip()
        logged_headers = None
        if self.log_headers:
            logged_headers = '\n'.join('%s: %s' % (k, v)
                for k, v in req.headers.items())

I have a fix and will submit shortly.

Revision history for this message
Pete Zaitcev (zaitcev) wrote :

Good grief. Interestingly, we pulled this out of the tree, back into the tree, and still nobody noticed this specifically. How comes?

Changed in swift:
status: New → Confirmed
Revision history for this message
Pete Zaitcev (zaitcev) wrote :

(BTW, until the WebOb 1.2 thing, the fix would be to add req=Request(env) just above. However, as I fixed proxy_logger, this turned to be way more involved now. Maybe just drop the whole logging thing and recommend that proxy_logger is used in the pipeline above the staticweb. We have the capability now.)

Revision history for this message
Kun Huang (academicgareth) wrote :

The file is different now. This issue is not valid then

Changed in swift:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.