indexing
	description: "Unified resource locators"
	status: "See note at end of class"
	date: "$Date$"
	revision: "$Revision$"

deferred class interface
	URL

feature -- Access

	default_port: INTEGER
			-- Default port number for service

	hash_code: INTEGER
			-- Hash code value
			-- (from HASHABLE)
		ensure -- from HASHABLE
			good_hash_value: Result >= 0

	location: STRING
			-- Full URL of resource

	port: INTEGER
			-- Port used by service

	proxy_host: STRING
			-- Name or address of proxy host
		require
			proxy_supported: is_proxy_supported
			has_proxy: is_proxy_used
		ensure
			result_not_empty: Result /= void and then not Result.is_empty

	proxy_port: INTEGER
			-- Port of proxy
		require
			proxy_supported: is_proxy_supported
			has_proxy: is_proxy_used
		ensure
			result_non_negative: Result >= 0

	service: STRING
			-- Name of service
	
feature -- Status report

	has_username: BOOLEAN
			-- Can address contain a username?

	is_correct: BOOLEAN
			-- Is URL correct?

	is_hashable: BOOLEAN
			-- May current object be hashed?
			-- (True if it is not its type's default.)
			-- (from HASHABLE)
		ensure -- from HASHABLE
			ok_if_not_default: Result implies (Current /= default)

	is_password_accepted: BOOLEAN
			-- Can a password be set?

	is_proxy_supported: BOOLEAN
			-- Are proxy connections supported?

	is_proxy_used: BOOLEAN
			-- Is a proxy used?

	proxy_host_ok (host: STRING): BOOLEAN
			-- Is host name of proxy correct?
		require
			proxy_supported: is_proxy_supported
	
feature -- Status setting

	reset_proxy
			-- Reset proxy information.
		require
			proxy_supported: is_proxy_supported
		ensure
			no_proxy_set: not is_proxy_used
			port_reset: proxy_port = 0

	set_password (pw: STRING)
			-- Set password.
		require
			password_accepted: is_password_accepted
			non_empty_password: pw /= void and then not pw.is_empty

	set_port (port_no: INTEGER)
			-- Set port to port_no.
		require
			port_non_negative: port_no >= 0
		ensure
			port_set: port = port_no

	set_proxy (host: STRING; port_no: INTEGER)
			-- Set proxy host to host and proxy port to port_no.
		require
			proxy_supported: is_proxy_supported
			non_empty_host: host /= void and then not host.is_empty
			host_valid: proxy_host_ok (host)
			non_negative_port: port_no >= 0
		ensure
			host_set: proxy_host = host
			port_set: proxy_port = port_no

	set_proxy_information (pi: PROXY_INFORMATION)
			-- Set proxy information to pi.
		require
			proxy_supported: is_proxy_supported
		ensure
			proxy_information_set: proxy_information = pi

	set_username (un: STRING)
			-- Set username.
		require
			username_ok: has_username
			non_empty_username: un /= void and then not un.is_empty
	
invariant

	proxy_used_definition: is_proxy_used = (proxy_information /= void)
	proxy_usage_constraint: is_proxy_used implies is_proxy_supported
		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)

end -- class URL