diff --git a/contrib/ise_library/cURL b/contrib/ise_library/cURL
index 2b7043f6..ad2a498f 160000
--- a/contrib/ise_library/cURL
+++ b/contrib/ise_library/cURL
@@ -1 +1 @@
-Subproject commit 2b7043f670f6efc70ebed5fbf62d83a22c095ffe
+Subproject commit ad2a498fc067926713ffdc0a9db99358f142fada
diff --git a/draft/library/server/request/rest/src/response/rest_response.e b/draft/library/server/request/rest/src/response/rest_response.e
index d098867d..405eeaf9 100644
--- a/draft/library/server/request/rest/src/response/rest_response.e
+++ b/draft/library/server/request/rest/src/response/rest_response.e
@@ -7,6 +7,17 @@ note
class
REST_RESPONSE
+inherit
+ WSF_PAGE_RESPONSE
+ rename
+ header as headers,
+ body as message,
+ set_body as set_message,
+ put_string as append_message,
+ make as page_make,
+ send_to as send
+ end
+
create
make
@@ -15,12 +26,7 @@ feature {NONE} -- Initialization
make (a_api: like api)
do
api := a_api
- initialize
- end
-
- initialize
- do
- create headers.make
+ page_make
end
feature -- Recycle
@@ -28,123 +34,17 @@ feature -- Recycle
recycle
do
headers.recycle
+ message := Void
end
feature -- Access
- headers: HTTP_HEADER
-
api: STRING
-- Associated api query string.
- message: detachable STRING_8
- -- Associated message to send with the response.
-
-feature -- Element change
-
- set_message (m: like message)
- -- Set `message' to `m'
- do
- message := m
- end
-
- append_message (m: attached like message)
- -- Append message `m' to current `message' value
- -- create `message' is Void
- require
- m_not_empty: m /= Void and then not m.is_empty
- do
- if attached message as msg then
- msg.append (m)
- else
- set_message (m.string)
- end
- end
-
- append_message_file_content (fn: STRING)
- -- Append file content from `fn' to the response
- --| To use with care.
- --| You should avoid using this for big or binary content ...
- local
- f: RAW_FILE
- do
- create f.make (fn)
- if f.exists and then f.is_readable then
- f.open_read
- from
- until
- f.exhausted
- loop
- f.read_stream (1024)
- append_message (f.last_string)
- end
- f.close
- end
- end
-
-feature -- Output
-
- update_content_length (a_overwrite: BOOLEAN)
- -- Update content length
- -- if the header already exists it won't change it,
- -- unless `a_overwrite' is set to True
- local
- hds: like headers
- len: INTEGER
- do
- hds := headers
- if a_overwrite or else not hds.has_content_length then
- if attached message as m then
- len := m.count
--- if {PLATFORM}.is_windows then
--- len := len + m.occurrences ('%N') --| FIXME: find better solution
--- end
- else
- len := 0
- end
- hds.put_content_length (len)
- end
- end
-
- compute
- -- Compute the string output
- do
- update_content_length (False)
- internal_headers_string := headers.string
- end
-
- headers_string: STRING
- local
- o: like internal_headers_string
- do
- o := internal_headers_string
- if o = Void then
- compute
- o := internal_headers_string
- if o = Void then
- check output_computed: False end
- create o.make_empty
- end
- end
- Result := o
- end
-
- send (res: WSF_RESPONSE)
- do
- compute
- res.set_status_code (200)
- res.put_header_text (headers_string)
- if attached message as m then
- res.put_string (m)
- end
- end
-
-feature {NONE} -- Implementation: output
-
- internal_headers_string: detachable like headers_string
-
-;note
- copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
+invariant
+note
+ copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/client/http_client/http_client-safe.ecf b/library/client/http_client/http_client-safe.ecf
index 8ff790a5..de757e10 100644
--- a/library/client/http_client/http_client-safe.ecf
+++ b/library/client/http_client/http_client-safe.ecf
@@ -10,6 +10,7 @@
+
@@ -23,17 +24,4 @@
-
-
-
- /.git$
- /EIFGENs$
- /.svn$
-
-
-
-
-
diff --git a/library/client/http_client/http_client.ecf b/library/client/http_client/http_client.ecf
index ee034729..a4ec1415 100644
--- a/library/client/http_client/http_client.ecf
+++ b/library/client/http_client/http_client.ecf
@@ -10,6 +10,7 @@
+
diff --git a/library/client/http_client/src/http_client_session.e b/library/client/http_client/src/http_client_session.e
index d4c02ef1..d8245b9d 100644
--- a/library/client/http_client/src/http_client_session.e
+++ b/library/client/http_client/src/http_client_session.e
@@ -1,12 +1,29 @@
note
- description : "Objects that ..."
- author : "$Author$"
- date : "$Date$"
- revision : "$Revision$"
+ description : "[
+ HTTP_CLIENT_SESSION represent a session
+ and is used to call get, post, .... request
+ with predefined settings such as
+ base_url
+ specific common headers
+ timeout and so on ...
+ ]"
+ author: "$Author$"
+ date: "$Date$"
+ revision: "$Revision$"
deferred class
HTTP_CLIENT_SESSION
+inherit
+ ANY
+
+ HTTP_CLIENT_CONSTANTS
+ rename
+ auth_type_id as auth_type_id_from_string
+ export
+ {NONE} all
+ end
+
feature {NONE} -- Initialization
make (a_base_url: READABLE_STRING_8)
@@ -154,37 +171,36 @@ feature -- Change
set_auth_type (s: READABLE_STRING_8)
do
auth_type := s
- auth_type_id := http_client_constants.auth_type_id (s)
+ auth_type_id := auth_type_id_from_string (s)
end
set_basic_auth_type
do
auth_type := "basic"
- auth_type_id := {HTTP_CLIENT_CONSTANTS}.auth_type_basic
+ auth_type_id := Auth_type_basic
end
set_digest_auth_type
do
auth_type := "digest"
- auth_type_id := {HTTP_CLIENT_CONSTANTS}.auth_type_digest
+ auth_type_id := Auth_type_digest
end
set_any_auth_type
do
auth_type := "any"
- auth_type_id := {HTTP_CLIENT_CONSTANTS}.auth_type_any
+ auth_type_id := Auth_type_any
end
set_anysafe_auth_type
do
auth_type := "anysafe"
- auth_type_id := {HTTP_CLIENT_CONSTANTS}.auth_type_anysafe
+ auth_type_id := Auth_type_anysafe
end
-feature {NONE} -- Implementation
-
- http_client_constants: HTTP_CLIENT_CONSTANTS
- once
- create Result
+ set_max_redirects (n: like max_redirects)
+ do
+ max_redirects := n
end
+
end
diff --git a/library/client/http_client/src/spec/libcurl/libcurl_http_client_request.e b/library/client/http_client/src/spec/libcurl/libcurl_http_client_request.e
index fb3c7c90..a990914e 100644
--- a/library/client/http_client/src/spec/libcurl/libcurl_http_client_request.e
+++ b/library/client/http_client/src/spec/libcurl/libcurl_http_client_request.e
@@ -24,6 +24,15 @@ feature {NONE} -- Initialization
do
make_request (a_url, a_session, ctx)
request_method := a_request_method
+ apply_workaround
+ end
+
+ apply_workaround
+ -- Due to issue with Eiffel cURL on Windows 32bits
+ -- we need to do the following workaround
+ once
+ if attached (create {INET_ADDRESS_FACTORY}).create_localhost then
+ end
end
session: LIBCURL_HTTP_CLIENT_SESSION
@@ -40,7 +49,6 @@ feature -- Execution
l_curl_string: CURL_STRING
l_url: READABLE_STRING_8
p: POINTER
- a_data: CELL [detachable ANY]
l_form, l_last: CURL_FORM
curl: CURL_EXTERNALS
curl_easy: CURL_EASY_EXTERNALS
@@ -194,22 +202,32 @@ feature -- Execution
l_result := curl_easy.perform (curl_handle)
if l_result = {CURL_CODES}.curle_ok then
- create a_data.put (Void)
- l_result := curl_easy.getinfo (curl_handle, {CURL_INFO_CONSTANTS}.curlinfo_response_code, a_data)
- if l_result = 0 and then attached {INTEGER} a_data.item as l_http_status then
- Result.status := l_http_status
- else
- Result.status := 0
- end
-
+ Result.status := response_status_code (curl_easy, curl_handle)
set_header_and_body_to (l_curl_string.string, Result)
else
Result.set_error_occurred (True)
+ Result.status := response_status_code (curl_easy, curl_handle)
end
curl_easy.cleanup (curl_handle)
end
+feature {NONE} -- Implementation
+
+ response_status_code (curl_easy: CURL_EASY_EXTERNALS; curl_handle: POINTER): INTEGER
+ local
+ l_result: INTEGER
+ a_data: CELL [detachable ANY]
+ do
+ create a_data.put (Void)
+ l_result := curl_easy.getinfo (curl_handle, {CURL_INFO_CONSTANTS}.curlinfo_response_code, a_data)
+ if l_result = 0 and then attached {INTEGER} a_data.item as l_http_status then
+ Result := l_http_status
+ else
+ Result := 0
+ end
+ end
+
set_header_and_body_to (a_source: READABLE_STRING_8; res: HTTP_CLIENT_RESPONSE)
-- Parse `a_source' response
diff --git a/library/client/http_client/tests/test-safe.ecf b/library/client/http_client/tests/test-safe.ecf
new file mode 100644
index 00000000..6c32920a
--- /dev/null
+++ b/library/client/http_client/tests/test-safe.ecf
@@ -0,0 +1,18 @@
+
+
+
+
+
+ /.git$
+ /EIFGENs$
+ /.svn$
+
+
+
+
+
+
+
+
diff --git a/library/client/http_client/tests/test.e b/library/client/http_client/tests/test.e
new file mode 100644
index 00000000..0073561a
--- /dev/null
+++ b/library/client/http_client/tests/test.e
@@ -0,0 +1,50 @@
+class TEST
+
+create
+ make
+
+feature -- Init
+
+ make
+ do
+ test_http_client
+ end
+
+ test_http_client
+ -- New test routine
+ local
+ sess: LIBCURL_HTTP_CLIENT_SESSION
+ h: STRING_8
+ do
+ create sess.make ("http://www.google.com")
+ if attached sess.get ("/search?q=eiffel", Void) as res then
+ assert ("Get returned without error", not res.error_occurred)
+ create h.make_empty
+ if attached res.headers as hds then
+ across
+ hds as c
+ loop
+ h.append (c.item.name + ": " + c.item.value + "%R%N")
+ end
+ end
+ if attached res.body as l_body then
+ assert ("body not empty", not l_body.is_empty)
+ end
+ assert ("same headers", h.same_string (res.raw_header))
+ else
+ assert ("Not found", False)
+ end
+ end
+
+ assert (m: READABLE_STRING_8; b: BOOLEAN)
+ local
+ e: DEVELOPER_EXCEPTION
+ do
+ if not b then
+ create e
+ e.set_message (m)
+ e.raise
+ end
+ end
+
+end
diff --git a/library/client/http_client/tests/test_http_client.e b/library/client/http_client/tests/test_http_client.e
index 5e687dd9..a5cf2228 100644
--- a/library/client/http_client/tests/test_http_client.e
+++ b/library/client/http_client/tests/test_http_client.e
@@ -23,6 +23,7 @@ feature -- Test routines
do
create sess.make ("http://www.google.com")
if attached sess.get ("/search?q=eiffel", Void) as res then
+ assert ("Get returned without error", not res.error_occurred)
create h.make_empty
if attached res.headers as hds then
across
@@ -32,7 +33,9 @@ feature -- Test routines
end
end
if attached res.body as l_body then
-
+ assert ("body not empty", not l_body.is_empty)
+ else
+ assert ("missing body", False)
end
assert ("same headers", h.same_string (res.raw_header))
else
@@ -67,20 +70,21 @@ feature -- Test routines
h.append (c.item.name + ": " + c.item.value + "%N")
end
end
- assert ("Expected headers map", h.same_string ("[
- normal: NORMAL
- concat: ABC
- concat: DEF
- key1: KEY
- key2: KEY
- key3: KEY
- value1: VALUE
- value2: VALUE
- value3: VALUE
- value4: VALUE
- foo: BAR
+ assert ("Expected headers map", h.same_string (
+"[
+normal: NORMAL
+concat: ABC
+concat: DEF
+key1: KEY
+key2: KEY
+key3: KEY
+value1: VALUE
+value2: VALUE
+value3: VALUE
+value4: VALUE
+foo: BAR
- ]"))
+]"))
end
end
diff --git a/library/error/src/error.e b/library/error/src/error.e
index 5687ecac..e4c266b0 100644
--- a/library/error/src/error.e
+++ b/library/error/src/error.e
@@ -8,6 +8,11 @@ note
deferred class
ERROR
+inherit
+ ANY
+
+ DEBUG_OUTPUT
+
feature -- Access
code: INTEGER
@@ -16,13 +21,13 @@ feature -- Access
result_not_zero: Result /= 0
end
- name: STRING
+ name: READABLE_STRING_8
deferred
ensure
result_attached: Result /= Void
end
- message: detachable STRING_32
+ message: detachable READABLE_STRING_32
-- Potential error message
deferred
end
@@ -47,6 +52,13 @@ feature -- String representation
end
end
+feature -- Status report
+
+ debug_output: STRING
+ do
+ Result := string_representation.as_string_8
+ end
+
feature -- Change
set_parent (a_parent: like parent)
@@ -68,7 +80,7 @@ invariant
name_attached: name /= Void
note
- copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/error/src/error_custom.e b/library/error/src/error_custom.e
index 7b139fab..cd339662 100644
--- a/library/error/src/error_custom.e
+++ b/library/error/src/error_custom.e
@@ -16,12 +16,12 @@ create
feature {NONE} -- Initialization
- make (a_code: INTEGER; a_name: STRING; a_message: detachable like message)
+ make (a_code: INTEGER; a_name: like name; a_message: detachable like message)
-- Initialize `Current'.
do
code := a_code
name := a_name
- if attached a_message then
+ if a_message /= Void then
message := a_message
else
message := "Error: " + a_name + " (code=" + a_code.out + ")"
@@ -32,9 +32,9 @@ feature -- Access
code: INTEGER
- name: STRING
+ name: READABLE_STRING_8
- message: STRING_32
+ message: detachable READABLE_STRING_32
feature -- Visitor
@@ -45,7 +45,7 @@ feature -- Visitor
end
note
- copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/error/src/error_handler.e b/library/error/src/error_handler.e
index c6e72c8b..e6ff72fa 100644
--- a/library/error/src/error_handler.e
+++ b/library/error/src/error_handler.e
@@ -21,7 +21,7 @@ feature {NONE} -- Initialization
make
-- Initialize `Current'.
do
- create {ARRAYED_LIST [ERROR]} errors.make (3)
+ create {ARRAYED_LIST [like errors.item]} errors.make (3)
create error_added_actions
end
@@ -34,6 +34,7 @@ feature -- Status
end
count: INTEGER
+ -- Number of error
do
Result := errors.count
end
@@ -60,12 +61,140 @@ feature -- Events
error_added_actions: ACTION_SEQUENCE [TUPLE [ERROR]]
-- Actions triggered when a new error is added
+feature -- Synchronization
+
+ add_synchronization (h: ERROR_HANDLER)
+ -- Add synchronization between `h' and `Current'
+ --| the same handler can be added more than once
+ --| it will be synchronized only once
+ local
+ lst: like synchronized_handlers
+ do
+ lst := synchronized_handlers
+ if lst = Void then
+ create {ARRAYED_LIST [like synchronized_handlers.item]} lst.make (0)
+ lst.compare_references
+ synchronized_handlers := lst
+ end
+ if lst.has (h) then
+ check attached h.synchronized_handlers as h_lst and then h_lst.has (Current) end
+ else
+ lst.extend (h)
+ h.add_synchronization (Current)
+ end
+ end
+
+ remove_synchronization (h: ERROR_HANDLER)
+ -- Remove synchronization between `h' and `Current'
+ do
+ if attached synchronized_handlers as lst and then not lst.is_empty then
+ synchronized_handlers := Void
+ lst.prune_all (h)
+
+ h.remove_synchronization (Current)
+
+ synchronized_handlers := lst
+ if lst.is_empty then
+ synchronized_handlers := Void
+ end
+ end
+ end
+
+feature {ERROR_HANDLER} -- Synchronization implementation
+
+ synchronized_handlers: detachable LIST [ERROR_HANDLER]
+ -- Synchronized handlers
+
+ synchronize_error_from (e: ERROR; h_lst: LIST [ERROR_HANDLER])
+ -- Called by error_handler during synchronization process
+ -- if `synchronized_handlers' is Void, this means Current is synchronizing
+ -- this is to prevent infinite cycle iteration
+ require
+ not h_lst.has (Current)
+ do
+ h_lst.extend (Current)
+
+ if attached synchronized_handlers as lst then
+ synchronized_handlers := Void
+ add_error (e)
+ across
+ lst as c
+ loop
+ if not h_lst.has (c.item) then
+ c.item.synchronize_error_from (e, h_lst)
+ end
+ end
+ synchronized_handlers := lst
+ else
+ -- In synchronization
+ end
+ end
+
+ synchronize_reset_from (h_lst: LIST [ERROR_HANDLER])
+ -- Called by error_handler during synchronization process
+ -- if `synchronized_handlers' is Void, this means Current is synchronizing
+ -- this is to prevent infinite cycle iteration
+ require
+ not h_lst.has (Current)
+ do
+ h_lst.extend (Current)
+ if attached synchronized_handlers as lst then
+ synchronized_handlers := Void
+ reset
+ across
+ lst as c
+ loop
+ if not h_lst.has (c.item) then
+ c.item.synchronize_reset_from (h_lst)
+ end
+ end
+ synchronized_handlers := lst
+ else
+ -- In synchronization
+ end
+ end
+
feature {NONE} -- Event: implementation
on_error_added (e: ERROR)
-- Error `e' was just added
+ local
+ sync_list: LINKED_LIST [ERROR_HANDLER]
do
error_added_actions.call ([e])
+ if attached synchronized_handlers as lst then
+ synchronized_handlers := Void
+ create sync_list.make
+ sync_list.extend (Current)
+ across
+ lst as c
+ loop
+ if not sync_list.has (c.item) then
+ c.item.synchronize_error_from (e, sync_list)
+ end
+ end
+ synchronized_handlers := lst
+ end
+ end
+
+ on_reset
+ -- `reset' was just called
+ local
+ sync_list: LINKED_LIST [ERROR_HANDLER]
+ do
+ if attached synchronized_handlers as lst then
+ synchronized_handlers := Void
+ create sync_list.make
+ sync_list.extend (Current)
+ across
+ lst as c
+ loop
+ if not sync_list.has (c.item) then
+ c.item.synchronize_reset_from (sync_list)
+ end
+ end
+ synchronized_handlers := lst
+ end
end
feature -- Basic operation
@@ -110,6 +239,7 @@ feature -- Basic operation
feature -- Access
as_single_error: detachable ERROR
+ -- All error(s) concatenated into one single error.
do
if count > 1 then
create {ERROR_GROUP} Result.make (errors)
@@ -121,6 +251,7 @@ feature -- Access
end
as_string_representation: STRING
+ -- String representation of all error(s).
require
has_error
do
@@ -138,18 +269,40 @@ feature -- Element changes
-- Concatenate into a single error if any
do
if count > 1 and then attached as_single_error as e then
- wipe_out
- errors.force (e)
+ reset
+ add_error (e)
end
end
- reset, wipe_out
+ reset
+ -- Reset error handler
do
- errors.wipe_out
+ if errors.count > 0 then
+ errors.wipe_out
+ on_reset
+ end
+ ensure
+ has_no_error: not has_error
+ count = 0
+ end
+
+ destroy
+ -- Destroy Current, and remove any synchronization
+ do
+ error_added_actions.wipe_out
+ if attached synchronized_handlers as lst then
+ across
+ lst as c
+ loop
+ c.item.remove_synchronization (Current)
+ end
+ end
+ synchronized_handlers := Void
+ reset
end
note
- copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/error/src/visitor/file_output_error_visitor.e b/library/error/src/visitor/file_output_error_visitor.e
index 588c4250..49e9493f 100644
--- a/library/error/src/visitor/file_output_error_visitor.e
+++ b/library/error/src/visitor/file_output_error_visitor.e
@@ -31,7 +31,7 @@ feature -- Access
feature -- Output
- output_string (a_str: detachable STRING_GENERAL)
+ output_string (a_str: detachable READABLE_STRING_GENERAL)
-- Output Unicode string
do
if a_str /= Void then
@@ -50,4 +50,14 @@ feature -- Output
file.put_new_line
end
+note
+ copyright: "2011-2012, Eiffel Software and others"
+ license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
+ source: "[
+ Eiffel Software
+ 5949 Hollister Ave., Goleta, CA 93117 USA
+ Telephone 805-685-1006, Fax 805-685-6869
+ Website http://www.eiffel.com
+ Customer support http://support.eiffel.com
+ ]"
end
diff --git a/library/error/src/visitor/output_error_visitor.e b/library/error/src/visitor/output_error_visitor.e
index 22d1128d..50b05b3d 100644
--- a/library/error/src/visitor/output_error_visitor.e
+++ b/library/error/src/visitor/output_error_visitor.e
@@ -13,7 +13,7 @@ inherit
feature -- Output
- output_string (a_str: detachable STRING_GENERAL)
+ output_string (a_str: detachable READABLE_STRING_GENERAL)
-- Output Unicode string
deferred
end
@@ -21,7 +21,7 @@ feature -- Output
output_any (obj: detachable ANY)
-- Output Unicode string
do
- if attached {STRING_GENERAL} obj as l_str then
+ if attached {READABLE_STRING_GENERAL} obj as l_str then
to_implement ("Convert into UTF-8 or console encoding before output")
output_string (l_str)
elseif obj /= Void then
diff --git a/library/error/src/visitor/text_output_error_visitor.e b/library/error/src/visitor/text_output_error_visitor.e
index bff7f86f..b79b1b75 100644
--- a/library/error/src/visitor/text_output_error_visitor.e
+++ b/library/error/src/visitor/text_output_error_visitor.e
@@ -31,7 +31,7 @@ feature -- Access
feature -- Output
- output_string (a_str: detachable STRING_GENERAL)
+ output_string (a_str: detachable READABLE_STRING_GENERAL)
-- Output Unicode string
do
if a_str /= Void then
@@ -50,4 +50,14 @@ feature -- Output
buffer.append_character ('%N')
end
+note
+ copyright: "2011-2012, Eiffel Software and others"
+ license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
+ source: "[
+ Eiffel Software
+ 5949 Hollister Ave., Goleta, CA 93117 USA
+ Telephone 805-685-1006, Fax 805-685-6869
+ Website http://www.eiffel.com
+ Customer support http://support.eiffel.com
+ ]"
end
diff --git a/library/error/tests/test_error.e b/library/error/tests/test_error.e
new file mode 100644
index 00000000..af7fdec8
--- /dev/null
+++ b/library/error/tests/test_error.e
@@ -0,0 +1,182 @@
+note
+ description: "[
+ Eiffel tests that can be executed by testing tool.
+ ]"
+ author: "EiffelStudio test wizard"
+ date: "$Date$"
+ revision: "$Revision$"
+ testing: "type/manual"
+
+class
+ TEST_ERROR
+
+inherit
+ EQA_TEST_SET
+
+feature -- Test routines
+
+ test_error
+ note
+ testing: "error"
+ local
+ h: ERROR_HANDLER
+ cl: CELL [INTEGER]
+ do
+ create h.make
+ h.add_custom_error (123, "abc", "abc error occurred")
+ h.add_custom_error (456, "abc", "abc error occurred")
+ assert ("has 2 errors", h.count = 2)
+ h.reset
+ assert ("reset then no error", h.count = 0)
+
+ -- error_added_actions
+ create cl.put (0)
+ h.error_added_actions.extend (agent (i_e: ERROR; i_cl: CELL [INTEGER]) do i_cl.replace (i_cl.item + 1) end(?, cl))
+ h.add_custom_error (123, "abc", "abc error occurred")
+ h.add_custom_error (456, "abc", "abc error occurred")
+ assert ("has 2 errors, same as counted", h.count = 2 and h.count = cl.item)
+
+ end
+
+ test_sync_2
+ note
+ testing: "error"
+ local
+ h1, h2: ERROR_HANDLER
+-- cl: CELL [INTEGER]
+ do
+ create h1.make
+ create h2.make
+ h1.add_synchronization (h2)
+
+ h1.add_custom_error (123, "abc", "abc error occurred")
+ h1.add_custom_error (456, "abc", "abc error occurred")
+
+ assert ("has 2 errors", h1.count = 2 and h2.count = h1.count)
+
+ h1.reset
+ assert ("reset then no error", h1.count = 0 and h2.count = h1.count)
+
+ end
+
+ test_sync_3
+ note
+ testing: "error"
+ local
+ h1, h2, h3: ERROR_HANDLER
+-- cl: CELL [INTEGER]
+ do
+ create h1.make
+ create h2.make
+ create h3.make
+
+ h1.add_synchronization (h2)
+ h2.add_synchronization (h3)
+
+ h1.add_custom_error (123, "abc", "abc error occurred")
+ h1.add_custom_error (456, "abc", "abc error occurred")
+
+ assert ("has 2 errors", h1.count = 2 and h2.count = h1.count and h3.count = h2.count)
+
+ h1.reset
+ assert ("reset then no error", h1.count = 0 and h2.count = h1.count and h3.count = h2.count)
+
+ end
+
+ test_sync_3_with_cycle
+ note
+ testing: "error"
+ local
+ h1, h2, h3: ERROR_HANDLER
+-- cl: CELL [INTEGER]
+ do
+ create h1.make
+ create h2.make
+ create h3.make
+
+ h1.add_synchronization (h2)
+ h2.add_synchronization (h3)
+ h3.add_synchronization (h1)
+
+ h1.add_custom_error (123, "abc", "abc error occurred")
+ h1.add_custom_error (456, "abc", "abc error occurred")
+
+ assert ("has 2 errors", h1.count = 2 and h2.count = h1.count and h3.count = h2.count)
+
+ h1.reset
+ assert ("reset then no error", h1.count = 0 and h2.count = h1.count and h3.count = h2.count)
+
+ end
+
+ test_remove_sync
+ note
+ testing: "error"
+ local
+ h1, h2, h3: ERROR_HANDLER
+-- cl: CELL [INTEGER]
+ do
+ create h1.make
+ create h2.make
+ create h3.make
+
+ h1.add_synchronization (h2)
+ h2.add_synchronization (h3)
+ h3.add_synchronization (h1)
+
+ h1.add_custom_error (123, "abc", "abc error occurred")
+ h1.add_custom_error (456, "def", "def error occurred")
+
+ assert ("has 2 errors", h1.count = 2 and h2.count = h1.count and h3.count = h2.count)
+
+ h2.remove_synchronization (h3)
+ h2.remove_synchronization (h1)
+
+ h1.add_custom_error (789, "ghi", "ghi error occurred")
+ assert ("correct count of errors", h1.count = 3 and h2.count = 2 and h3.count = h1.count)
+
+ h1.reset
+ assert ("reset then no error", h1.count = 0 and h2.count = 2 and h3.count = h1.count)
+ end
+
+ test_destroy
+ note
+ testing: "error"
+ local
+ h1, h2, h3: ERROR_HANDLER
+-- cl: CELL [INTEGER]
+ do
+ create h1.make
+ create h2.make
+ create h3.make
+
+ h1.add_synchronization (h2)
+ h2.add_synchronization (h3)
+ h3.add_synchronization (h1)
+
+ h1.add_custom_error (123, "abc", "abc error occurred")
+ h1.add_custom_error (456, "def", "def error occurred")
+
+ assert ("has 2 errors", h1.count = 2 and h2.count = h1.count and h3.count = h2.count)
+
+ h2.destroy
+
+ h1.add_custom_error (789, "ghi", "ghi error occurred")
+ assert ("correct count of errors", h1.count = 3 and h2.count = 0 and h3.count = h1.count)
+
+ h1.reset
+ assert ("reset then no error", h1.count = 0 and h2.count = h1.count and h3.count = h1.count)
+ end
+
+note
+ copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
+ license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
+ source: "[
+ Eiffel Software
+ 5949 Hollister Ave., Goleta, CA 93117 USA
+ Telephone 805-685-1006, Fax 805-685-6869
+ Website http://www.eiffel.com
+ Customer support http://support.eiffel.com
+ ]"
+end
+
+
diff --git a/library/error/tests/tests-safe.ecf b/library/error/tests/tests-safe.ecf
new file mode 100644
index 00000000..46989ec4
--- /dev/null
+++ b/library/error/tests/tests-safe.ecf
@@ -0,0 +1,18 @@
+
+
+
+
+
+ /.git$
+ /EIFGENs$
+ /.svn$
+
+
+
+
+
+
+
+
diff --git a/library/server/ewsgi/specification/stream/wgi_chunked_input_stream.e b/library/server/ewsgi/specification/stream/wgi_chunked_input_stream.e
new file mode 100644
index 00000000..84c129cd
--- /dev/null
+++ b/library/server/ewsgi/specification/stream/wgi_chunked_input_stream.e
@@ -0,0 +1,21 @@
+note
+ description: "Summary description for {WGI_CHUNKED_INPUT_STREAM}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+deferred
+class
+ WGI_CHUNKED_INPUT_STREAM
+
+note
+ copyright: "2011-2012, Eiffel Software and others"
+ license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
+ source: "[
+ Eiffel Software
+ 5949 Hollister Ave., Goleta, CA 93117 USA
+ Telephone 805-685-1006, Fax 805-685-6869
+ Website http://www.eiffel.com
+ Customer support http://support.eiffel.com
+ ]"
+end
diff --git a/library/server/libfcgi/libfcgi.ecf b/library/server/libfcgi/libfcgi.ecf
index d69396be..f03336d3 100644
--- a/library/server/libfcgi/libfcgi.ecf
+++ b/library/server/libfcgi/libfcgi.ecf
@@ -25,7 +25,7 @@
-
+
diff --git a/library/server/wsf/src/response/wsf_page_response.e b/library/server/wsf/src/response/wsf_page_response.e
index 4806b74b..efd8cbe6 100644
--- a/library/server/wsf/src/response/wsf_page_response.e
+++ b/library/server/wsf/src/response/wsf_page_response.e
@@ -60,6 +60,8 @@ feature -- Element change
set_body (a_body: like body)
do
body := a_body
+ ensure
+ body_set: a_body /= Void implies body = a_body
end
put_string (a_string: READABLE_STRING_8)
diff --git a/library/text/encoder/encoder-safe.ecf b/library/text/encoder/encoder-safe.ecf
index bff977f0..7db8d66c 100644
--- a/library/text/encoder/encoder-safe.ecf
+++ b/library/text/encoder/encoder-safe.ecf
@@ -29,17 +29,4 @@
-
-
-
- /.git$
- /EIFGENs$
- /.svn$
-
-
-
-
-
diff --git a/library/text/encoder/encoder.ecf b/library/text/encoder/encoder.ecf
index 0905930b..5c3184fc 100644
--- a/library/text/encoder/encoder.ecf
+++ b/library/text/encoder/encoder.ecf
@@ -29,19 +29,4 @@
-
-
-
-
- /.git$
- /EIFGENs$
- /.svn$
-
-
-
-
-
-
diff --git a/library/text/encoder/src/html_encoder.e b/library/text/encoder/src/html_encoder.e
index efd76425..9bb0fc08 100644
--- a/library/text/encoder/src/html_encoder.e
+++ b/library/text/encoder/src/html_encoder.e
@@ -13,7 +13,7 @@ class
HTML_ENCODER
inherit
- ENCODER [STRING_32, STRING_8]
+ ENCODER [READABLE_STRING_32, READABLE_STRING_8]
PLATFORM
export
@@ -33,7 +33,7 @@ feature -- Status report
feature -- Encoder
- encoded_string (s: STRING_32): STRING_8
+ encoded_string (s: READABLE_STRING_32): STRING_8
-- HTML-encoded value of `s'.
local
i, n: INTEGER
@@ -67,7 +67,7 @@ feature -- Encoder
feature -- Decoder
- decoded_string (v: STRING_8): STRING_32
+ decoded_string (v: READABLE_STRING_8): STRING_32
-- The HTML-encoded equivalent of the given string
local
i, n: INTEGER
@@ -259,7 +259,7 @@ feature {NONE} -- Implementation: decoder
end
note
- copyright: "2011-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/text/encoder/src/json_encoder.e b/library/text/encoder/src/json_encoder.e
index 94075cbe..333c7e34 100644
--- a/library/text/encoder/src/json_encoder.e
+++ b/library/text/encoder/src/json_encoder.e
@@ -1,7 +1,7 @@
note
description: "[
Summary description for {JSON_ENCODER}.
-
+
]"
legal: "See notice at end of class."
status: "See notice at end of class."
@@ -12,7 +12,7 @@ class
JSON_ENCODER
inherit
- ENCODER [STRING_32, STRING_8]
+ ENCODER [READABLE_STRING_32, READABLE_STRING_8]
PLATFORM
export
@@ -32,7 +32,7 @@ feature -- Status report
feature -- Encoder
- encoded_string (s: STRING_32): STRING_8
+ encoded_string (s: READABLE_STRING_32): STRING_8
-- JSON-encoded value of `s'.
local
i, j, n: INTEGER
@@ -82,7 +82,7 @@ feature -- Encoder
feature -- Decoder
- decoded_string (v: STRING_8): STRING_32
+ decoded_string (v: READABLE_STRING_8): STRING_32
-- The JSON-encoded equivalent of the given string
local
i, n: INTEGER
diff --git a/library/text/encoder/src/url_encoder.e b/library/text/encoder/src/url_encoder.e
index 386b64da..9720150b 100644
--- a/library/text/encoder/src/url_encoder.e
+++ b/library/text/encoder/src/url_encoder.e
@@ -33,17 +33,15 @@ feature -- Status report
feature -- Encoder
- encoded_string (s: READABLE_STRING_32): READABLE_STRING_8
+ encoded_string (s: READABLE_STRING_32): STRING_8
-- URL-encoded value of `s'.
local
i, n: INTEGER
uc: CHARACTER_32
c: CHARACTER_8
- s8: STRING_8
do
has_error := False
- create s8.make (s.count + s.count // 10)
- Result := s8
+ create Result.make (s.count + s.count // 10)
n := s.count
from i := 1 until i > n loop
uc := s.item (i)
@@ -55,14 +53,14 @@ feature -- Encoder
'a' .. 'z', '0' .. '9',
'.', '-', '~', '_'
then
- s8.extend (c)
+ Result.extend (c)
when ' ' then
- s8.extend ('+')
+ Result.extend ('+')
else
- s8.append (url_encoded_char (uc))
+ Result.append (url_encoded_char (uc))
end
else
- s8.append (url_encoded_char (uc))
+ Result.append (url_encoded_char (uc))
end
i := i + 1
end
@@ -134,19 +132,17 @@ feature {NONE} -- encoder character
feature -- Decoder
- decoded_string (v: READABLE_STRING_8): READABLE_STRING_32
+ decoded_string (v: READABLE_STRING_8): STRING_32
-- The URL-encoded equivalent of the given string
local
i, n: INTEGER
c: CHARACTER
pr: CELL [INTEGER]
- s32: STRING_32
changed: BOOLEAN
do
has_error := False
n := v.count
- create s32.make (n)
- Result := s32
+ create Result.make (n)
from i := 1
until i > n
loop
@@ -154,19 +150,19 @@ feature -- Decoder
inspect c
when '+' then
changed := True
- s32.append_character ({CHARACTER_32}' ')
+ Result.append_character ({CHARACTER_32}' ')
when '%%' then
-- An escaped character ?
if i = n then
- s32.append_character (c.to_character_32)
+ Result.append_character (c.to_character_32)
else
changed := True
create pr.put (i)
- s32.append (url_decoded_char (v, pr))
+ Result.append (url_decoded_char (v, pr))
i := pr.item
end
else
- s32.append_character (c.to_character_32)
+ Result.append_character (c.to_character_32)
end
i := i + 1
end
@@ -367,7 +363,7 @@ feature {NONE} -- Hexadecimal and strings
end
note
- copyright: "2011-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/text/encoder/src/utf8_encoder.e b/library/text/encoder/src/utf8_encoder.e
index 451cb5e3..778ee000 100644
--- a/library/text/encoder/src/utf8_encoder.e
+++ b/library/text/encoder/src/utf8_encoder.e
@@ -13,7 +13,7 @@ class
UTF8_ENCODER
inherit
- ENCODER [STRING_32, STRING_8]
+ ENCODER [READABLE_STRING_32, READABLE_STRING_8]
UTF8_ENCODER_HELPER
@@ -35,7 +35,7 @@ feature -- Status report
feature -- Encoder
- encoded_string (s: STRING_32): STRING_8
+ encoded_string (s: READABLE_STRING_32): STRING_8
-- UTF8-encoded value of `s'.
do
Result := utf32_to_utf8 (s)
@@ -44,7 +44,7 @@ feature -- Encoder
feature -- Decoder
- decoded_string (v: STRING_8): STRING_32
+ decoded_string (v: READABLE_STRING_8): STRING_32
-- The UTF8-encoded equivalent of the given string
do
Result := utf8_to_utf32 (v)
@@ -52,7 +52,7 @@ feature -- Decoder
end
note
- copyright: "2011-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/text/encoder/src/utf8_url_encoder.e b/library/text/encoder/src/utf8_url_encoder.e
index 3648f111..8fca01d2 100644
--- a/library/text/encoder/src/utf8_url_encoder.e
+++ b/library/text/encoder/src/utf8_url_encoder.e
@@ -42,7 +42,7 @@ feature -- Access
feature -- Encoder
- encoded_string (s: READABLE_STRING_32): READABLE_STRING_8
+ encoded_string (s: READABLE_STRING_32): STRING_8
-- URL-encoded value of `s'.
do
Result := Precursor (s)
@@ -64,7 +64,7 @@ feature -- Encoder
feature -- Decoder
- decoded_string (v: READABLE_STRING_8): READABLE_STRING_32
+ decoded_string (v: READABLE_STRING_8): STRING_32
-- The URL-encoded equivalent of the given string
do
Result := Precursor (v)
@@ -77,7 +77,7 @@ feature -- Decoder
end
note
- copyright: "2011-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/text/encoder/src/xml_encoder.e b/library/text/encoder/src/xml_encoder.e
index 4fd33f94..8c8fd7a9 100644
--- a/library/text/encoder/src/xml_encoder.e
+++ b/library/text/encoder/src/xml_encoder.e
@@ -13,7 +13,7 @@ class
XML_ENCODER
inherit
- ENCODER [STRING_32, STRING_8]
+ ENCODER [READABLE_STRING_32, READABLE_STRING_8]
PLATFORM
export
@@ -33,7 +33,7 @@ feature -- Status report
feature -- Encoder
- encoded_string (s: STRING_32): STRING_8
+ encoded_string (s: READABLE_STRING_32): STRING_8
-- XML-encoded value of `s'.
local
i, n: INTEGER
@@ -67,7 +67,7 @@ feature -- Encoder
feature -- Decoder
- decoded_string (v: STRING_8): STRING_32
+ decoded_string (v: READABLE_STRING_8): STRING_32
-- The XML-encoded equivalent of the given string
local
i, n: INTEGER
@@ -259,7 +259,7 @@ feature {NONE} -- Implementation: decoder
end
note
- copyright: "2011-2011, Eiffel Software and others"
+ copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
diff --git a/library/text/encoder/tests/test_json_encoder.e b/library/text/encoder/tests/test_json_encoder.e
index df9e02f3..6c54c974 100644
--- a/library/text/encoder/tests/test_json_encoder.e
+++ b/library/text/encoder/tests/test_json_encoder.e
@@ -20,6 +20,7 @@ feature -- Test routines
testing: "json-encoded"
do
test_json_encoded_encoding ({STRING_32}"il était une fois %"Ni & Hao%" (ä½ å¥½) \a\b\c")
+ test_json_encoded_encoding ({STRING_32}" it's `abc’ ")
end
test_json_encoded_encoding (s: STRING_32)
diff --git a/library/text/encoder/tests/test_url_encoder.e b/library/text/encoder/tests/test_url_encoder.e
index e55fe18f..25cff7b7 100644
--- a/library/text/encoder/tests/test_url_encoder.e
+++ b/library/text/encoder/tests/test_url_encoder.e
@@ -19,10 +19,11 @@ feature -- Test routines
note
testing: "url-encoded"
do
- test_url_encoded_encoding ("http://domain.tld/foo/bar/script.php?test='toto'&foo=bar&title=il était une fois")
- test_url_encoded_encoding ("été")
- test_url_encoded_decoding ("%%E9t%%E9", "été")
- test_url_encoded_decoding ("%%C3%%A9t%%C3%%A9", "été")
+ test_url_encoded_encoding ({STRING_32}"http://domain.tld/foo/bar/script.php?test='toto'&foo=bar&title=il était une fois")
+ test_url_encoded_encoding ({STRING_32}"été")
+ test_url_encoded_decoding ({STRING_8}"%%E9t%%E9", {STRING_32}"été")
+
+ test_utf8_url_encoded_decoding ({STRING_8}"%%C3%%A9t%%C3%%A9", {STRING_32}"été")
end
test_url_encoded_encoding (s: STRING_32)
@@ -47,6 +48,16 @@ feature -- Test routines
assert ("decoded encoded string is same for %"" + s + "%"", u ~ e)
end
+ test_utf8_url_encoded_decoding (s: STRING_8; e: STRING_32)
+ local
+ u: STRING_32
+ b: UTF8_URL_ENCODER
+ do
+ create b
+ u := b.decoded_string (s)
+ assert ("decoded encoded string is same for %"" + s + "%"", u ~ e)
+ end
+
note
copyright: "2011-2011, Eiffel Software and others"
diff --git a/library/text/encoder/tests/test_utf8_encoder.e b/library/text/encoder/tests/test_utf8_encoder.e
index f87bdac1..e1f29c61 100644
--- a/library/text/encoder/tests/test_utf8_encoder.e
+++ b/library/text/encoder/tests/test_utf8_encoder.e
@@ -19,8 +19,7 @@ feature -- Test routines
note
testing: "url-encoded"
do
--- test_utf8_decoding ("summer=été&weird=à", "summer=été&weird=à")
- test_utf8_decoding ("%%C3%%A9t%%C3%%A9", "été")
+ test_utf8_decoding ("%%C3%%A9t%%C3%%A9", {STRING_32}"été")
end
test_utf8_decoding (s: STRING_8; e: STRING_32)
diff --git a/library/text/encoder/tests/tests-safe.ecf b/library/text/encoder/tests/tests-safe.ecf
new file mode 100644
index 00000000..be446169
--- /dev/null
+++ b/library/text/encoder/tests/tests-safe.ecf
@@ -0,0 +1,18 @@
+
+
+
+
+
+ /.git$
+ /EIFGENs$
+ /.svn$
+
+
+
+
+
+
+
+