Merge branch 'master' of https://github.com/EiffelWebFramework/EWF into ewf_ws_compression
This commit is contained in:
@@ -30,8 +30,8 @@ feature -- Basic operations
|
|||||||
response.set_status_code ({HTTP_STATUS_CODE}.ok)
|
response.set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||||
response.header.put_content_type_text_html
|
response.header.put_content_type_text_html
|
||||||
response.header.put_content_length (s.count)
|
response.header.put_content_length (s.count)
|
||||||
if attached request.http_connection as l_connection and then l_connection.is_case_insensitive_equal_general ("keep-alive") then
|
if request.is_keep_alive_http_connection then
|
||||||
response.header.put_header_key_value ("Connection", "keep-alive")
|
response.header.put_connection_keep_alive
|
||||||
end
|
end
|
||||||
response.put_string (s)
|
response.put_string (s)
|
||||||
end
|
end
|
||||||
|
|||||||
4
examples/simple_file/service.ini
Normal file
4
examples/simple_file/service.ini
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
port=9090
|
||||||
|
verbose=true
|
||||||
|
socket_recv_timeout=15
|
||||||
|
keep_alive_timeout=30
|
||||||
@@ -21,6 +21,7 @@ feature {NONE} -- Initialization
|
|||||||
do
|
do
|
||||||
Precursor
|
Precursor
|
||||||
set_service_option ("port", 9090)
|
set_service_option ("port", 9090)
|
||||||
|
import_service_options (create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI}.make_from_file ("service.ini"))
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ feature -- Basic operations
|
|||||||
response.set_status_code ({HTTP_STATUS_CODE}.ok)
|
response.set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||||
response.header.put_content_type_text_html
|
response.header.put_content_type_text_html
|
||||||
response.header.put_content_length (s.count)
|
response.header.put_content_length (s.count)
|
||||||
if attached request.http_connection as l_connection and then l_connection.is_case_insensitive_equal_general ("keep-alive") then
|
if request.is_keep_alive_http_connection then
|
||||||
response.header.put_header_key_value ("Connection", "keep-alive")
|
response.header.put_connection_keep_alive
|
||||||
end
|
end
|
||||||
response.put_string (s)
|
response.put_string (s)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ feature -- Basic operations
|
|||||||
response.set_status_code ({HTTP_STATUS_CODE}.ok)
|
response.set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||||
response.header.put_content_type_text_html
|
response.header.put_content_type_text_html
|
||||||
response.header.put_content_length (s.count)
|
response.header.put_content_length (s.count)
|
||||||
if attached request.http_connection as l_connection and then l_connection.is_case_insensitive_equal_general ("keep-alive") then
|
if request.is_keep_alive_http_connection then
|
||||||
response.header.put_header_key_value ("Connection", "keep-alive")
|
response.header.put_connection_keep_alive
|
||||||
end
|
end
|
||||||
response.put_string (s)
|
response.put_string (s)
|
||||||
end
|
end
|
||||||
@@ -96,9 +96,10 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
function connect(){
|
function connect(){
|
||||||
|
|
||||||
var host = "##WSSCHEME##://127.0.0.1:##PORTNUMBER##";
|
var host = "##WSSCHEME##://127.0.0.1:##PORTNUMBER##/app";
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
socket = new WebSocket(host);
|
socket = new WebSocket(host);
|
||||||
message('<p class="event">Socket Status: '+socket.readyState);
|
message('<p class="event">Socket Status: '+socket.readyState);
|
||||||
socket.onopen = function(){
|
socket.onopen = function(){
|
||||||
|
|||||||
@@ -508,9 +508,16 @@ feature -- Others
|
|||||||
|
|
||||||
put_expires (a_seconds: INTEGER)
|
put_expires (a_seconds: INTEGER)
|
||||||
-- Put "Expires" header to `a_seconds' seconds
|
-- Put "Expires" header to `a_seconds' seconds
|
||||||
|
-- and also "Cache-Control: max-age=.." .
|
||||||
|
-- To be supported by most browser.
|
||||||
|
local
|
||||||
|
dt: DATE_TIME
|
||||||
do
|
do
|
||||||
put_expires_string (a_seconds.out)
|
create dt.make_now_utc
|
||||||
end
|
dt.second_add (a_seconds)
|
||||||
|
put_expires_date (dt)
|
||||||
|
put_cache_control ("max-age=" + a_seconds.out)
|
||||||
|
end
|
||||||
|
|
||||||
put_expires_string (a_expires: STRING)
|
put_expires_string (a_expires: STRING)
|
||||||
-- Put "Expires" header with `a_expires' string value
|
-- Put "Expires" header with `a_expires' string value
|
||||||
@@ -544,6 +551,26 @@ feature -- Others
|
|||||||
put_pragma ("no-cache")
|
put_pragma ("no-cache")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Connection
|
||||||
|
|
||||||
|
put_connection (a_conn: READABLE_STRING_8)
|
||||||
|
-- Put "Connection" header with `a_conn' value.
|
||||||
|
do
|
||||||
|
put_header_key_value ({HTTP_HEADER_NAMES}.header_connection, a_conn)
|
||||||
|
end
|
||||||
|
|
||||||
|
put_connection_keep_alive
|
||||||
|
-- Put "Connection" header with "keep-alive".
|
||||||
|
do
|
||||||
|
put_connection ("keep-alive")
|
||||||
|
end
|
||||||
|
|
||||||
|
put_connection_close
|
||||||
|
-- Put "Connection" header with "close".
|
||||||
|
do
|
||||||
|
put_connection ("close")
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Redirection
|
feature -- Redirection
|
||||||
|
|
||||||
put_location (a_uri: READABLE_STRING_8)
|
put_location (a_uri: READABLE_STRING_8)
|
||||||
|
|||||||
@@ -131,6 +131,12 @@ feature -- Output operation
|
|||||||
wgi_response.put_substring (s, a_begin_index, a_end_index)
|
wgi_response.put_substring (s, a_begin_index, a_end_index)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
put_file_content (f: FILE; a_offset: INTEGER; a_count: INTEGER)
|
||||||
|
-- Send `a_count' bytes from the content of file `f' starting at offset `a_offset'.
|
||||||
|
do
|
||||||
|
wgi_response.put_file_content (f, a_offset, a_count)
|
||||||
|
end
|
||||||
|
|
||||||
flush
|
flush
|
||||||
-- Flush if it makes sense
|
-- Flush if it makes sense
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -142,6 +142,14 @@ feature -- Output operation
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
|
put_file_content (f: FILE; a_offset: INTEGER; a_count: INTEGER)
|
||||||
|
-- Send `a_count' bytes from the content of file `f' starting at offset `a_offset'.
|
||||||
|
require
|
||||||
|
message_writable: message_writable
|
||||||
|
not_too_big: a_offset + a_count <= f.count
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
flush
|
flush
|
||||||
-- Flush if it makes sense
|
-- Flush if it makes sense
|
||||||
deferred
|
deferred
|
||||||
|
|||||||
@@ -37,6 +37,53 @@ feature -- Output
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
put_file_content (a_file: FILE; a_offset: INTEGER; a_byte_count: INTEGER)
|
||||||
|
-- Send `a_byte_count' bytes from the content of file `a_file' starting at offset `a_offset'.
|
||||||
|
--| Could be redefined for optimization.
|
||||||
|
require
|
||||||
|
a_file_closed_or_openread: a_file.exists and then (a_file.is_access_readable or a_file.is_closed)
|
||||||
|
is_open_write: is_open_write
|
||||||
|
a_file_not_void: a_file /= Void
|
||||||
|
local
|
||||||
|
l_close_needed: BOOLEAN
|
||||||
|
l_remain: INTEGER
|
||||||
|
l_done: BOOLEAN
|
||||||
|
s: STRING
|
||||||
|
do
|
||||||
|
if a_file.exists and then a_file.is_access_readable then
|
||||||
|
if a_file.is_open_read then
|
||||||
|
l_close_needed := False
|
||||||
|
else
|
||||||
|
l_close_needed := True
|
||||||
|
a_file.open_read
|
||||||
|
end
|
||||||
|
if a_offset > 0 then
|
||||||
|
a_file.move (a_offset)
|
||||||
|
end
|
||||||
|
from
|
||||||
|
l_remain := a_byte_count
|
||||||
|
l_done := False
|
||||||
|
until
|
||||||
|
a_file.exhausted or l_done
|
||||||
|
loop
|
||||||
|
a_file.read_stream (l_remain.min (4_096))
|
||||||
|
s := a_file.last_string
|
||||||
|
if s.is_empty then
|
||||||
|
-- network error?
|
||||||
|
l_done := True
|
||||||
|
else
|
||||||
|
put_string (s)
|
||||||
|
l_remain := l_remain - s.count
|
||||||
|
check l_remain >= 0 end
|
||||||
|
l_done := l_remain = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if l_close_needed then
|
||||||
|
a_file.close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
put_character (c: CHARACTER_8)
|
put_character (c: CHARACTER_8)
|
||||||
-- Write `c' to output stream.
|
-- Write `c' to output stream.
|
||||||
--| Could be redefined for optimization
|
--| Could be redefined for optimization
|
||||||
|
|||||||
@@ -103,6 +103,12 @@ feature -- Output operation
|
|||||||
output.put_substring (s, start_index, end_index)
|
output.put_substring (s, start_index, end_index)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
put_file_content (f: FILE; a_offset: INTEGER; a_count: INTEGER)
|
||||||
|
-- Send `a_count' bytes from the content of file `f' starting at offset `a_offset'.
|
||||||
|
do
|
||||||
|
output.put_file_content (f, a_offset, a_count)
|
||||||
|
end
|
||||||
|
|
||||||
flush
|
flush
|
||||||
do
|
do
|
||||||
output.flush
|
output.flush
|
||||||
|
|||||||
@@ -455,14 +455,11 @@ feature -- Parsing
|
|||||||
-- Except for HTTP/1.0, persistent connection is the default.
|
-- Except for HTTP/1.0, persistent connection is the default.
|
||||||
is_persistent_connection_requested := True
|
is_persistent_connection_requested := True
|
||||||
if is_http_version_1_0 then
|
if is_http_version_1_0 then
|
||||||
is_persistent_connection_requested := attached request_header_map.item ("Connection") as l_connection and then
|
is_persistent_connection_requested := has_keep_alive_http_connection_header (request_header_map)
|
||||||
l_connection.is_case_insensitive_equal_general ("keep-alive")
|
|
||||||
else
|
else
|
||||||
-- By default HTTP:1/1 support persistent connection.
|
-- By default HTTP:1/1 support persistent connection.
|
||||||
if attached request_header_map.item ("Connection") as l_connection then
|
if has_close_http_connection_header (request_header_map) then
|
||||||
if l_connection.is_case_insensitive_equal_general ("close") then
|
is_persistent_connection_requested := False
|
||||||
is_persistent_connection_requested := False
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
is_persistent_connection_requested := True
|
is_persistent_connection_requested := True
|
||||||
end
|
end
|
||||||
@@ -476,6 +473,46 @@ feature -- Parsing
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
has_keep_alive_http_connection_header (h_map: like request_header_map): BOOLEAN
|
||||||
|
-- Does Current request header map `h_map' have "keep-alive" connection header?
|
||||||
|
local
|
||||||
|
i: INTEGER
|
||||||
|
do
|
||||||
|
if attached h_map.item ("Connection") as l_connection then
|
||||||
|
-- Could be for instance "keep-alive, Upgrade"
|
||||||
|
i := l_connection.substring_index ("keep-alive", 1)
|
||||||
|
if i > 0 then
|
||||||
|
i := i + 9 -- "keep-alive" has 10 characters
|
||||||
|
check i <= l_connection.count end
|
||||||
|
if i = l_connection.count then
|
||||||
|
Result := True
|
||||||
|
else
|
||||||
|
Result := l_connection [i + 1] = ',' or l_connection [i + 1].is_space
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
has_close_http_connection_header (h_map: like request_header_map): BOOLEAN
|
||||||
|
-- Does Current request header map `h_map' have "close" connection header?
|
||||||
|
local
|
||||||
|
i: INTEGER
|
||||||
|
do
|
||||||
|
if attached h_map.item ("Connection") as l_connection then
|
||||||
|
-- Could be for instance "close, ..."
|
||||||
|
i := l_connection.substring_index ("close", 1)
|
||||||
|
if i > 0 then
|
||||||
|
i := i + 4 -- "close" has 5 characters
|
||||||
|
check i <= l_connection.count end
|
||||||
|
if i = l_connection.count then
|
||||||
|
Result := True
|
||||||
|
else
|
||||||
|
Result := l_connection [i + 1] = ',' or l_connection [i + 1].is_space
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
analyze_request_line (line: STRING)
|
analyze_request_line (line: STRING)
|
||||||
-- Analyze `line' as a HTTP request line.
|
-- Analyze `line' as a HTTP request line.
|
||||||
-- note: may update `has_error'.
|
-- note: may update `has_error'.
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
note
|
note
|
||||||
description: "Objects than can pre-process incoming data and post-process outgoing data."
|
description: "Objects than can pre-process incoming data and post-process outgoing data."
|
||||||
author: "Olivier Ligot"
|
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
@@ -9,9 +8,23 @@ deferred class
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
next: detachable WSF_FILTER
|
next: detachable WSF_FILTER assign set_next
|
||||||
-- Next filter
|
-- Next filter
|
||||||
|
|
||||||
|
last: WSF_FILTER
|
||||||
|
-- Last filter in the chain following `next'.
|
||||||
|
do
|
||||||
|
from
|
||||||
|
Result := Current
|
||||||
|
until
|
||||||
|
not attached Result.next as l_next
|
||||||
|
loop
|
||||||
|
Result := l_next
|
||||||
|
end
|
||||||
|
ensure
|
||||||
|
is_closing: Result /= Void and then Result.next = Void
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
set_next (a_next: like next)
|
set_next (a_next: like next)
|
||||||
@@ -22,6 +35,24 @@ feature -- Element change
|
|||||||
next_set: next = a_next
|
next_set: next = a_next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
append (a_filter: attached like next)
|
||||||
|
-- Append `a_filter' to the `last' filter.
|
||||||
|
do
|
||||||
|
last.set_next (a_filter)
|
||||||
|
end
|
||||||
|
|
||||||
|
insert_after (a_filter: attached like next)
|
||||||
|
-- Append `a_filter' to the `last' filter.
|
||||||
|
local
|
||||||
|
f: like next
|
||||||
|
do
|
||||||
|
f := next
|
||||||
|
set_next (a_filter)
|
||||||
|
if f /= Void then
|
||||||
|
a_filter.append (f)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Basic operations
|
feature -- Basic operations
|
||||||
|
|
||||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
|
|||||||
@@ -29,22 +29,19 @@ feature {NONE} -- Initialization
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
|
append_filter (a_filter: WSF_FILTER)
|
||||||
|
-- Append `a_filter' to the end of the `filter' chain.
|
||||||
|
do
|
||||||
|
filter.append (a_filter)
|
||||||
|
end
|
||||||
|
|
||||||
append_filters (a_filters: ITERABLE [WSF_FILTER])
|
append_filters (a_filters: ITERABLE [WSF_FILTER])
|
||||||
-- Append collection `a_filters' of filters to the end of the `filter' chain.
|
-- Append collection `a_filters' of filters to the end of the `filter' chain.
|
||||||
local
|
local
|
||||||
f: like filter
|
f: like filter
|
||||||
l_next_filter: detachable like filter
|
l_next_filter: detachable like filter
|
||||||
do
|
do
|
||||||
from
|
f := filter.last
|
||||||
f := filter
|
|
||||||
l_next_filter := f.next
|
|
||||||
until
|
|
||||||
l_next_filter = Void
|
|
||||||
loop
|
|
||||||
f := l_next_filter
|
|
||||||
l_next_filter := f.next
|
|
||||||
end
|
|
||||||
check f_attached_without_next: f /= Void and then f.next = Void end
|
|
||||||
across
|
across
|
||||||
a_filters as ic
|
a_filters as ic
|
||||||
loop
|
loop
|
||||||
@@ -59,5 +56,4 @@ feature -- Access
|
|||||||
filter: WSF_FILTER
|
filter: WSF_FILTER
|
||||||
-- Filter
|
-- Filter
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
make_with_path (d: like document_root)
|
make_with_path (d: like document_root)
|
||||||
do
|
do
|
||||||
|
max_age := -1
|
||||||
if d.is_empty then
|
if d.is_empty then
|
||||||
document_root := execution_environment.current_working_path
|
document_root := execution_environment.current_working_path
|
||||||
else
|
else
|
||||||
@@ -87,6 +88,7 @@ feature -- Access
|
|||||||
document_root: PATH
|
document_root: PATH
|
||||||
|
|
||||||
max_age: INTEGER
|
max_age: INTEGER
|
||||||
|
-- Max age, initialized at -1 by default.
|
||||||
|
|
||||||
index_disabled: BOOLEAN
|
index_disabled: BOOLEAN
|
||||||
-- Index disabled?
|
-- Index disabled?
|
||||||
@@ -367,15 +369,17 @@ feature -- Execution
|
|||||||
create fres.make_with_content_type (ct, f.path.name)
|
create fres.make_with_content_type (ct, f.path.name)
|
||||||
fres.set_status_code ({HTTP_STATUS_CODE}.ok)
|
fres.set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||||
|
|
||||||
-- cache control
|
-- cache control
|
||||||
create dt.make_now_utc
|
create dt.make_now_utc
|
||||||
fres.header.put_cache_control ("private, max-age=" + max_age.out)
|
|
||||||
fres.header.put_utc_date (dt)
|
fres.header.put_utc_date (dt)
|
||||||
if max_age > 0 then
|
if max_age >= 0 then
|
||||||
dt := dt.twin
|
fres.set_max_age (max_age)
|
||||||
dt.second_add (max_age)
|
if max_age > 0 then
|
||||||
|
dt := dt.twin
|
||||||
|
dt.second_add (max_age)
|
||||||
|
end
|
||||||
|
fres.set_expires_date (dt)
|
||||||
end
|
end
|
||||||
fres.header.put_expires_date (dt)
|
|
||||||
|
|
||||||
fres.set_answer_head_request_method (req.request_method.same_string ({HTTP_REQUEST_METHODS}.method_head))
|
fres.set_answer_head_request_method (req.request_method.same_string ({HTTP_REQUEST_METHODS}.method_head))
|
||||||
res.send (fres)
|
res.send (fres)
|
||||||
@@ -388,14 +392,15 @@ feature -- Execution
|
|||||||
do
|
do
|
||||||
create dt.make_now_utc
|
create dt.make_now_utc
|
||||||
create h.make
|
create h.make
|
||||||
h.put_cache_control ("private, max-age=" + max_age.out)
|
|
||||||
h.put_utc_date (dt)
|
h.put_utc_date (dt)
|
||||||
if max_age > 0 then
|
if max_age >= 0 then
|
||||||
dt := dt.twin
|
h.put_cache_control ("max-age=" + max_age.out)
|
||||||
dt.second_add (max_age)
|
if max_age > 0 then
|
||||||
|
dt := dt.twin
|
||||||
|
dt.second_add (max_age)
|
||||||
|
end
|
||||||
|
h.put_expires_date (dt)
|
||||||
end
|
end
|
||||||
h.put_expires_date (dt)
|
|
||||||
|
|
||||||
if a_utc_date /= Void then
|
if a_utc_date /= Void then
|
||||||
h.put_last_modified (a_utc_date)
|
h.put_last_modified (a_utc_date)
|
||||||
end
|
end
|
||||||
@@ -637,7 +642,7 @@ feature {NONE} -- implementation: date time
|
|||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ inherit
|
|||||||
put_character,
|
put_character,
|
||||||
put_string,
|
put_string,
|
||||||
put_substring,
|
put_substring,
|
||||||
|
put_file_content,
|
||||||
flush,
|
flush,
|
||||||
message_writable,
|
message_writable,
|
||||||
message_committed
|
message_committed
|
||||||
@@ -108,6 +109,13 @@ feature -- Output operation
|
|||||||
Precursor (s, a_begin_index, a_end_index)
|
Precursor (s, a_begin_index, a_end_index)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
put_file_content (f: FILE; a_offset: INTEGER; a_count: INTEGER)
|
||||||
|
-- Send `a_count' bytes from the content of file `f' starting at offset `a_offset'.
|
||||||
|
do
|
||||||
|
process_header
|
||||||
|
Precursor (f, a_offset, a_count)
|
||||||
|
end
|
||||||
|
|
||||||
flush
|
flush
|
||||||
-- Flush if it makes sense
|
-- Flush if it makes sense
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
note
|
note
|
||||||
description : "Objects that ..."
|
description: "Response to send a file back to the client"
|
||||||
author : "$Author$"
|
date: "$Date$"
|
||||||
date : "$Date$"
|
revision: "$Revision$"
|
||||||
revision : "$Revision$"
|
|
||||||
|
|
||||||
class
|
class
|
||||||
WSF_FILE_RESPONSE
|
WSF_FILE_RESPONSE
|
||||||
@@ -105,22 +104,46 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
set_expires_in_seconds (sec: INTEGER)
|
set_max_age (sec: INTEGER)
|
||||||
do
|
do
|
||||||
set_expires (sec.out)
|
header.put_cache_control ("max-age=" + sec.out)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_public_max_age (sec: INTEGER)
|
||||||
|
do
|
||||||
|
header.put_cache_control ("public, max-age=" + sec.out)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_private_max_age (sec: INTEGER)
|
||||||
|
do
|
||||||
|
header.put_cache_control ("private, max-age=" + sec.out)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_expires_in_seconds (sec: INTEGER)
|
||||||
|
-- Set Expires and Cache-control: max-age... to value related `sec' seconds.
|
||||||
|
do
|
||||||
|
header.put_expires (sec)
|
||||||
end
|
end
|
||||||
|
|
||||||
set_expires (s: STRING)
|
set_expires (s: STRING)
|
||||||
|
-- Set Expires header value to `s'.
|
||||||
do
|
do
|
||||||
header.put_expires_string (s)
|
header.put_expires_string (s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
set_expires_date (dt: DATE_TIME)
|
||||||
|
-- Set Expires header value to date time `dt'.
|
||||||
|
do
|
||||||
|
header.put_expires_date (dt)
|
||||||
|
end
|
||||||
|
|
||||||
set_no_cache
|
set_no_cache
|
||||||
local
|
local
|
||||||
h: like header
|
h: like header
|
||||||
do
|
do
|
||||||
h := header
|
h := header
|
||||||
h.put_expires (0)
|
h.put_expires (0)
|
||||||
|
h.put_cache_control ("max-age=0")
|
||||||
h.put_cache_control ("no-cache, must-revalidate")
|
h.put_cache_control ("no-cache, must-revalidate")
|
||||||
h.put_pragma_no_cache
|
h.put_pragma_no_cache
|
||||||
end
|
end
|
||||||
@@ -250,7 +273,7 @@ feature {NONE} -- Implementation: file system helper
|
|||||||
f: RAW_FILE
|
f: RAW_FILE
|
||||||
do
|
do
|
||||||
create f.make_with_path (file_path)
|
create f.make_with_path (file_path)
|
||||||
create Result.make_from_epoch (f.change_date)
|
create Result.make_from_epoch (f.date)
|
||||||
end
|
end
|
||||||
|
|
||||||
file_extension (fn: PATH): STRING_32
|
file_extension (fn: PATH): STRING_32
|
||||||
@@ -293,19 +316,11 @@ feature {NONE} -- Implementation: output
|
|||||||
create f.make_with_path (fn)
|
create f.make_with_path (fn)
|
||||||
check f.is_readable end
|
check f.is_readable end
|
||||||
|
|
||||||
f.open_read
|
res.put_file_content (f, 0, f.count)
|
||||||
from
|
|
||||||
until
|
|
||||||
f.exhausted
|
|
||||||
loop
|
|
||||||
f.read_stream (4_096)
|
|
||||||
res.put_string (f.last_string)
|
|
||||||
end
|
|
||||||
f.close
|
|
||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -1200,11 +1200,19 @@ feature -- HTTP_*
|
|||||||
|
|
||||||
http_connection: detachable READABLE_STRING_8
|
http_connection: detachable READABLE_STRING_8
|
||||||
-- Contents of the Connection: header from the current wgi_request, if there is one.
|
-- Contents of the Connection: header from the current wgi_request, if there is one.
|
||||||
-- Example: 'Keep-Alive'.
|
-- Example: 'keep-alive'.
|
||||||
do
|
do
|
||||||
Result := wgi_request.http_connection
|
Result := wgi_request.http_connection
|
||||||
end
|
end
|
||||||
|
|
||||||
|
is_keep_alive_http_connection: BOOLEAN
|
||||||
|
-- Is a keep-alive connection?
|
||||||
|
do
|
||||||
|
if attached http_connection as conn then
|
||||||
|
Result := conn.starts_with ("keep-alive")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
http_expect: detachable READABLE_STRING_8
|
http_expect: detachable READABLE_STRING_8
|
||||||
-- The Expect request-header field is used to indicate that particular server behaviors are required by the client.
|
-- The Expect request-header field is used to indicate that particular server behaviors are required by the client.
|
||||||
-- Example: '100-continue'.
|
-- Example: '100-continue'.
|
||||||
|
|||||||
@@ -383,6 +383,16 @@ feature -- Body
|
|||||||
increment_transfered_content_length (a_end_index - a_begin_index + 1)
|
increment_transfered_content_length (a_end_index - a_begin_index + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
put_file_content (f: FILE; a_offset: INTEGER; a_count: INTEGER)
|
||||||
|
-- Send `a_count' bytes from the content of file `f' starting at offset `a_offset'.
|
||||||
|
require
|
||||||
|
message_writable: message_writable
|
||||||
|
not_too_big: a_offset + a_count <= f.count
|
||||||
|
do
|
||||||
|
wgi_response.put_file_content (f, a_offset, a_count)
|
||||||
|
increment_transfered_content_length (a_count)
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Chunk body
|
feature -- Chunk body
|
||||||
|
|
||||||
put_chunk (a_content: READABLE_STRING_8; a_ext: detachable READABLE_STRING_8)
|
put_chunk (a_content: READABLE_STRING_8; a_ext: detachable READABLE_STRING_8)
|
||||||
@@ -572,7 +582,7 @@ feature {NONE} -- Implemenation
|
|||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -108,6 +108,49 @@ feature -- Output operation
|
|||||||
output.append_substring (s, start_index, end_index)
|
output.append_substring (s, start_index, end_index)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
put_file_content (a_file: FILE; a_offset: INTEGER; a_byte_count: INTEGER)
|
||||||
|
-- Send `a_byte_count' bytes from the content of file `a_file' starting at offset `a_offset'.
|
||||||
|
--| Could be redefined for optimization.
|
||||||
|
local
|
||||||
|
l_close_needed: BOOLEAN
|
||||||
|
l_remain: INTEGER
|
||||||
|
l_done: BOOLEAN
|
||||||
|
s: STRING
|
||||||
|
do
|
||||||
|
if a_file.exists and then a_file.is_access_readable then
|
||||||
|
if a_file.is_open_read then
|
||||||
|
l_close_needed := False
|
||||||
|
else
|
||||||
|
l_close_needed := True
|
||||||
|
a_file.open_read
|
||||||
|
end
|
||||||
|
if a_offset > 0 then
|
||||||
|
a_file.move (a_offset)
|
||||||
|
end
|
||||||
|
from
|
||||||
|
l_remain := a_byte_count
|
||||||
|
l_done := False
|
||||||
|
until
|
||||||
|
a_file.exhausted or l_done
|
||||||
|
loop
|
||||||
|
a_file.read_stream (l_remain.min (4_096))
|
||||||
|
s := a_file.last_string
|
||||||
|
if s.is_empty then
|
||||||
|
-- network error?
|
||||||
|
l_done := True
|
||||||
|
else
|
||||||
|
put_string (s)
|
||||||
|
l_remain := l_remain - s.count
|
||||||
|
check l_remain >= 0 end
|
||||||
|
l_done := l_remain = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if l_close_needed then
|
||||||
|
a_file.close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
flush
|
flush
|
||||||
do
|
do
|
||||||
output.wipe_out
|
output.wipe_out
|
||||||
|
|||||||
@@ -291,11 +291,8 @@ feature {NONE} -- Implementation
|
|||||||
response.set_status_code (a_status_code)
|
response.set_status_code (a_status_code)
|
||||||
response.header.put_content_type_text_html
|
response.header.put_content_type_text_html
|
||||||
response.header.put_content_length (s.count)
|
response.header.put_content_length (s.count)
|
||||||
if
|
if request.is_keep_alive_http_connection then
|
||||||
attached request.http_connection as l_connection and then
|
response.header.put_connection_keep_alive
|
||||||
l_connection.is_case_insensitive_equal_general ("keep-alive")
|
|
||||||
then
|
|
||||||
response.header.put_header_key_value ("Connection", "keep-alive")
|
|
||||||
end
|
end
|
||||||
response.put_string (s)
|
response.put_string (s)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,10 +15,10 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="{$WIZ.project.name/}_any" extends="common">
|
<target name="{$WIZ.project.name/}_any" extends="common">
|
||||||
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
|
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
|
||||||
|
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>{/if}
|
||||||
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/>{/if}
|
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/>{/if}
|
||||||
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi-safe.ecf"/>{/if}
|
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi-safe.ecf"/>{/if}
|
||||||
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>{/if}
|
<cluster name="launcher" location=".\launcher\">
|
||||||
<cluster name="launcher" location=".\launcher\" recursive="true">
|
|
||||||
<cluster name="any_launcher" location="$|any"/>
|
<cluster name="any_launcher" location="$|any"/>
|
||||||
</cluster>
|
</cluster>
|
||||||
<cluster name="src" location=".\src\" recursive="true"/>
|
<cluster name="src" location=".\src\" recursive="true"/>
|
||||||
|
|||||||
@@ -20,28 +20,27 @@ feature -- Execution
|
|||||||
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||||
-- Launch Web Server Application using optionals `opts'.
|
-- Launch Web Server Application using optionals `opts'.
|
||||||
local
|
local
|
||||||
launcher: WSF_SERVICE_LAUNCHER
|
launcher: WSF_SERVICE_LAUNCHER [G]
|
||||||
do
|
do
|
||||||
l_id := launcher_id
|
|
||||||
if not attached launcher_id as l_id then
|
if not attached launcher_id as l_id then
|
||||||
{unless condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
|
{unless condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
|
||||||
io.error.put_string ("Application launcher not found!%N")
|
io.error.put_string ("Application launcher not found!%N")
|
||||||
(create {EXCEPTIONS}).die (-1){/literal}{/unless}
|
(create {EXCEPTIONS}).die (-1){/literal}{/unless}
|
||||||
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
|
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
|
||||||
-- Choose a default -> standalone
|
-- Choose a default -> standalone
|
||||||
create {WSF_STANDALONE_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
|
create {WSF_STANDALONE_SERVICE_LAUNCHER [G]} launcher.make_and_launch (opts){/literal}{/if}
|
||||||
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
|
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
|
||||||
elseif is_standalone_launcher_id (l_id) then
|
elseif is_standalone_launcher_id (l_id) then
|
||||||
create {WSF_STANDALONE_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
|
create {WSF_STANDALONE_SERVICE_LAUNCHER [G]} launcher.make_and_launch (opts){/literal}{/if}
|
||||||
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}{literal}
|
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}{literal}
|
||||||
elseif is_libfcgi_launcher_id (l_id) then
|
elseif is_libfcgi_launcher_id (l_id) then
|
||||||
create {WSF_LIBFCGI_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
|
create {WSF_LIBFCGI_SERVICE_LAUNCHER [G]} launcher.make_and_launch (opts){/literal}{/if}
|
||||||
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}{literal}
|
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}{literal}
|
||||||
elseif is_cgi_launcher_id (l_id) then
|
elseif is_cgi_launcher_id (l_id) then
|
||||||
create {WSF_CGI_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
|
create {WSF_CGI_SERVICE_LAUNCHER [G]} launcher.make_and_launch (opts){/literal}{/if}
|
||||||
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
|
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
|
||||||
elseif is_standalone_launcher_id (l_id) then
|
elseif is_standalone_launcher_id (l_id) then
|
||||||
create {WSF_STANDALONE_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
|
create {WSF_STANDALONE_SERVICE_LAUNCHER [G]} launcher.make_and_launch (opts){/literal}{/if}
|
||||||
{literal}
|
{literal}
|
||||||
else
|
else
|
||||||
io.error.put_string ("Application launcher not found!%N")
|
io.error.put_string ("Application launcher not found!%N")
|
||||||
@@ -53,31 +52,39 @@ feature -- Execution
|
|||||||
-- Launcher id based on the executable extension name if any.
|
-- Launcher id based on the executable extension name if any.
|
||||||
-- This can be redefine to customize for your application.
|
-- This can be redefine to customize for your application.
|
||||||
--| ex: standalone, cgi, libfcgi or Void.
|
--| ex: standalone, cgi, libfcgi or Void.
|
||||||
|
local
|
||||||
|
p: PATH
|
||||||
|
s: READABLE_STRING_32
|
||||||
do
|
do
|
||||||
if attached (create {PATH}.make_from_string (execution_environment.arguments.command_name)).extension as ext then
|
create p.make_from_string (execution_environment.arguments.command_name)
|
||||||
Result := ext
|
if attached p.extension as ext then
|
||||||
|
if ext.is_case_insensitive_equal_general ("exe") then
|
||||||
|
-- Windows
|
||||||
|
s := p.name
|
||||||
|
create p.make_from_string (s.head (s.count - 4))
|
||||||
|
Result := p.extension
|
||||||
|
else
|
||||||
|
Result := ext
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Status report
|
feature -- Status report{/literal}
|
||||||
{/literal}
|
|
||||||
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}
|
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}
|
||||||
is_standalone_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
|
is_standalone_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
|
||||||
do
|
do
|
||||||
Result := a_id.is_case_insensitive ("standalone")
|
Result := a_id.is_case_insensitive_equal ("standalone")
|
||||||
end{/if}
|
end{/if}
|
||||||
|
|
||||||
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}
|
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}
|
||||||
is_cgi_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
|
is_cgi_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
|
||||||
do
|
do
|
||||||
Result := a_id.is_case_insensitive ("cgi")
|
Result := a_id.is_case_insensitive_equal ("cgi")
|
||||||
end{/if}
|
end{/if}
|
||||||
|
|
||||||
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}
|
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}
|
||||||
is_libfcgi_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
|
is_libfcgi_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
|
||||||
do
|
do
|
||||||
Result := a_id.is_case_insensitive ("libfcgi")
|
Result := a_id.is_case_insensitive_equal ("libfcgi")
|
||||||
or a_id.is_case_insensitive ("fcgi")
|
or a_id.is_case_insensitive_equal ("fcgi")
|
||||||
end{/if}
|
end{/if}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,10 +14,8 @@ inherit
|
|||||||
redefine
|
redefine
|
||||||
initialize
|
initialize
|
||||||
end
|
end
|
||||||
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}
|
|
||||||
WSF_ROUTED_SERVICE{/if}
|
|
||||||
{if isset="$APP_ROOT"}APPLICATION_LAUNCHER [{$APP_ROOT/}_EXECUTION]{/if}
|
{if isset="$APP_ROOT"}APPLICATION_LAUNCHER [{$APP_ROOT/}_EXECUTION]{/if}
|
||||||
{unless isset="$APP_ROOT"}APPLICATION_LAUNCHER [APPLICATION_EXECUTION]{/if}
|
{unless isset="$APP_ROOT"}APPLICATION_LAUNCHER [APPLICATION_EXECUTION]{/unless}
|
||||||
|
|
||||||
{literal}create
|
{literal}create
|
||||||
make_and_launch
|
make_and_launch
|
||||||
@@ -29,6 +27,7 @@ feature {NONE} -- Initialization
|
|||||||
do
|
do
|
||||||
Precursor
|
Precursor
|
||||||
set_service_option ("port", {$WIZ.standalone_connector.port/})
|
set_service_option ("port", {$WIZ.standalone_connector.port/})
|
||||||
|
set_service_option ("verbose", "{$WIZ.standalone_connector.verbose/}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,15 +11,15 @@ class
|
|||||||
|
|
||||||
inherit
|
inherit
|
||||||
{unless condition="$WIZ.routers.use_router ~ $WIZ_YES"}
|
{unless condition="$WIZ.routers.use_router ~ $WIZ_YES"}
|
||||||
{unless condition="$WIZ.routers.use_filter ~ $WIZ_YES"}
|
{unless condition="$WIZ.filters.use_filter ~ $WIZ_YES"}
|
||||||
WSF_EXECUTION{/unless}
|
WSF_EXECUTION{/unless}
|
||||||
{if condition="$WIZ.routers.use_filter ~ $WIZ_YES"}
|
{if condition="$WIZ.filters.use_filter ~ $WIZ_YES"}
|
||||||
WSF_FILTERED_EXECUTION{/if}
|
WSF_FILTERED_EXECUTION{/if}
|
||||||
{/unless}
|
{/unless}
|
||||||
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}
|
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}
|
||||||
{unless condition="$WIZ.routers.use_filter ~ $WIZ_YES"}
|
{unless condition="$WIZ.filters.use_filter ~ $WIZ_YES"}
|
||||||
WSF_ROUTED_EXECUTION{/unless}
|
WSF_ROUTED_EXECUTION{/unless}
|
||||||
{if condition="$WIZ.routers.use_filter ~ $WIZ_YES"}
|
{if condition="$WIZ.filters.use_filter ~ $WIZ_YES"}
|
||||||
WSF_FILTERED_ROUTED_EXECUTION{/if}
|
WSF_FILTERED_ROUTED_EXECUTION{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -28,7 +28,6 @@ inherit
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
{/literal}
|
{/literal}
|
||||||
|
|
||||||
{unless condition="$WIZ.routers.use_router ~ $WIZ_YES"}{literal}
|
{unless condition="$WIZ.routers.use_router ~ $WIZ_YES"}{literal}
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
@@ -42,9 +41,9 @@ feature -- Execution
|
|||||||
--| To send back easily a simple plaintext message.
|
--| To send back easily a simple plaintext message.
|
||||||
create mesg.make_with_body ("Hello Eiffel Web")
|
create mesg.make_with_body ("Hello Eiffel Web")
|
||||||
response.send (mesg)
|
response.send (mesg)
|
||||||
end{/unless}
|
end
|
||||||
|
{/literal}{/unless}
|
||||||
{if condition="$WIZ.routers.use_filter ~ $WIZ_YES"}{literal}
|
{if condition="$WIZ.filters.use_filter ~ $WIZ_YES"}{literal}
|
||||||
feature -- Filter
|
feature -- Filter
|
||||||
|
|
||||||
create_filter
|
create_filter
|
||||||
@@ -56,15 +55,18 @@ feature -- Filter
|
|||||||
|
|
||||||
setup_filter
|
setup_filter
|
||||||
-- Setup `filter'
|
-- Setup `filter'
|
||||||
|
local
|
||||||
|
f: like filter
|
||||||
do
|
do
|
||||||
append_filters (<<
|
create {WSF_CORS_FILTER} f
|
||||||
create {WSF_CORS_FILTER},
|
f.set_next (create {WSF_LOGGING_FILTER})
|
||||||
create {WSF_LOGGING_FILTER}
|
|
||||||
>>)
|
|
||||||
--| Chain more filters like {WSF_CUSTOM_HEADER_FILTER}, ...
|
--| Chain more filters like {WSF_CUSTOM_HEADER_FILTER}, ...
|
||||||
--| and your owns filters.
|
--| and your owns filters.
|
||||||
end{/if}
|
|
||||||
|
|
||||||
|
filter.append (f)
|
||||||
|
end
|
||||||
|
{/literal}{/if}
|
||||||
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}{literal}
|
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}{literal}
|
||||||
feature -- Router
|
feature -- Router
|
||||||
|
|
||||||
@@ -78,12 +80,12 @@ feature -- Router
|
|||||||
--| /* are dispatched to serve files/directories contained in "www" directory
|
--| /* are dispatched to serve files/directories contained in "www" directory
|
||||||
|
|
||||||
--| Self documentation
|
--| Self documentation
|
||||||
router.handle_with_request_methods ("/doc", create {WSF_ROUTER_SELF_DOCUMENTATION_HANDLER}.make (router), router.methods_GET)
|
router.handle ("/doc", create {WSF_ROUTER_SELF_DOCUMENTATION_HANDLER}.make (router), router.methods_GET)
|
||||||
|
|
||||||
--| Files publisher
|
--| Files publisher
|
||||||
create fhdl.make_hidden ("www")
|
create fhdl.make_hidden ("www")
|
||||||
fhdl.set_directory_index (<<"index.html">>)
|
fhdl.set_directory_index (<<"index.html">>)
|
||||||
router.handle_with_request_methods ("", fhdl, router.methods_GET)
|
router.handle ("", fhdl, router.methods_GET)
|
||||||
end{/literal}{/if}
|
end{/literal}{/if}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ echo Install framework ewf
|
|||||||
%SAFE_MD% %TMP_CONTRIB_DIR%\library\web\framework\ewf
|
%SAFE_MD% %TMP_CONTRIB_DIR%\library\web\framework\ewf
|
||||||
echo Install library: ewf/ewsgi
|
echo Install library: ewf/ewsgi
|
||||||
%COPYCMD% %TMP_DIR%\library\server\ewsgi %TMP_CONTRIB_DIR%\library\web\framework\ewf\ewsgi
|
%COPYCMD% %TMP_DIR%\library\server\ewsgi %TMP_CONTRIB_DIR%\library\web\framework\ewf\ewsgi
|
||||||
|
echo Install library: ewf/httpd
|
||||||
|
%COPYCMD% %TMP_DIR%\library\server\httpd %TMP_CONTRIB_DIR%\library\web\framework\ewf\httpd
|
||||||
echo Install library: ewf/libfcgi
|
echo Install library: ewf/libfcgi
|
||||||
%COPYCMD% %TMP_DIR%\library\server\libfcgi %TMP_CONTRIB_DIR%\library\web\framework\ewf\libfcgi
|
%COPYCMD% %TMP_DIR%\library\server\libfcgi %TMP_CONTRIB_DIR%\library\web\framework\ewf\libfcgi
|
||||||
echo Install library: ewf/wsf
|
echo Install library: ewf/wsf
|
||||||
@@ -86,6 +88,10 @@ echo Install library: error
|
|||||||
%COPYCMD% %TMP_DIR%\library\utility\general\error %TMP_CONTRIB_DIR%\library\utility\general\error
|
%COPYCMD% %TMP_DIR%\library\utility\general\error %TMP_CONTRIB_DIR%\library\utility\general\error
|
||||||
echo Install library: http_client
|
echo Install library: http_client
|
||||||
%COPYCMD% %TMP_DIR%\library\network\http_client %TMP_CONTRIB_DIR%\library\network\http_client
|
%COPYCMD% %TMP_DIR%\library\network\http_client %TMP_CONTRIB_DIR%\library\network\http_client
|
||||||
|
echo Install library: http_network
|
||||||
|
%COPYCMD% %TMP_DIR%\library\network\http_network %TMP_CONTRIB_DIR%\library\network\http_network
|
||||||
|
echo Install library: websocket
|
||||||
|
%COPYCMD% %TMP_DIR%\library\network\websocket %TMP_CONTRIB_DIR%\library\network\websocket
|
||||||
echo Install library: http
|
echo Install library: http
|
||||||
%COPYCMD% %TMP_DIR%\library\network\protocol\http %TMP_CONTRIB_DIR%\library\network\protocol\http
|
%COPYCMD% %TMP_DIR%\library\network\protocol\http %TMP_CONTRIB_DIR%\library\network\protocol\http
|
||||||
echo Install library: content_negotiation
|
echo Install library: content_negotiation
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ echo Uninstall library: error
|
|||||||
%RDCMD% %TMP_CONTRIB_DIR%\library\utility\general\error
|
%RDCMD% %TMP_CONTRIB_DIR%\library\utility\general\error
|
||||||
echo Uninstall library: http_client
|
echo Uninstall library: http_client
|
||||||
%RDCMD% %TMP_CONTRIB_DIR%\library\network\http_client
|
%RDCMD% %TMP_CONTRIB_DIR%\library\network\http_client
|
||||||
|
echo Uninstall library: http_network
|
||||||
|
%RDCMD% %TMP_CONTRIB_DIR%\library\network\http_network
|
||||||
|
echo Uninstall library: websocket
|
||||||
|
%RDCMD% %TMP_CONTRIB_DIR%\library\network\websocket
|
||||||
echo Uninstall library: http
|
echo Uninstall library: http
|
||||||
%RDCMD% %TMP_CONTRIB_DIR%\library\network\protocol\http
|
%RDCMD% %TMP_CONTRIB_DIR%\library\network\protocol\http
|
||||||
echo Uninstall library: content_negotiation
|
echo Uninstall library: content_negotiation
|
||||||
|
|||||||
Reference in New Issue
Block a user