From 71b1bad53dbe9c249bc711b3ea02eb3b49a377ac Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Tue, 18 Dec 2012 23:25:54 +0100 Subject: [PATCH] Added basic support for "Expect" http header i.e: WSF_REQUEST.http_expect: detachable READABLE_STRING_8 Added WSF_REQUEST.request_time_stamp: INTEGER_64 --- .../specification/request/wgi_meta_names.e | 2 ++ .../ewsgi/specification/request/wgi_request.e | 6 +++++ .../implementation/wgi_request_from_table.e | 7 ++++++ library/server/wsf/src/wsf_request.e | 22 ++++++++++++++++++- 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/library/server/ewsgi/specification/request/wgi_meta_names.e b/library/server/ewsgi/specification/request/wgi_meta_names.e index 8fe13fa9..4b2f10b8 100644 --- a/library/server/ewsgi/specification/request/wgi_meta_names.e +++ b/library/server/ewsgi/specification/request/wgi_meta_names.e @@ -44,6 +44,8 @@ feature -- Access http_connection: STRING = "HTTP_CONNECTION" + http_expect: STRING = "HTTP_EXPECT" + http_referer: STRING = "HTTP_REFERER" http_transfer_encoding: STRING = "HTTP_TRANSFER_ENCODING" diff --git a/library/server/ewsgi/specification/request/wgi_request.e b/library/server/ewsgi/specification/request/wgi_request.e index d2b8cba9..1dccd709 100644 --- a/library/server/ewsgi/specification/request/wgi_request.e +++ b/library/server/ewsgi/specification/request/wgi_request.e @@ -559,6 +559,12 @@ feature -- HTTP_* deferred end + http_expect: detachable READABLE_STRING_8 + -- The Expect request-header field is used to indicate that particular server behaviors are required by the client. + -- Example: '100-continue'. + deferred + end + http_host: detachable READABLE_STRING_8 -- Contents of the Host: header from the current request, if there is one. deferred diff --git a/library/server/ewsgi/src/implementation/wgi_request_from_table.e b/library/server/ewsgi/src/implementation/wgi_request_from_table.e index 1545e2a1..2bfa00d6 100644 --- a/library/server/ewsgi/src/implementation/wgi_request_from_table.e +++ b/library/server/ewsgi/src/implementation/wgi_request_from_table.e @@ -196,6 +196,13 @@ feature -- Access: HTTP_* CGI meta parameters - 1.1 Result := meta_string_variable ({WGI_META_NAMES}.http_connection) end + http_expect: detachable READABLE_STRING_8 + -- The Expect request-header field is used to indicate that particular server behaviors are required by the client. + -- Example: '100-continue'. + do + Result := meta_string_variable ({WGI_META_NAMES}.http_expect) + end + http_host: detachable READABLE_STRING_8 -- Contents of the Host: header from the current request, if there is one. do diff --git a/library/server/wsf/src/wsf_request.e b/library/server/wsf/src/wsf_request.e index 5c5bf280..deb49a1f 100644 --- a/library/server/wsf/src/wsf_request.e +++ b/library/server/wsf/src/wsf_request.e @@ -911,6 +911,13 @@ feature -- HTTP_* Result := wgi_request.http_connection end + http_expect: detachable READABLE_STRING_8 + -- The Expect request-header field is used to indicate that particular server behaviors are required by the client. + -- Example: '100-continue'. + do + Result := wgi_request.http_expect + end + http_host: detachable READABLE_STRING_8 -- Contents of the Host: header from the current wgi_request, if there is one. do @@ -965,13 +972,26 @@ feature -- Extra CGI environment variables request_time: detachable DATE_TIME -- Request time (UTC) + local + i: like request_time_stamp + do + i := request_time_stamp + if i > 0 then + Result := date_time_utilities.unix_time_stamp_to_date_time (i) + end + end + + request_time_stamp: INTEGER_64 + -- Request time stamp (UTC) (unix time stamp) do if attached {WSF_STRING} meta_variable ({WSF_META_NAMES}.request_time) as t and then t.value.is_integer_64 then - Result := date_time_utilities.unix_time_stamp_to_date_time (t.value.to_integer_64) + Result := t.value.to_integer_64 end + ensure + Result = 0 implies meta_variable ({WSF_META_NAMES}.request_time) = Void end feature -- Cookies