~ubuntu-branches/ubuntu/trusty/swift/trusty-updates

« back to all changes in this revision

Viewing changes to swift/common/middleware/tempurl.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-01-28 09:40:30 UTC
  • mfrom: (1.2.16)
  • Revision ID: package-import@ubuntu.com-20130128094030-aetz57x2qz9ye2d4
Tags: 1.7.6-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
261
261
                        already = True
262
262
                        break
263
263
                if not already:
264
 
                    headers.append(('Content-Disposition',
265
 
                        'attachment; filename=%s' %
 
264
                    headers.append(
 
265
                        ('Content-Disposition', 'attachment; filename=%s' %
266
266
                            (quote(basename(env['PATH_INFO'])))))
267
267
            return start_response(status, headers, exc_info)
268
268
 
365
365
        """
366
366
        if not request_method:
367
367
            request_method = env['REQUEST_METHOD']
368
 
        return hmac.new(key, '%s\n%s\n%s' % (request_method, expires,
369
 
            env['PATH_INFO']), sha1).hexdigest()
 
368
        return hmac.new(
 
369
            key, '%s\n%s\n%s' % (request_method, expires,
 
370
                                 env['PATH_INFO']), sha1).hexdigest()
370
371
 
371
372
    def _invalid(self, env, start_response):
372
373
        """
380
381
        self._log_request(env, HTTP_UNAUTHORIZED)
381
382
        body = '401 Unauthorized: Temp URL invalid\n'
382
383
        start_response('401 Unauthorized',
383
 
            [('Content-Type', 'text/plain'),
384
 
             ('Content-Length', str(len(body)))])
 
384
                       [('Content-Type', 'text/plain'),
 
385
                        ('Content-Length', str(len(body)))])
385
386
        if env['REQUEST_METHOD'] == 'HEAD':
386
387
            return []
387
388
        return [body]