diff --git a/library/protocol/uri_template/test_uri_template-draft_05.ecf b/library/protocol/uri_template/tests/tests-draft_05-safe.ecf
similarity index 100%
rename from library/protocol/uri_template/test_uri_template-draft_05.ecf
rename to library/protocol/uri_template/tests/tests-draft_05-safe.ecf
diff --git a/library/server/ewsgi/connectors/null/license.lic b/library/server/ewsgi/connectors/null/license.lic
new file mode 100644
index 00000000..cf2d1ed9
--- /dev/null
+++ b/library/server/ewsgi/connectors/null/license.lic
@@ -0,0 +1,10 @@
+${NOTE_KEYWORD}
+ copyright: "2011-${YEAR}, 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
+ ]"
diff --git a/library/server/ewsgi/connectors/null/null-safe.ecf b/library/server/ewsgi/connectors/null/null-safe.ecf
new file mode 100644
index 00000000..512dd955
--- /dev/null
+++ b/library/server/ewsgi/connectors/null/null-safe.ecf
@@ -0,0 +1,17 @@
+
+
" + l_trace + "") + end + end + end + end + rescue + rescued := True + retry + end + +note + copyright: "2011-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/server/ewsgi/connectors/null/src/wgi_null_input_stream.e b/library/server/ewsgi/connectors/null/src/wgi_null_input_stream.e new file mode 100644 index 00000000..75fdbd0c --- /dev/null +++ b/library/server/ewsgi/connectors/null/src/wgi_null_input_stream.e @@ -0,0 +1,44 @@ +note + description: "Summary description for WGI_NULL_INPUT_STREAM." + legal: "See notice at end of class." + status: "See notice at end of class." + date: "$Date$" + revision: "$Revision$" + +class + WGI_NULL_INPUT_STREAM + +inherit + WGI_INPUT_STREAM + undefine + read_to_string + end + + CONSOLE + rename + make as console_make, + read_stream as read_string, + end_of_file as end_of_input + end + +create + make + +feature {NONE} -- Initialization + + make + do + make_open_stdin ("stdin") + end + +note + copyright: "2011-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/server/ewsgi/connectors/null/src/wgi_null_output_stream.e b/library/server/ewsgi/connectors/null/src/wgi_null_output_stream.e new file mode 100644 index 00000000..7fea6a32 --- /dev/null +++ b/library/server/ewsgi/connectors/null/src/wgi_null_output_stream.e @@ -0,0 +1,80 @@ +note + description: "Summary description for WGI_NULL_OUTPUT_STREAM." + legal: "See notice at end of class." + status: "See notice at end of class." + date: "$Date$" + revision: "$Revision$" + +class + WGI_NULL_OUTPUT_STREAM + +inherit + WGI_OUTPUT_STREAM + rename + put_string as put_readable_string_8 + end + + CONSOLE + rename + make as console_make + end + + HTTP_STATUS_CODE_MESSAGES + export + {NONE} all + end + +create + make + +feature {NONE} -- Initialization + + make + do + make_open_stdout ("stdout") + end + +feature -- Status writing + + put_status_line (a_code: INTEGER) + -- Put status code line for `a_code' + --| Note this is a default implementation, and could be redefined + --| for instance in relation to NPH NULL script + local + s: STRING + do + if a_code /= 200 then + create s.make (16) + s.append ("Status:") + s.append_character (' ') + s.append_integer (a_code) + if attached http_status_code_message (a_code) as l_status_message then + s.append_character (' ') + s.append_string (l_status_message) + end + put_header_line (s) + end + end + + put_readable_string_8 (s: READABLE_STRING_8) + -- Write `s' at end of default output. + local + ext: C_STRING + do + if s.count > 0 then + create ext.make (s) + console_ps (file_pointer, ext.managed_data.item, s.count) + end + end + +note + copyright: "2011-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/server/wsf/src/wsf_request.e b/library/server/wsf/src/wsf_request.e index 52cd4a75..873c2575 100644 --- a/library/server/wsf/src/wsf_request.e +++ b/library/server/wsf/src/wsf_request.e @@ -1202,7 +1202,7 @@ feature -- URL Utility -- Url relative to script name if any, extended by `a_path' local l_base_url: like internal_url_base - i,m,n: INTEGER + i,m,n,spos: INTEGER l_rq_uri: like request_uri do l_base_url := internal_url_base @@ -1220,13 +1220,23 @@ feature -- URL Utility until i > m or i > n or l_rq_uri[i] /= l_script_name[i] loop + if l_rq_uri[i] = '/' then + spos := i + end i := i + 1 end if i > 1 then if l_rq_uri[i-1] = '/' then i := i -1 + elseif spos > 0 then + i := spos + end + spos := l_rq_uri.substring_index (path_info, i) + if spos > 0 then + l_base_url := l_rq_uri.substring (1, spos - 1) + else + l_base_url := l_rq_uri.substring (1, i - 1) end - l_base_url := l_rq_uri.substring (1, i - 1) end end end diff --git a/library/server/wsf/tests/src/test_wsf_request_script_url.e b/library/server/wsf/tests/src/test_wsf_request_script_url.e new file mode 100644 index 00000000..4b441cd2 --- /dev/null +++ b/library/server/wsf/tests/src/test_wsf_request_script_url.e @@ -0,0 +1,91 @@ +note + description: "[ + Eiffel tests that can be executed by testing tool. + ]" + author: "EiffelStudio test wizard" + date: "$Date$" + revision: "$Revision$" + testing: "type/manual" + +class + TEST_WSF_REQUEST_SCRIPT_URL + +inherit + EQA_TEST_SET + + WSF_SERVICE + undefine + default_create + end + +feature {NONE} -- Events + + port_number: INTEGER + base_url: detachable STRING + +feature -- Execution + + execute (req: WSF_REQUEST; res: WSF_RESPONSE) + do + --| do nothing + end + +feature -- Tests + + test_script_url + local + req: WSF_REQUEST + s: READABLE_STRING_8 + do + --| Case #1 + req := new_request (<< + ["REQUEST_METHOD", "GET"], + ["QUERY_STRING", ""], + ["REQUEST_URI", "/foo/bar/test/home"], + ["SCRIPT_NAME", "/foo/bar/app.ext"], + ["PATH_INFO", "/test/home"] + >> + ) + s := req.script_url ("/new/path/") + assert ("script_url (/new/path/) = %""+s+"%" but should be %"/foo/bar/new/path/%"", s.same_string ("/foo/bar/new/path/")) + + --| Case #2 + req := new_request (<< + ["REQUEST_METHOD", "GET"], + ["QUERY_STRING", ""], + ["REQUEST_URI", "/foo/bar/abc/DEF"], + ["SCRIPT_NAME", "/foo/bar/app.ext"], + ["PATH_INFO", "/abc/DEF"] + >> + ) + s := req.script_url ("/new/path/") + assert ("script_url (/new/path/) = %""+s+"%" but should be %"/foo/bar/new/path/%"", s.same_string ("/foo/bar/new/path/")) + + --| Case #3 + req := new_request (<< + ["REQUEST_METHOD", "GET"], + ["QUERY_STRING", ""], + ["REQUEST_URI", "/intranet/collab/cms/home"], + ["SCRIPT_NAME", "/intranet/collab/collab.ews"], + ["PATH_INFO", "/home"] + >> + ) + s := req.script_url ("/new/path/") + assert ("script_url (/new/path/) = %""+s+"%" but should be %"/intranet/collab/cms/new/path/%"", s.same_string ("/intranet/collab/cms/new/path/")) + + end + +feature {NONE} -- Implementation + + new_request (a_meta: ARRAY [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]]): WSF_REQUEST + local + wgi_req: WGI_REQUEST + req: WSF_REQUEST + do + create {WGI_REQUEST_NULL} wgi_req.make (Current, a_meta) + create Result.make_from_wgi (wgi_req) + end + +end + + diff --git a/library/server/wsf/tests/src/wgi_request_null.e b/library/server/wsf/tests/src/wgi_request_null.e new file mode 100644 index 00000000..3d007a65 --- /dev/null +++ b/library/server/wsf/tests/src/wgi_request_null.e @@ -0,0 +1,49 @@ +note + description: "Summary description for {WGI_REQUEST_NULL}." + author: "" + date: "$Date$" + revision: "$Revision$" + +class + WGI_REQUEST_NULL + +inherit + WGI_REQUEST_FROM_TABLE + rename + make as wgi_request_from_table_make + end + +create + make + +feature {NONE} -- Initialization + + make (s: WSF_SERVICE; a_meta: ARRAY [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]]) + local + ht: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8] + i: WGI_NULL_INPUT_STREAM + c: WGI_NULL_CONNECTOR + do + create c.make (s) + create i.make + create ht.make (a_meta.count) + across + a_meta as curs + loop + ht.force (curs.item.value, curs.item.name) + end + wgi_request_from_table_make (ht, i, c) + end + + +note + copyright: "2011-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/server/wsf/tests/tests.ecf b/library/server/wsf/tests/tests.ecf index 141cdf77..1e184b24 100644 --- a/library/server/wsf/tests/tests.ecf +++ b/library/server/wsf/tests/tests.ecf @@ -1,5 +1,5 @@ -