OLD | NEW |
1 # Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ |
2 # Copyright (c) 2010, Eucalyptus Systems, Inc. | 2 # Copyright (c) 2010, Eucalyptus Systems, Inc. |
3 # All rights reserved. | 3 # All rights reserved. |
4 # | 4 # |
5 # Permission is hereby granted, free of charge, to any person obtaining a | 5 # Permission is hereby granted, free of charge, to any person obtaining a |
6 # copy of this software and associated documentation files (the | 6 # copy of this software and associated documentation files (the |
7 # "Software"), to deal in the Software without restriction, including | 7 # "Software"), to deal in the Software without restriction, including |
8 # without limitation the rights to use, copy, modify, merge, publish, dis- | 8 # without limitation the rights to use, copy, modify, merge, publish, dis- |
9 # tribute, sublicense, and/or sell copies of the Software, and to permit | 9 # tribute, sublicense, and/or sell copies of the Software, and to permit |
10 # persons to whom the Software is furnished to do so, subject to the fol- | 10 # persons to whom the Software is furnished to do so, subject to the fol- |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 | 59 |
60 try: | 60 try: |
61 import hashlib | 61 import hashlib |
62 _hashfn = hashlib.sha512 | 62 _hashfn = hashlib.sha512 |
63 except ImportError: | 63 except ImportError: |
64 import md5 | 64 import md5 |
65 _hashfn = md5.md5 | 65 _hashfn = md5.md5 |
66 | 66 |
67 # List of Query String Arguments of Interest | 67 # List of Query String Arguments of Interest |
68 qsa_of_interest = ['acl', 'location', 'logging', 'partNumber', 'policy', | 68 qsa_of_interest = ['acl', 'defaultObjectAcl', 'location', 'logging', |
69 'requestPayment', 'torrent', 'versioning', 'versionId', | 69 'partNumber', 'policy', 'requestPayment', 'torrent', |
70 'versions', 'website', 'uploads', 'uploadId', | 70 'versioning', 'versionId', 'versions', 'website', |
71 'response-content-type', 'response-content-language', | 71 'uploads', 'uploadId', 'response-content-type', |
72 'response-expires', 'reponse-cache-control', | 72 'response-content-language', 'response-expires', |
73 'response-content-disposition', | 73 'reponse-cache-control', 'response-content-disposition', |
74 'response-content-encoding'] | 74 'response-content-encoding'] |
75 | 75 |
76 # generates the aws canonical string for the given parameters | 76 # generates the aws canonical string for the given parameters |
77 def canonical_string(method, path, headers, expires=None, | 77 def canonical_string(method, path, headers, expires=None, |
78 provider=None): | 78 provider=None): |
79 if not provider: | 79 if not provider: |
80 provider = boto.provider.get_default() | 80 provider = boto.provider.get_default() |
81 interesting_headers = {} | 81 interesting_headers = {} |
82 for key in headers: | 82 for key in headers: |
83 lk = key.lower() | 83 lk = key.lower() |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 '#upstart-job' : 'text/upstart-job', | 682 '#upstart-job' : 'text/upstart-job', |
683 '#part-handler' : 'text/part-handler', | 683 '#part-handler' : 'text/part-handler', |
684 '#cloud-boothook' : 'text/cloud-boothook' | 684 '#cloud-boothook' : 'text/cloud-boothook' |
685 } | 685 } |
686 rtype = deftype | 686 rtype = deftype |
687 for possible_type,mimetype in starts_with_mappings.items(): | 687 for possible_type,mimetype in starts_with_mappings.items(): |
688 if content.startswith(possible_type): | 688 if content.startswith(possible_type): |
689 rtype = mimetype | 689 rtype = mimetype |
690 break | 690 break |
691 return(rtype) | 691 return(rtype) |
OLD | NEW |