Skip to content

Commit 08d1377

Browse files
authored
Add HTTP redirect option (#77)
* add follow-redirects option * update README * README tweak
1 parent 1f6f395 commit 08d1377

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,13 @@ In the LaunchDaemon add the following:
192192
<string>Basic dGVzdDp0ZXN0</string>
193193
```
194194

195+
#### Follow HTTP Redirects
196+
If your webserver needs to redirect InstallApplictions to fetch content from another URL, pass `--follow-redirects` in your LaunchDaemon. Useful for situations where content may be stored on a CDN or object storage.
197+
198+
```xml
199+
<string>--follow-redirects</string>
200+
```
201+
195202
### DEPNotify
196203
InstallApplications can work in conjunction with DEPNotify to automatically create and manipulate the progress bar.
197204

payload/Library/installapplications/installapplications.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@ def download_if_needed(item, stage, type, opts, depnotifystatus):
280280
if opts.headers:
281281
item.update({'additional_headers':
282282
{'Authorization': opts.headers}})
283+
# Check if we need to follow redirects.
284+
if opts.follow_redirects:
285+
item.update({'follow_redirects': True})
283286
# Download the file once:
284287
iaslog('Starting download: %s' % (urllib.parse.unquote(itemurl)))
285288
if opts.depnotify:
@@ -404,6 +407,9 @@ def main():
404407
o.add_option('--userscript', default=None,
405408
help=('Optional: Trigger a user script run.'),
406409
action='store_true')
410+
o.add_option('--follow-redirects', default=False,
411+
help=('Optional: Follow HTTP redirects.'),
412+
action='store_true')
407413

408414
opts, args = o.parse_args()
409415

@@ -517,6 +523,10 @@ def main():
517523
headers = {'Authorization': opts.headers}
518524
json_data.update({'additional_headers': headers})
519525

526+
# Check if we need to follow redirects.
527+
if opts.follow_redirects:
528+
item.update({'follow_redirects': True})
529+
520530
# Delete the bootstrap file if it exists, to ensure it's up to date.
521531
if not opts.skip_validation:
522532
if os.path.isfile(jsonpath):

0 commit comments

Comments
 (0)