Allow for additional headers sent with curl() HTTP requests to be set in ManagedInstalls.plist

git-svn-id: http://munki.googlecode.com/svn/branches/additional-http-headers@734 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Justin McWilliams
2010-09-08 21:00:43 +00:00
parent 25f2a90ede
commit 7c505758cf
+14 -2
View File
@@ -1058,8 +1058,8 @@ def verifySoftwarePackageIntegrity(manifestitem, file_path, item_pl, item_key):
none: No integrity check is performed.
hash: Integrity check is performed by calcualting a SHA-256 hash of
the given file and comparing it against the reference value in
catalog. Only applies for package plists that contain the
item_key; for packages without the item_key, verifcation always
catalog. Only applies for package plists that contain the
item_key; for packages without the item_key, verifcation always
returns True.
hash_strict: Same as hash, but returns False for package plists that
do not contain the item_key.
@@ -2169,6 +2169,18 @@ def curl(url, destinationpath, onlyifnewer=False, etag=None, resume=False,
else:
os.remove(destinationpath)
# Add any additional headers specified in ManagedInstalls.plist.
# AdditionalHttpHeaders must be an array of strings with valid HTTP
# header format: "Key-With-Optional-Dashes: Value here"
custom_headers = munkicommon.pref('AdditionalHttpHeaders')
if custom_headers:
for custom_header in custom_headers:
if re.search(r'^[\w-]+:.+', custom_header):
print >> fileobj, ('header = "%s"' % custom_header)
else:
munkicommon.display_warning(
"Skipping invalid HTTP header: %s" % custom_header)
fileobj.close()
except:
raise CurlError(-5, "Error writing curl directive")