userland-fetch revision 844
911N/A# The contents of this file are subject to the terms of the 761N/A# Common Development and Distribution License (the "License"). 290N/A# You may not use this file except in compliance with the License. 290N/A# See the License for the specific language governing permissions 290N/A# and limitations under the License. 290N/A# When distributing Covered Code, include this CDDL HEADER in each 290N/A# If applicable, add the following below this CDDL HEADER, with the 290N/A# fields enclosed by brackets "[]" replaced with your own identifying 290N/A# information: Portions Copyright [yyyy] [name of copyright owner] 290N/A# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 290N/A# A simple program similiar to wget(1), but handles local file copy, ignores 290N/A# directories, and verifies file hashes. 290N/A """ Function to decode and print IOError type exception """ 290N/A # force migration away from sha1 # 3xx, 4xx and 5xx (f|ht)tp codes designate unsuccessfull action # return the name of the file that we downloaded the data to. # filename should always be first # command line url is a fallback, so it's last print "Usage: %s [-f|--file (file)] [-l|--link] [-h|--hash (hash)] [-s|--search (search-dir)] --url (url)" %
(sys.argv[0].split('/')[-1]) ["file=", "link", "hash=", "search=", "url="]) if opt in [
"-f",
"--file" ]:
elif opt in [
"-l",
"--link" ]:
elif opt in [
"-h",
"--hash" ]:
elif opt in [
"-s",
"--search" ]:
elif opt in [
"-u",
"--url" ]:
print "Source %s..." %
url,
print "not found, skipping file copy" elif scheme in [
'http',
'https',
'ftp' ]:
print "\n downloading...",
print "\n validating...",
print "skipping (no hash)" print "corruption detected"