From 33eddd919717e1dd0095453834b2d50fdac85a39 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Wed, 21 Sep 2011 15:30:20 +0200 Subject: [PATCH] better assertion to ensure `base' is a valid base url --- .../server/ewsgi/connectors/nino/src/ewf_nino_connector.e | 8 +++++++- library/server/ewsgi/default/nino/nino_application.e | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/library/server/ewsgi/connectors/nino/src/ewf_nino_connector.e b/library/server/ewsgi/connectors/nino/src/ewf_nino_connector.e index 519a3a15..a5891067 100644 --- a/library/server/ewsgi/connectors/nino/src/ewf_nino_connector.e +++ b/library/server/ewsgi/connectors/nino/src/ewf_nino_connector.e @@ -20,9 +20,11 @@ create feature {NONE} -- Initialization make_with_base (a_app: like application; a_base: like base) + require + a_base_starts_with_slash: (a_base /= Void and then not a_base.is_empty) implies a_base.starts_with ("/") do make (a_app) - base := a_base + set_base (a_base) end feature {NONE} -- Initialization @@ -52,8 +54,12 @@ feature -- Access feature -- Element change set_base (b: like base) + require + b_starts_with_slash: (b /= Void and then not b.is_empty) implies b.starts_with ("/") do base := b + ensure + valid_base: (attached base as l_base and then not l_base.is_empty) implies l_base.starts_with ("/") end feature -- Server diff --git a/library/server/ewsgi/default/nino/nino_application.e b/library/server/ewsgi/default/nino/nino_application.e index 278fc990..1d18f11f 100644 --- a/library/server/ewsgi/default/nino/nino_application.e +++ b/library/server/ewsgi/default/nino/nino_application.e @@ -20,6 +20,8 @@ feature {NONE} -- Implementation make_custom (a_callback: like {WGI_AGENT_APPLICATION}.callback; a_base_url: detachable STRING) -- Initialize `Current'. + require + base_url_starts_with_slash: (a_base_url /= Void and then not a_base_url.is_empty) implies a_base_url.starts_with ("/") local app: WGI_AGENT_APPLICATION do