Deleted Added
full compact
http.subr (257788) http.subr (257795)
1if [ ! "$_MEDIA_HTTP_SUBR" ]; then _MEDIA_HTTP_SUBR=1
2#
3# Copyright (c) 2012-2013 Devin Teske
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
1if [ ! "$_MEDIA_HTTP_SUBR" ]; then _MEDIA_HTTP_SUBR=1
2#
3# Copyright (c) 2012-2013 Devin Teske
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
27# $FreeBSD: head/usr.sbin/bsdconfig/share/media/http.subr 257788 2013-11-07 10:40:19Z dteske $
27# $FreeBSD: head/usr.sbin/bsdconfig/share/media/http.subr 257795 2013-11-07 12:40:42Z dteske $
28#
29############################################################ INCLUDES
30
31BSDCFG_SHARE="/usr/share/bsdconfig"
32. $BSDCFG_SHARE/common.subr || exit 1
33f_dprintf "%s: loading includes..." media/http.subr
34f_include $BSDCFG_SHARE/device.subr
35f_include $BSDCFG_SHARE/dialog.subr
36f_include $BSDCFG_SHARE/media/common.subr
37f_include $BSDCFG_SHARE/media/tcpip.subr
38f_include $BSDCFG_SHARE/strings.subr
39f_include $BSDCFG_SHARE/struct.subr
40f_include $BSDCFG_SHARE/variable.subr
41
42BSDCFG_LIBE="/usr/libexec/bsdconfig"
43f_include_lang $BSDCFG_LIBE/include/messages.subr
44
45############################################################ GLOBALS
46
47HTTP_SKIP_RESOLV=
48
49URL_MAX=261261
50 # NOTE: This is according to actual fetch(1) test-results. We actually
51 # use nc(1) to retrieve files, but it's still a good idea to keep the
52 # URLs short enough that fetch(1) won't complain.
53
54HTTP_DIRS="
55 .
56 releases/$UNAME_P
57 snapshots/$UNAME_P
58 pub/FreeBSD
59 pub/FreeBSD/releases/$UNAME_P
60 pub/FreeBSD/snapshots/$UNAME_P
61 pub/FreeBSD-Archive/old-releases/$UNAME_P
62" # END-QUOTE
63
64############################################################ FUNCTIONS
65
66# f_dialog_menu_media_http
67#
68# Prompt the user to select from a range of ``built-in'' HTTP servers or
69# specify their own. If the user makes a choice and doesn't cancel or press
70# Esc, stores the user's choice in VAR_FTP_PATH (see variable.subr) and returns
71# success.
72#
73f_dialog_menu_media_http()
74{
75 f_dialog_title "$msg_please_select_a_freebsd_http_distribution_site"
76 local title="$DIALOG_TITLE" btitle="$DIALOG_BACKTITLE"
77 f_dialog_title_restore
78 local prompt="$msg_please_select_the_site_closest_to_you_or_other"
79 local menu_list="
28#
29############################################################ INCLUDES
30
31BSDCFG_SHARE="/usr/share/bsdconfig"
32. $BSDCFG_SHARE/common.subr || exit 1
33f_dprintf "%s: loading includes..." media/http.subr
34f_include $BSDCFG_SHARE/device.subr
35f_include $BSDCFG_SHARE/dialog.subr
36f_include $BSDCFG_SHARE/media/common.subr
37f_include $BSDCFG_SHARE/media/tcpip.subr
38f_include $BSDCFG_SHARE/strings.subr
39f_include $BSDCFG_SHARE/struct.subr
40f_include $BSDCFG_SHARE/variable.subr
41
42BSDCFG_LIBE="/usr/libexec/bsdconfig"
43f_include_lang $BSDCFG_LIBE/include/messages.subr
44
45############################################################ GLOBALS
46
47HTTP_SKIP_RESOLV=
48
49URL_MAX=261261
50 # NOTE: This is according to actual fetch(1) test-results. We actually
51 # use nc(1) to retrieve files, but it's still a good idea to keep the
52 # URLs short enough that fetch(1) won't complain.
53
54HTTP_DIRS="
55 .
56 releases/$UNAME_P
57 snapshots/$UNAME_P
58 pub/FreeBSD
59 pub/FreeBSD/releases/$UNAME_P
60 pub/FreeBSD/snapshots/$UNAME_P
61 pub/FreeBSD-Archive/old-releases/$UNAME_P
62" # END-QUOTE
63
64############################################################ FUNCTIONS
65
66# f_dialog_menu_media_http
67#
68# Prompt the user to select from a range of ``built-in'' HTTP servers or
69# specify their own. If the user makes a choice and doesn't cancel or press
70# Esc, stores the user's choice in VAR_FTP_PATH (see variable.subr) and returns
71# success.
72#
73f_dialog_menu_media_http()
74{
75 f_dialog_title "$msg_please_select_a_freebsd_http_distribution_site"
76 local title="$DIALOG_TITLE" btitle="$DIALOG_BACKTITLE"
77 f_dialog_title_restore
78 local prompt="$msg_please_select_the_site_closest_to_you_or_other"
79 local menu_list="
80 '$msg_main_site' 'ftp.freebsd.org'
80 'dist $msg_main_site' 'ftp.freebsd.org'
81 'pkg $msg_main_site' 'pkg.freebsd.org'
81 'URL' '$msg_specify_some_other_http_site'
82 " # END-QUOTE
83 local hline="$msg_select_a_site_thats_close"
84
85 local height width rows
86 eval f_dialog_menu_size height width rows \
87 \"\$title\" \
88 \"\$btitle\" \
89 \"\$prompt\" \
90 \"\$hline\" \
91 $menu_list
92
93 local mtag
94 mtag=$( eval $DIALOG \
95 --title \"\$title\" \
96 --backtitle \"\$btitle\" \
97 --hline \"\$hline\" \
98 --ok-label \"\$msg_ok\" \
99 --cancel-label \"\$msg_cancel\" \
100 --menu \"\$prompt\" \
101 $height $width $rows \
102 $menu_list \
103 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
104 ) || return $DIALOG_CANCEL
105 f_dialog_data_sanitize mtag
106
107 case "$mtag" in
108 URL) setvar $VAR_HTTP_PATH "other" ;;
109 *)
110 local value
111 value=$( eval f_dialog_menutag2item \"\$mtag\" $menu_list )
112 setvar $VAR_HTTP_PATH "http://$value"
113 esac
114
115 return $DIALOG_OK
116}
117
118# f_media_set_http
119#
120# Return success if we both found and set the media type to be an HTTP server.
121#
122# Variables from variable.subr that can be used to script user input:
123#
124# VAR_HTTP_PATH
125# URL containing host and optionally a target path to the release
126# repository on the HTTP server. Valid examples include:
127# http://myhost
128# http://somename:80/pub/
129# http://192.168.2.3/pub/
130# http://[::1]:8000/
131# The default port if not specified is 80.
132# VAR_NAMESERVER [Optional]
133# If set, overrides resolv.conf(5) and sets the nameserver that
134# is used to convert names into addresses (when a name converts
135# into multiple addresses, the first address to successfully
136# connect is used).
137#
138# Meanwhile, the following variables from variable.subr are set after
139# successful execution:
140#
141# VAR_HTTP_HOST
142# The HTTP host to connect to, parsed from VAR_HTTP_PATH. In the
143# example case of IPv6 where VAR_HTTP_PATH is "http://[::1]" this
144# variable will be set to "::1" (the outer brackets are removed).
145# VAR_HTTP_PORT
146# The TCP port to connect to, parsed from VAR_HTTP_PATH. Usually
147# 80 unless VAR_HTTP_PATH was one of the following forms:
148# http://hostname:OTHER_PORT
149# http://hostname:OTHER_PORT/*
150# http://ip:OTHER_PORT
151# http://ip:OTHER_PORT/*
152# http://[ip6]:OTHER_PORT
153# http://[ip6]:OTHER_PORT/*
154# VAR_HTTP_DIR
155# If VAR_HTTP_PATH contained a directory element (e.g.,
156# "http://localhost/pub") this variable contains only the
157# directory element (e.g., "/pub").
158#
159f_media_set_http()
160{
161 f_media_close
162
163 local url
164 f_getvar $VAR_HTTP_PATH url
165
166 # If we've been through here before ...
167 if f_struct device_network && [ "${url#$msg_other}" ]; then
168 f_dialog_yesno "$msg_reuse_old_http_site_settings" || url=
169 fi
170
171 if [ ! "$url" ]; then
172 f_dialog_menu_media_http || return $FAILURE
173 f_getvar $VAR_HTTP_PATH url
174 fi
175 [ "$url" ] || return $FAILURE
176
177 case "$url" in
178 other)
179 setvar $VAR_HTTP_PATH "http://"
180 f_variable_get_value $VAR_HTTP_PATH \
181 "$msg_please_specify_url_of_freebsd_http_distribution"
182 f_getvar $VAR_HTTP_PATH url
183 if [ ! "${url#http://}" ]; then
184 unset $VAR_HTTP_PATH
185 return $FAILURE
186 fi
187 if [ ${#url} -gt ${URL_MAX:-261261} ]; then
188 f_show_msg "$msg_length_of_specified_url_is_too_long" \
189 ${#url} ${URL_MAX:-261261}
190 unset $VAR_HTTP_PATH
191 return $FAILURE
192 fi
193 case "$url" in
194 http://*) : valid URL ;;
195 *)
196 f_show_msg "$msg_sorry_invalid_url" "$url"
197 unset $VAR_HTTP_PATH
198 return $FAILURE
199 esac
200 esac
201 case "$url" in
202 http://*) : valid URL ;;
203 *)
204 f_show_msg "$msg_sorry_invalid_url" "$url"
205 unset $VAR_HTTP_PATH
206 return $FAILURE
207 esac
208
209 # Set the name of the HTTP device to the URL
210 f_struct_new DEVICE device_http
211 device_http set name "$url"
212
213 if ! f_struct device_network ||
214 ! f_dialog_yesno "$msg_youve_already_done_the_network_configuration"
215 then
216 f_struct device_network &&
217 f_device_shutdown network
218 if ! f_device_select_tcp; then
219 unset $VAR_HTTP_PATH
220 return $FAILURE
221 fi
222 local dev
223 f_getvar $VAR_NETWORK_DEVICE dev
224 f_struct_copy "device_$dev" device_network
225 fi
226 if ! f_device_init network; then
227 f_dprintf "f_media_set_http: %s" "$msg_net_device_init_failed"
228 unset $VAR_HTTP_PATH
229 return $FAILURE
230 fi
231
232 local hostname="${url#*://}" port=80 dir=/
233 case "$hostname" in
234 #
235 # The order in-which the below individual cases appear is important!
236 #
237 "["*"]":*/*) # IPv6 address with port and directory
238 f_dprintf "Looks like an IPv6 addr with port/dir: %s" \
239 "$hostname"
240 hostname="${hostname#\[}"
241 port="${hostname#*\]:}"
242 port="${port%%[!0-9]*}"
243 dir="/${hostname#*/}"
244 hostname="${hostname%%\]:*}"
245 ;;
246 "["*"]":*) # IPv6 address with port
247 f_dprintf "Looks like an IPv6 addr with port: %s" "$hostname"
248 hostname="${hostname#\[}"
249 port="${hostname#*\]:}"
250 port="${port%%[!0-9]*}"
251 hostname="${hostname%%\]:*}"
252 ;;
253 "["*"]"/*) # IPv6 address with directory
254 f_dprintf "Looks like an IPv6 addr with dir: %s" "$hostname"
255 hostname="${hostname#\[}"
256 dir="/${hostname#*/}"
257 hostname="${hostname%%\]*}"
258 ;;
259 "["*"]") # IPv6 address
260 f_dprintf "Looks like an IPv6 addr: %s" "$hostname"
261 hostname="${hostname#\[}"
262 hostname="${hostname%\]}"
263 ;;
264 #
265 # ^^^ IPv6 above / DNS Name or IPv4 below vvv
266 #
267 *:*/*) # DNS name or IPv4 address with port and directory
268 f_dprintf "Looks like a %s with port/dir: %s" \
269 "DNS name or IPv4 addr" "$hostname"
270 port="${hostname#*:}"
271 port="${port%%[!0-9]*}"
272 dir="/${hostname#*/}"
273 hostname="${hostname%%:*}"
274 ;;
275 *:*) # DNS name or IPv4 address with port
276 f_dprintf "Looks like a DNS name or IPv4 addr with port: %s" \
277 "$hostname"
278 port="${hostname#*:}"
279 hostname="${hostname%%:*}"
280 ;;
281 */*) # DNS name or IPv4 address with directory
282 f_dprintf "Looks like a DNS name or IPv4 addr with dir: %s" \
283 "$hostname"
284 dir="/${hostname#*/}"
285 hostname="${hostname%%/*}"
286 ;;
287 *) # DNS name or IPv4 address
288 f_dprintf "Looks like a DNS name or IPv4 addr: %s" "$hostname"
289 : leave hostname as-is
290 esac
291
292 f_dprintf "hostname = \`%s'" "$hostname"
293 f_dprintf "dir = \`%s'" "$dir"
294 f_dprintf "port \# = \`%d'" "$port"
295
296 local ns
297 f_getvar $VAR_NAMESERVER ns
298 [ "$ns" ] || f_resolv_conf_nameservers ns
299 if [ "$ns" -a ! "$HTTP_SKIP_RESOLV" ] && ! {
300 f_validate_ipaddr "$hostname" ||
301 f_validate_ipaddr6 "$hostname"
302 }; then
303 f_show_info "$msg_looking_up_host" "$hostname"
304 f_dprintf "%s: Looking up hostname, %s, using host(1)" \
305 "f_media_set_http" "$hostname"
306 if ! f_quietly f_host_lookup "$hostname"; then
307 f_show_msg "$msg_cannot_resolve_hostname" "$hostname"
308 f_struct device_network &&
309 f_device_shutdown network
310 f_struct_free device_network
311 unset $VAR_HTTP_PATH
312 return $FAILURE
313 fi
314 f_dprintf "Found DNS entry for %s successfully." "$hostname"
315 fi
316
317 setvar $VAR_HTTP_HOST "$hostname"
318 setvar $VAR_HTTP_PORT "$port"
319 setvar $VAR_HTTP_DIR "$dir"
320
321 device_http set type $DEVICE_TYPE_HTTP
322 device_http set init f_media_init_http
323 device_http set get f_media_get_http
82 'URL' '$msg_specify_some_other_http_site'
83 " # END-QUOTE
84 local hline="$msg_select_a_site_thats_close"
85
86 local height width rows
87 eval f_dialog_menu_size height width rows \
88 \"\$title\" \
89 \"\$btitle\" \
90 \"\$prompt\" \
91 \"\$hline\" \
92 $menu_list
93
94 local mtag
95 mtag=$( eval $DIALOG \
96 --title \"\$title\" \
97 --backtitle \"\$btitle\" \
98 --hline \"\$hline\" \
99 --ok-label \"\$msg_ok\" \
100 --cancel-label \"\$msg_cancel\" \
101 --menu \"\$prompt\" \
102 $height $width $rows \
103 $menu_list \
104 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
105 ) || return $DIALOG_CANCEL
106 f_dialog_data_sanitize mtag
107
108 case "$mtag" in
109 URL) setvar $VAR_HTTP_PATH "other" ;;
110 *)
111 local value
112 value=$( eval f_dialog_menutag2item \"\$mtag\" $menu_list )
113 setvar $VAR_HTTP_PATH "http://$value"
114 esac
115
116 return $DIALOG_OK
117}
118
119# f_media_set_http
120#
121# Return success if we both found and set the media type to be an HTTP server.
122#
123# Variables from variable.subr that can be used to script user input:
124#
125# VAR_HTTP_PATH
126# URL containing host and optionally a target path to the release
127# repository on the HTTP server. Valid examples include:
128# http://myhost
129# http://somename:80/pub/
130# http://192.168.2.3/pub/
131# http://[::1]:8000/
132# The default port if not specified is 80.
133# VAR_NAMESERVER [Optional]
134# If set, overrides resolv.conf(5) and sets the nameserver that
135# is used to convert names into addresses (when a name converts
136# into multiple addresses, the first address to successfully
137# connect is used).
138#
139# Meanwhile, the following variables from variable.subr are set after
140# successful execution:
141#
142# VAR_HTTP_HOST
143# The HTTP host to connect to, parsed from VAR_HTTP_PATH. In the
144# example case of IPv6 where VAR_HTTP_PATH is "http://[::1]" this
145# variable will be set to "::1" (the outer brackets are removed).
146# VAR_HTTP_PORT
147# The TCP port to connect to, parsed from VAR_HTTP_PATH. Usually
148# 80 unless VAR_HTTP_PATH was one of the following forms:
149# http://hostname:OTHER_PORT
150# http://hostname:OTHER_PORT/*
151# http://ip:OTHER_PORT
152# http://ip:OTHER_PORT/*
153# http://[ip6]:OTHER_PORT
154# http://[ip6]:OTHER_PORT/*
155# VAR_HTTP_DIR
156# If VAR_HTTP_PATH contained a directory element (e.g.,
157# "http://localhost/pub") this variable contains only the
158# directory element (e.g., "/pub").
159#
160f_media_set_http()
161{
162 f_media_close
163
164 local url
165 f_getvar $VAR_HTTP_PATH url
166
167 # If we've been through here before ...
168 if f_struct device_network && [ "${url#$msg_other}" ]; then
169 f_dialog_yesno "$msg_reuse_old_http_site_settings" || url=
170 fi
171
172 if [ ! "$url" ]; then
173 f_dialog_menu_media_http || return $FAILURE
174 f_getvar $VAR_HTTP_PATH url
175 fi
176 [ "$url" ] || return $FAILURE
177
178 case "$url" in
179 other)
180 setvar $VAR_HTTP_PATH "http://"
181 f_variable_get_value $VAR_HTTP_PATH \
182 "$msg_please_specify_url_of_freebsd_http_distribution"
183 f_getvar $VAR_HTTP_PATH url
184 if [ ! "${url#http://}" ]; then
185 unset $VAR_HTTP_PATH
186 return $FAILURE
187 fi
188 if [ ${#url} -gt ${URL_MAX:-261261} ]; then
189 f_show_msg "$msg_length_of_specified_url_is_too_long" \
190 ${#url} ${URL_MAX:-261261}
191 unset $VAR_HTTP_PATH
192 return $FAILURE
193 fi
194 case "$url" in
195 http://*) : valid URL ;;
196 *)
197 f_show_msg "$msg_sorry_invalid_url" "$url"
198 unset $VAR_HTTP_PATH
199 return $FAILURE
200 esac
201 esac
202 case "$url" in
203 http://*) : valid URL ;;
204 *)
205 f_show_msg "$msg_sorry_invalid_url" "$url"
206 unset $VAR_HTTP_PATH
207 return $FAILURE
208 esac
209
210 # Set the name of the HTTP device to the URL
211 f_struct_new DEVICE device_http
212 device_http set name "$url"
213
214 if ! f_struct device_network ||
215 ! f_dialog_yesno "$msg_youve_already_done_the_network_configuration"
216 then
217 f_struct device_network &&
218 f_device_shutdown network
219 if ! f_device_select_tcp; then
220 unset $VAR_HTTP_PATH
221 return $FAILURE
222 fi
223 local dev
224 f_getvar $VAR_NETWORK_DEVICE dev
225 f_struct_copy "device_$dev" device_network
226 fi
227 if ! f_device_init network; then
228 f_dprintf "f_media_set_http: %s" "$msg_net_device_init_failed"
229 unset $VAR_HTTP_PATH
230 return $FAILURE
231 fi
232
233 local hostname="${url#*://}" port=80 dir=/
234 case "$hostname" in
235 #
236 # The order in-which the below individual cases appear is important!
237 #
238 "["*"]":*/*) # IPv6 address with port and directory
239 f_dprintf "Looks like an IPv6 addr with port/dir: %s" \
240 "$hostname"
241 hostname="${hostname#\[}"
242 port="${hostname#*\]:}"
243 port="${port%%[!0-9]*}"
244 dir="/${hostname#*/}"
245 hostname="${hostname%%\]:*}"
246 ;;
247 "["*"]":*) # IPv6 address with port
248 f_dprintf "Looks like an IPv6 addr with port: %s" "$hostname"
249 hostname="${hostname#\[}"
250 port="${hostname#*\]:}"
251 port="${port%%[!0-9]*}"
252 hostname="${hostname%%\]:*}"
253 ;;
254 "["*"]"/*) # IPv6 address with directory
255 f_dprintf "Looks like an IPv6 addr with dir: %s" "$hostname"
256 hostname="${hostname#\[}"
257 dir="/${hostname#*/}"
258 hostname="${hostname%%\]*}"
259 ;;
260 "["*"]") # IPv6 address
261 f_dprintf "Looks like an IPv6 addr: %s" "$hostname"
262 hostname="${hostname#\[}"
263 hostname="${hostname%\]}"
264 ;;
265 #
266 # ^^^ IPv6 above / DNS Name or IPv4 below vvv
267 #
268 *:*/*) # DNS name or IPv4 address with port and directory
269 f_dprintf "Looks like a %s with port/dir: %s" \
270 "DNS name or IPv4 addr" "$hostname"
271 port="${hostname#*:}"
272 port="${port%%[!0-9]*}"
273 dir="/${hostname#*/}"
274 hostname="${hostname%%:*}"
275 ;;
276 *:*) # DNS name or IPv4 address with port
277 f_dprintf "Looks like a DNS name or IPv4 addr with port: %s" \
278 "$hostname"
279 port="${hostname#*:}"
280 hostname="${hostname%%:*}"
281 ;;
282 */*) # DNS name or IPv4 address with directory
283 f_dprintf "Looks like a DNS name or IPv4 addr with dir: %s" \
284 "$hostname"
285 dir="/${hostname#*/}"
286 hostname="${hostname%%/*}"
287 ;;
288 *) # DNS name or IPv4 address
289 f_dprintf "Looks like a DNS name or IPv4 addr: %s" "$hostname"
290 : leave hostname as-is
291 esac
292
293 f_dprintf "hostname = \`%s'" "$hostname"
294 f_dprintf "dir = \`%s'" "$dir"
295 f_dprintf "port \# = \`%d'" "$port"
296
297 local ns
298 f_getvar $VAR_NAMESERVER ns
299 [ "$ns" ] || f_resolv_conf_nameservers ns
300 if [ "$ns" -a ! "$HTTP_SKIP_RESOLV" ] && ! {
301 f_validate_ipaddr "$hostname" ||
302 f_validate_ipaddr6 "$hostname"
303 }; then
304 f_show_info "$msg_looking_up_host" "$hostname"
305 f_dprintf "%s: Looking up hostname, %s, using host(1)" \
306 "f_media_set_http" "$hostname"
307 if ! f_quietly f_host_lookup "$hostname"; then
308 f_show_msg "$msg_cannot_resolve_hostname" "$hostname"
309 f_struct device_network &&
310 f_device_shutdown network
311 f_struct_free device_network
312 unset $VAR_HTTP_PATH
313 return $FAILURE
314 fi
315 f_dprintf "Found DNS entry for %s successfully." "$hostname"
316 fi
317
318 setvar $VAR_HTTP_HOST "$hostname"
319 setvar $VAR_HTTP_PORT "$port"
320 setvar $VAR_HTTP_DIR "$dir"
321
322 device_http set type $DEVICE_TYPE_HTTP
323 device_http set init f_media_init_http
324 device_http set get f_media_get_http
324 device_http set shutdown :
325 device_http set shutdown f_media_shutdown_http
325 device_http set private network
326 f_struct_copy device_http device_media
327 f_struct_free device_http
328
329 return $SUCCESS
330}
331
332# f_http_check_access [$connect_only]
333#
334# Return success if able list a remote HTTP directory. If $connect_only is
335# present and non-null, then returns success if a connection can be made.
336# Variables from variable.subr that can be used to script user input:
337#
338# VAR_HTTP_HOST
339# The HTTP server host name, IPv4 address or IPv6 address.
340# Valid examples include:
341# myhost
342# 192.168.2.3
343# ::1
344# VAR_HTTP_PORT
345# The TCP port to connect to when communicating with the server.
346# VAR_HTTP_PATH
347# The HTTP path sent to the server. Unused if $connect_only is
348# present and non-NULL.
349#
350f_http_check_access()
351{
352 local connect_only="$1" hosts=
353
354 local http_host http_port
355 f_getvar $VAR_HTTP_HOST http_host
356 f_getvar $VAR_HTTP_PORT http_port
357
358 if ! {
359 f_validate_ipaddr "$http_host" ||
360 f_validate_ipaddr6 "$http_host" ||
361 {
362 f_dprintf "%s: Looking up hostname, %s, using host(1)" \
363 "f_http_check_access" "$http_host"
364 f_host_lookup "$http_host" hosts
365 }
366 }; then
367 # All the above validations failed
368 [ "$hosts" ] && f_dialog_msgbox "$hosts"
369 unset $VAR_HTTP_HOST
370 return $FAILURE
371 elif [ ! "$hosts" ]; then
372 # One of the first two validations passed
373 hosts="$http_host"
374 fi
375
376 local host connected=
377 for host in $hosts; do
378 f_quietly nc -nz "$host" "$http_port" || continue
379 connected=1; break
380 done
381 if [ ! "$connected" ]; then
382 f_show_msg "$msg_couldnt_connect_to_server http://%s:%s/" \
383 "$http_host" "$http_port"
384 unset $VAR_HTTP_HOST
385 return $FAILURE
386 fi
387 [ "$connect_only" ] && return $SUCCESS
388
389 local http_path
390 f_getvar $VAR_HTTP_PATH http_path
391 f_show_info "$msg_checking_access_to" "$http_path"
392
393 local rx
394 case "$http_path" in
395 http://*|/*) : valid request ;;
396 *) http_path="/$http_path" # full URI requests only
397 esac
398 if ! rx=$(
399 printf "GET %s/ HTTP/1.0\r\n\r\n" "${http_path%/}" |
400 nc -n "$host" "$http_port"
401 ); then
402 f_show_msg "$msg_couldnt_connect_to_server http://%s:%s/" \
403 "$http_host" "$http_port"
404 unset $VAR_HTTP_HOST
405 return $FAILURE
406 fi
407
408 local hdr
409 hdr=$( echo "$rx" | awk '/^\r$/{exit}{print}' )
410
411 local http_found=$FAILURE
412 if echo "$hdr" | awk '
413 BEGIN { found = 0 }
414 /^HTTP.... 200 / {
415 found = 1
416 exit
417 }
418 END { exit ! found }
419 '; then
420 http_found=$SUCCESS
421 fi
422
423 return $http_found
424}
425
426# f_media_init_http $device
427#
428# Initializes the HTTP media device. Returns success if able to confirm the
429# existence of at least one known HTTP server release path directly via HTTP
430# using f_http_check_access(), above.
431#
432# Variables from variable.subr that can be used to script user input:
433#
434# VAR_HTTP_HOST
435# The HTTP server to connect to. Must be set. Also see
436# f_http_check_access() for additional variables.
437# VAR_RELNAME
438# Usually set to `uname -r' but can be overridden.
439# VAR_HTTP_PATH
440# The HTTP path sent to the server. Usually set by calling
441# f_media_set_http().
442#
443# Meanwhile, after successful execution, the following variables (also from
444# variable.subr) are set:
445#
446# VAR_HTTP_PATH
447# The [possibly] adjusted VAR_HTTP_PATH that was found to contain
448# a valid FreeBSD repository.
449#
450f_media_init_http()
451{
452 local dev="$1"
453 f_dprintf "Init routine called for HTTP device. dev=[%s]" "$dev"
454
326 device_http set private network
327 f_struct_copy device_http device_media
328 f_struct_free device_http
329
330 return $SUCCESS
331}
332
333# f_http_check_access [$connect_only]
334#
335# Return success if able list a remote HTTP directory. If $connect_only is
336# present and non-null, then returns success if a connection can be made.
337# Variables from variable.subr that can be used to script user input:
338#
339# VAR_HTTP_HOST
340# The HTTP server host name, IPv4 address or IPv6 address.
341# Valid examples include:
342# myhost
343# 192.168.2.3
344# ::1
345# VAR_HTTP_PORT
346# The TCP port to connect to when communicating with the server.
347# VAR_HTTP_PATH
348# The HTTP path sent to the server. Unused if $connect_only is
349# present and non-NULL.
350#
351f_http_check_access()
352{
353 local connect_only="$1" hosts=
354
355 local http_host http_port
356 f_getvar $VAR_HTTP_HOST http_host
357 f_getvar $VAR_HTTP_PORT http_port
358
359 if ! {
360 f_validate_ipaddr "$http_host" ||
361 f_validate_ipaddr6 "$http_host" ||
362 {
363 f_dprintf "%s: Looking up hostname, %s, using host(1)" \
364 "f_http_check_access" "$http_host"
365 f_host_lookup "$http_host" hosts
366 }
367 }; then
368 # All the above validations failed
369 [ "$hosts" ] && f_dialog_msgbox "$hosts"
370 unset $VAR_HTTP_HOST
371 return $FAILURE
372 elif [ ! "$hosts" ]; then
373 # One of the first two validations passed
374 hosts="$http_host"
375 fi
376
377 local host connected=
378 for host in $hosts; do
379 f_quietly nc -nz "$host" "$http_port" || continue
380 connected=1; break
381 done
382 if [ ! "$connected" ]; then
383 f_show_msg "$msg_couldnt_connect_to_server http://%s:%s/" \
384 "$http_host" "$http_port"
385 unset $VAR_HTTP_HOST
386 return $FAILURE
387 fi
388 [ "$connect_only" ] && return $SUCCESS
389
390 local http_path
391 f_getvar $VAR_HTTP_PATH http_path
392 f_show_info "$msg_checking_access_to" "$http_path"
393
394 local rx
395 case "$http_path" in
396 http://*|/*) : valid request ;;
397 *) http_path="/$http_path" # full URI requests only
398 esac
399 if ! rx=$(
400 printf "GET %s/ HTTP/1.0\r\n\r\n" "${http_path%/}" |
401 nc -n "$host" "$http_port"
402 ); then
403 f_show_msg "$msg_couldnt_connect_to_server http://%s:%s/" \
404 "$http_host" "$http_port"
405 unset $VAR_HTTP_HOST
406 return $FAILURE
407 fi
408
409 local hdr
410 hdr=$( echo "$rx" | awk '/^\r$/{exit}{print}' )
411
412 local http_found=$FAILURE
413 if echo "$hdr" | awk '
414 BEGIN { found = 0 }
415 /^HTTP.... 200 / {
416 found = 1
417 exit
418 }
419 END { exit ! found }
420 '; then
421 http_found=$SUCCESS
422 fi
423
424 return $http_found
425}
426
427# f_media_init_http $device
428#
429# Initializes the HTTP media device. Returns success if able to confirm the
430# existence of at least one known HTTP server release path directly via HTTP
431# using f_http_check_access(), above.
432#
433# Variables from variable.subr that can be used to script user input:
434#
435# VAR_HTTP_HOST
436# The HTTP server to connect to. Must be set. Also see
437# f_http_check_access() for additional variables.
438# VAR_RELNAME
439# Usually set to `uname -r' but can be overridden.
440# VAR_HTTP_PATH
441# The HTTP path sent to the server. Usually set by calling
442# f_media_set_http().
443#
444# Meanwhile, after successful execution, the following variables (also from
445# variable.subr) are set:
446#
447# VAR_HTTP_PATH
448# The [possibly] adjusted VAR_HTTP_PATH that was found to contain
449# a valid FreeBSD repository.
450#
451f_media_init_http()
452{
453 local dev="$1"
454 f_dprintf "Init routine called for HTTP device. dev=[%s]" "$dev"
455
456 if [ "$HTTP_INITIALIZED" ]; then
457 f_dprintf "HTTP device already initialized."
458 return $SUCCESS
459 fi
460
455 #
456 # First verify access
457 #
458 local connect_only=1
459 f_http_check_access $connect_only
460
461 local http_host
462 f_getvar $VAR_HTTP_HOST http_host
463 while [ ! "$http_host" ]; do
464 f_media_set_http || return $FAILURE
465 f_http_check_access $connect_only
466 f_getvar $VAR_HTTP_HOST http_host
467 done
468
469 local http_path http_found=$FAILURE
470 while :; do
471 #
472 # Now that we've verified that the path we're given is ok,
473 # let's try to be a bit intelligent in locating the release we
474 # are looking for. First off, if the release is specified as
475 # "__RELEASE" or "any", then just assume that the current
476 # directory is the one we want and give up.
477 #
478 local rel
479 f_getvar $VAR_RELNAME rel
480 f_dprintf "f_media_init_http: rel=[%s]" "$rel"
481
482 case "$rel" in
483 __RELEASE|any)
484 f_getvar $VAR_HTTP_DIR $VAR_HTTP_PATH
485 f_http_check_access
486 http_found=$?
487 ;;
488 *)
489 #
490 # Ok, since we have a release variable, let's walk
491 # through the list of directories looking for a release
492 # directory. First successful path wins.
493 #
494 local fdir hp
495 f_getvar $VAR_HTTP_PATH%/ hp
461 #
462 # First verify access
463 #
464 local connect_only=1
465 f_http_check_access $connect_only
466
467 local http_host
468 f_getvar $VAR_HTTP_HOST http_host
469 while [ ! "$http_host" ]; do
470 f_media_set_http || return $FAILURE
471 f_http_check_access $connect_only
472 f_getvar $VAR_HTTP_HOST http_host
473 done
474
475 local http_path http_found=$FAILURE
476 while :; do
477 #
478 # Now that we've verified that the path we're given is ok,
479 # let's try to be a bit intelligent in locating the release we
480 # are looking for. First off, if the release is specified as
481 # "__RELEASE" or "any", then just assume that the current
482 # directory is the one we want and give up.
483 #
484 local rel
485 f_getvar $VAR_RELNAME rel
486 f_dprintf "f_media_init_http: rel=[%s]" "$rel"
487
488 case "$rel" in
489 __RELEASE|any)
490 f_getvar $VAR_HTTP_DIR $VAR_HTTP_PATH
491 f_http_check_access
492 http_found=$?
493 ;;
494 *)
495 #
496 # Ok, since we have a release variable, let's walk
497 # through the list of directories looking for a release
498 # directory. First successful path wins.
499 #
500 local fdir hp
501 f_getvar $VAR_HTTP_PATH%/ hp
496 for fdir in $HTTP_DIRS; do
497 setvar $VAR_HTTP_PATH "$hp/$fdir/$rel"
498 if f_http_check_access; then
499 http_found=$SUCCESS
500 break
501 fi
502 done
502 setvar $VAR_HTTP_PATH \
503 "$hp/freebsd:${UNAME_R%%.*}:$UNAME_PKG/latest"
504 if f_http_check_access; then
505 http_found=$SUCCESS
506 else
507 for fdir in $HTTP_DIRS; do
508 setvar $VAR_HTTP_PATH "$hp/$fdir/$rel"
509 if f_http_check_access; then
510 http_found=$SUCCESS
511 break
512 fi
513 done
514 fi
503 esac
504
515 esac
516
505 [ $http_found -eq $SUCCESS ] && break
517 if [ $http_found -eq $SUCCESS ]; then
518 HTTP_INITIALIZED=YES
519 break
520 fi
506
507 f_getvar $VAR_HTTP_PATH http_path
508 f_show_msg "$msg_please_check_the_url_and_try_again" \
509 "$http_path"
510
521
522 f_getvar $VAR_HTTP_PATH http_path
523 f_show_msg "$msg_please_check_the_url_and_try_again" \
524 "$http_path"
525
511 unset $VAR_HTTP_PATH
526 unset HTTP_INITIALIZED $VAR_HTTP_PATH
512 f_media_set_http || break
513 done
514
515 return $http_found
516}
517
518# f_media_get_http $device $file [$probe_type]
519#
520# Returns data from $file on an HTTP server using nc(1). Please note that
521# $device is unused but must be present (even if null). Information is instead
522# gathered from the environment. If $probe_type is both present and non-NULL,
523# this function exits after receiving the HTTP header response from the server
524# (if the HTTP response code is 200, success is returned; otherwise failure).
525# If $probe_type is equal to $PROBE_SIZE, prints the content-length in bytes
526# from the response (or -1 if not found) to standard-out.
527#
528# The variables used to configure the connection are as follows (all of which
529# are configured by f_media_set_http above):
530#
531# VAR_HTTP_HOST
532# HTTP server which to connect. Can be an IPv4 address, IPv6
533# address, or DNS hostname of your choice.
534# VAR_HTTP_PORT
535# TCP port to connect on; see f_media_set_http above.
536# VAR_HTTP_PATH
537# Directory prefix to use when requesting $file. Default is `/'
538# unless f_media_init_http was able to use f_http_check_access
539# to validate one of the defaults in $HTTP_DIRS (see GLOBALS at
540# the top of this file); assuming VAR_RELNAME was not set to
541# either `__RELEASE' or `any' (indicating that the global set of
542# $HTTP_DIRS should be ignored).
543#
544# See variable.subr for additional information.
545#
546# Example usage:
547# f_media_set_http
548# f_media_get_http media $file
549#
550f_media_get_http()
551{
552 local dev="$1" file="$2" probe_type="$3" hosts=
553
554 f_dprintf "f_media_get_http: dev=[%s] file=[%s] probe_type=%s" \
555 "$dev" "$file" "$probe_type"
556
557 local http_host http_port
558 f_getvar $VAR_HTTP_HOST http_host
559 f_getvar $VAR_HTTP_PORT http_port
560
527 f_media_set_http || break
528 done
529
530 return $http_found
531}
532
533# f_media_get_http $device $file [$probe_type]
534#
535# Returns data from $file on an HTTP server using nc(1). Please note that
536# $device is unused but must be present (even if null). Information is instead
537# gathered from the environment. If $probe_type is both present and non-NULL,
538# this function exits after receiving the HTTP header response from the server
539# (if the HTTP response code is 200, success is returned; otherwise failure).
540# If $probe_type is equal to $PROBE_SIZE, prints the content-length in bytes
541# from the response (or -1 if not found) to standard-out.
542#
543# The variables used to configure the connection are as follows (all of which
544# are configured by f_media_set_http above):
545#
546# VAR_HTTP_HOST
547# HTTP server which to connect. Can be an IPv4 address, IPv6
548# address, or DNS hostname of your choice.
549# VAR_HTTP_PORT
550# TCP port to connect on; see f_media_set_http above.
551# VAR_HTTP_PATH
552# Directory prefix to use when requesting $file. Default is `/'
553# unless f_media_init_http was able to use f_http_check_access
554# to validate one of the defaults in $HTTP_DIRS (see GLOBALS at
555# the top of this file); assuming VAR_RELNAME was not set to
556# either `__RELEASE' or `any' (indicating that the global set of
557# $HTTP_DIRS should be ignored).
558#
559# See variable.subr for additional information.
560#
561# Example usage:
562# f_media_set_http
563# f_media_get_http media $file
564#
565f_media_get_http()
566{
567 local dev="$1" file="$2" probe_type="$3" hosts=
568
569 f_dprintf "f_media_get_http: dev=[%s] file=[%s] probe_type=%s" \
570 "$dev" "$file" "$probe_type"
571
572 local http_host http_port
573 f_getvar $VAR_HTTP_HOST http_host
574 f_getvar $VAR_HTTP_PORT http_port
575
576 if [ ! "$HTTP_INITIALIZED" ]; then
577 f_dprintf "No HTTP connection open, can't get file %s" "$file"
578 return $FAILURE
579 fi
580
561 if ! {
562 f_validate_ipaddr "$http_host" ||
563 f_validate_ipaddr6 "$http_host" ||
564 {
565 f_dprintf "%s: Looking up hostname, %s, using host(1)" \
566 "f_media_get_http" "$http_host"
567 f_host_lookup "$http_host" hosts
568 }
569 }; then
570 # All the above validations failed
571 [ "$hosts" ] && f_dialog_msgbox "$hosts"
572 return $FAILURE
573 elif [ ! "$hosts" ]; then
574 # One of the first two validations passed
575 hosts="$http_host"
576 fi
577
578 local host connected=
579 for host in $hosts; do
580 f_quietly nc -nz "$host" "$http_port" || continue
581 connected=1; break
582 done
583 if [ ! "$connected" ]; then
584 f_show_msg "$msg_couldnt_connect_to_server http://%s:%s/" \
585 "$http_host" "$http_port"
586 return $FAILURE
587 fi
588
589 local http_path
590 f_getvar $VAR_HTTP_PATH%/ http_path
591 case "$http_path" in
592 http://*|/*) : valid request ;;
593 *) http_path="/$http_path" # full URI requests only
594 esac
595
596 local url="$http_path/$file" rx
597 f_dprintf "sending http request for: %s" "$url"
598 f_dprintf "using nc to connect to: %s:%s" "$host" "$http_port"
599 printf "GET %s HTTP/1.0\r\n\r\n" "$url" | nc -n "$host" "$http_port" |
600 (
601 #
602 # scan the headers of the response
603 # this is extremely quick'n dirty
604 #
605
606 rv=0 length=-1
607 while read LINE; do
608 case "$LINE" in
609 HTTP*)
610 f_dprintf "received response: %s" "$LINE"
611 set -- $LINE; rv=$2
612 f_isinteger "$rv" || rv=0
613 ;;
614 "Content-Length: "*)
615 length="${LINE%
616}"
617 length="${length#Content-Length: }"
618 f_dprintf "received content-length: %s" \
619 "$length"
620 ;;
621 *)
622 [ "${LINE%
623}" ] || break # End of headers
624 esac
625 done
626
627 [ $rv -ge 500 ] && exit 5
628 [ $rv -eq 404 ] && exit 44
629 [ $rv -ge 400 ] && exit 4
630 [ $rv -ge 300 ] && exit 3
631 [ $rv -eq 200 ] || exit $FAILURE
632
633 if [ ! "$probe_type" ]; then
634 cat # output the rest ``as-is''
635 elif [ "$probe_type" = "$PROBE_SIZE" ]; then
636 f_isinteger "$length" || length=-1
637 echo "$length"
638 fi
639 exit 200
640 )
641 local retval=$?
642 [ $retval -eq 200 ] && return $SUCCESS
643 [ "$probe_type" ] && return $FAILURE
644
645 case "$retval" in
646 5) f_show_msg "$msg_server_error_when_requesting_url" "$url" ;;
647 44) f_show_msg "$msg_url_was_not_found" "$url" ;;
648 4) f_show_msg "$msg_client_error" ;;
649 *) f_show_msg "$msg_error_when_requesting_url" "$url" ;;
650 esac
651 return $FAILURE
652}
653
581 if ! {
582 f_validate_ipaddr "$http_host" ||
583 f_validate_ipaddr6 "$http_host" ||
584 {
585 f_dprintf "%s: Looking up hostname, %s, using host(1)" \
586 "f_media_get_http" "$http_host"
587 f_host_lookup "$http_host" hosts
588 }
589 }; then
590 # All the above validations failed
591 [ "$hosts" ] && f_dialog_msgbox "$hosts"
592 return $FAILURE
593 elif [ ! "$hosts" ]; then
594 # One of the first two validations passed
595 hosts="$http_host"
596 fi
597
598 local host connected=
599 for host in $hosts; do
600 f_quietly nc -nz "$host" "$http_port" || continue
601 connected=1; break
602 done
603 if [ ! "$connected" ]; then
604 f_show_msg "$msg_couldnt_connect_to_server http://%s:%s/" \
605 "$http_host" "$http_port"
606 return $FAILURE
607 fi
608
609 local http_path
610 f_getvar $VAR_HTTP_PATH%/ http_path
611 case "$http_path" in
612 http://*|/*) : valid request ;;
613 *) http_path="/$http_path" # full URI requests only
614 esac
615
616 local url="$http_path/$file" rx
617 f_dprintf "sending http request for: %s" "$url"
618 f_dprintf "using nc to connect to: %s:%s" "$host" "$http_port"
619 printf "GET %s HTTP/1.0\r\n\r\n" "$url" | nc -n "$host" "$http_port" |
620 (
621 #
622 # scan the headers of the response
623 # this is extremely quick'n dirty
624 #
625
626 rv=0 length=-1
627 while read LINE; do
628 case "$LINE" in
629 HTTP*)
630 f_dprintf "received response: %s" "$LINE"
631 set -- $LINE; rv=$2
632 f_isinteger "$rv" || rv=0
633 ;;
634 "Content-Length: "*)
635 length="${LINE%
636}"
637 length="${length#Content-Length: }"
638 f_dprintf "received content-length: %s" \
639 "$length"
640 ;;
641 *)
642 [ "${LINE%
643}" ] || break # End of headers
644 esac
645 done
646
647 [ $rv -ge 500 ] && exit 5
648 [ $rv -eq 404 ] && exit 44
649 [ $rv -ge 400 ] && exit 4
650 [ $rv -ge 300 ] && exit 3
651 [ $rv -eq 200 ] || exit $FAILURE
652
653 if [ ! "$probe_type" ]; then
654 cat # output the rest ``as-is''
655 elif [ "$probe_type" = "$PROBE_SIZE" ]; then
656 f_isinteger "$length" || length=-1
657 echo "$length"
658 fi
659 exit 200
660 )
661 local retval=$?
662 [ $retval -eq 200 ] && return $SUCCESS
663 [ "$probe_type" ] && return $FAILURE
664
665 case "$retval" in
666 5) f_show_msg "$msg_server_error_when_requesting_url" "$url" ;;
667 44) f_show_msg "$msg_url_was_not_found" "$url" ;;
668 4) f_show_msg "$msg_client_error" ;;
669 *) f_show_msg "$msg_error_when_requesting_url" "$url" ;;
670 esac
671 return $FAILURE
672}
673
674# f_media_shutdown_http $device
675#
676# Shuts down the HTTP device. Return status should be ignored. Note that since
677# we don't maintain an open connection to the HTTP server, nothing to do.
678#
679f_media_shutdown_http()
680{
681 [ "$HTTP_INITIALIZED" ] || return $SUCCESS
682
683 unset HTTP_INITIALIZED
684}
685
654############################################################ MAIN
655
656f_dprintf "%s: Successfully loaded." media/http.subr
657
658fi # ! $_MEDIA_HTTP_SUBR
686############################################################ MAIN
687
688f_dprintf "%s: Successfully loaded." media/http.subr
689
690fi # ! $_MEDIA_HTTP_SUBR