Compare commits

...

7 Commits

17 changed files with 193 additions and 57 deletions

View File

@@ -1,10 +1,8 @@
language: eiffel
before_script:
- export current_dir=$PWD ; echo current_dir=$current_dir ; cd ..
- export ISE_VERSION=17.05; export ISE_BUILD=100416
- curl -sSL http://downloads.sourceforge.net/eiffelstudio/Eiffel_${ISE_VERSION}_gpl_${ISE_BUILD}-linux-x86-64.tar.bz2 | tar -x --bzip2
- export ISE_EIFFEL=$PWD/Eiffel_${ISE_VERSION} ; export ISE_PLATFORM=linux-x86-64
- export PATH=$PATH:$ISE_EIFFEL/studio/spec/$ISE_PLATFORM/bin:$PATH:$ISE_EIFFEL/tools/spec/$ISE_PLATFORM/bin
- curl -sSL https://www.eiffel.org/setup/install.sh | bash
- source eiffel_latest.rc
- echo `ec -version`
- cd $current_dir
- echo Check projects compilation status...

View File

@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
- `http_client`: added support for ciphers setting in the libcurl implementation only.
- `http_client`: added convenient `get` and `custom` functions on HTTP_CLIENT directly.
- `websocket`: added `on_timer` solution to allow the server to check for external events and send notification to websocket clients.
- `wsf`: added `WSF_EXECUTE_HANDLER`, and `WSF_CGI_HANDLER`. Demonstration of `WSF_CGI_HANDLER` in the new `tools/httpd` project.
### Changed
- adopted ecf version 1-16-0 and use a single .ecf file (the -safe.ecf are now redirection to normal .ecf)
@@ -23,6 +24,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
- `http_client`: Added support for multiple file in form data. Made clear what is the meaning of `upload_filename`, `upload_data` and `form_data`.
- `authentication`: HTTP_AUTHORIZATION acceps now READABLE_STRING_GENERAL for username and password argument.
- `http_client`: fixed curl implementation by setting `Content-Type` to `x-www-form-urlencoded` (if not set) when POST send data as `x-www-form-urlencoded`.
- `notification_email`: fixed the SMTP support for multiple recipients address.
### Security

View File

@@ -13,14 +13,14 @@ Currently EWF offers a collection of Eiffel libraries designed to be integrated
There is a growing ecosystem around EWF, that provides useful components:
* OpenID and OAuth consumer library
* Various hypermedia format such as HAL, Collection+json,
* Various hypermedia format such as HAL, Collection+json, ...
* Websocket server and client
* Template engine
* API Auto-documentation with swagger
* A simple experimental CMS.
* ...
So if you want to build a website, a web api, RESTful service, or even if you want to consume other web api, EWF is a solution.
So if you want to build a website, a web api, RESTful service, ... or even if you want to consume other web api, EWF is a solution.
EWF brings with it all the advantages of the Eiffel technology and tools with its powerful features such as Design by Contract, debugging, testing tools which enable to build efficient systems expected to be repeatedly refined, extended, and improved in a predictable and controllable way so as to become with time bugfree systems. Enjoy the full power of debugging your web server application from the IDE.
@@ -51,11 +51,11 @@ Tasks and issues are managed with github issue system
## How to get the source code?
Using git
* git clone https://github.com/EiffelWebFramework/EWF.git
* `git clone https://github.com/EiffelWebFramework/EWF.git`
* And to build the required and related Clibs
* cd contrib/ise_library/cURL
* geant compile
* `cd contrib/ise_library/cURL`
* `geant compile`
## Libraries under 'library'
@@ -64,7 +64,7 @@ Using git
* connectors: various web server connectors for EWSGI
* libfcgi: Wrapper for libfcgi SDK
* __wsf__: Web Server Framework [read more](library/server/wsf)
* __router__: URL dispatching/routing based on uri, uri_template, or custom [read more](library/server/wsf/router)
* __router__: URL dispatching/routing based on `uri`, `uri_template`, or custom [read more](library/server/wsf/router)
### protocol
* __http__: HTTP related classes, constants for status code, content types, ... [read more](library/network/protocol/http)

View File

@@ -95,40 +95,67 @@ feature -- Basic operation
l_email: EMAIL
h: STRING
i: INTEGER
lst: LIST [READABLE_STRING_8]
do
create l_email.make_with_entry (a_email.from_address, addresses_to_header_line_value (a_email.to_addresses))
if attached a_email.reply_to_address as l_reply_to then
l_email.add_header_entry ({EMAIL_CONSTANTS}.h_reply_to, l_reply_to)
end
if attached a_email.cc_addresses as lst then
l_email.add_header_entry ({EMAIL_CONSTANTS}.h_cc, addresses_to_header_line_value (lst))
end
if attached a_email.bcc_addresses as lst then
l_email.add_header_entry ({EMAIL_CONSTANTS}.h_bcc, addresses_to_header_line_value (lst))
end
l_email.set_message (a_email.content)
l_email.add_header_entry ({EMAIL_CONSTANTS}.H_subject, a_email.subject)
create h.make_empty
;(create {HTTP_DATE}.make_from_date_time (a_email.date)).append_to_rfc1123_string (h)
l_email.add_header_entry ("Date", h)
if attached a_email.additional_header_lines as lst then
across
lst as ic
loop
h := ic.item
i := h.index_of (':', 1)
if i > 0 then
l_email.add_header_entry (h.head (i - 1), h.substring (i + 1, h.count))
else
check is_header_line: False end
lst := a_email.to_addresses
if lst.is_empty then
-- Error ...
else
-- With EMAIL, there should be a unique recipient at creation.
create l_email.make_with_entry (a_email.from_address, lst.first)
if lst.count > 1 then
from
lst.start
lst.forth
until
lst.off
loop
l_email.add_recipient_address (lst.item)
lst.forth
end
end
end
if attached a_email.reply_to_address as l_reply_to then
l_email.add_header_entry ({EMAIL_CONSTANTS}.h_reply_to, l_reply_to)
end
smtp_send_email (l_email)
if attached a_email.cc_addresses as l_cc_addresses then
across
l_cc_addresses as ic
loop
l_email.add_recipient_address_in_cc (ic.item)
end
end
if attached a_email.bcc_addresses as l_bcc_addresses then
across
l_bcc_addresses as ic
loop
l_email.add_recipient_address_in_bcc (ic.item)
end
end
l_email.set_message (a_email.content)
l_email.add_header_entry ({EMAIL_CONSTANTS}.H_subject, a_email.subject)
create h.make_empty
;(create {HTTP_DATE}.make_from_date_time (a_email.date)).append_to_rfc1123_string (h)
l_email.add_header_entry ("Date", h)
if attached a_email.additional_header_lines as l_lines then
across
l_lines as ic
loop
h := ic.item
i := h.index_of (':', 1)
if i > 0 then
l_email.add_header_entry (h.head (i - 1), h.substring (i + 1, h.count))
else
check is_header_line: False end
end
end
end
smtp_send_email (l_email)
end
end
feature {NONE} -- Implementation
@@ -182,4 +209,3 @@ note
Customer support http://support.eiffel.com
]"
end

View File

@@ -50,6 +50,7 @@ feature -- Status report
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute `req' responding in `res'.
local
fut: FILE_UTILITIES
l_exec_path: PATH

View File

@@ -1,8 +1,11 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
description: "[
Handler that can also play the role of a filter, i.e.
than can pre-process incoming data and post-process outgoing data.
]"
author: "$Author$"
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_EXECUTE_FILTER_HANDLER
@@ -22,7 +25,7 @@ feature -- Execution
end
note
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
copyright: "2011-2017, 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)"
source: "[
Eiffel Software

View File

@@ -32,7 +32,7 @@ feature -- Execution
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
copyright: "2011-2017, 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)"
source: "[
Eiffel Software

View File

@@ -8,10 +8,19 @@ deferred class
WSF_URI_FILTER_HANDLER
inherit
WSF_EXECUTE_FILTER_HANDLER
WSF_FILTER_HANDLER [WSF_URI_HANDLER]
WSF_URI_HANDLER
feature -- Execution
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
do
if attached next as n then
n.execute (req, res)
end
end
note
copyright: "2011-2017, 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)"

View File

@@ -11,7 +11,9 @@ inherit
WSF_EXECUTE_RESPONSE_AGENT_HANDLER
WSF_URI_RESPONSE_HANDLER
undefine
execute
end
create
make

View File

@@ -8,10 +8,28 @@ deferred class
WSF_URI_RESPONSE_HANDLER
inherit
WSF_EXECUTE_HANDLER
WSF_HANDLER
WSF_URI_HANDLER
feature -- Response
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
require
is_valid_context: is_valid_context (req)
deferred
ensure
Result_attached: Result /= Void
end
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
res.send (response (req))
end
note
copyright: "2011-2017, 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)"

View File

@@ -8,10 +8,20 @@ deferred class
WSF_URI_HANDLER
inherit
WSF_EXECUTE_HANDLER
WSF_HANDLER
WSF_ROUTER_MAPPING_FACTORY
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute `req' responding in `res'.
require
req_attached: req /= Void
res_attached: res /= Void
deferred
end
feature {WSF_ROUTER} -- Mapping
new_mapping (a_uri: READABLE_STRING_8): WSF_ROUTER_MAPPING

View File

@@ -8,10 +8,19 @@ deferred class
WSF_URI_TEMPLATE_FILTER_HANDLER
inherit
WSF_EXECUTE_FILTER_HANDLER
WSF_FILTER_HANDLER [WSF_URI_TEMPLATE_HANDLER]
WSF_URI_TEMPLATE_HANDLER
feature -- Execution
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
do
if attached next as n then
n.execute (req, res)
end
end
note
copyright: "2011-2017, 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)"

View File

@@ -11,6 +11,9 @@ inherit
WSF_EXECUTE_RESPONSE_AGENT_HANDLER
WSF_URI_TEMPLATE_RESPONSE_HANDLER
undefine
execute
end
create
make

View File

@@ -8,10 +8,28 @@ deferred class
WSF_URI_TEMPLATE_RESPONSE_HANDLER
inherit
WSF_EXECUTE_RESPONSE_HANDLER
WSF_RESPONSE_HANDLER
WSF_URI_TEMPLATE_HANDLER
feature -- Response
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
require
is_valid_context: is_valid_context (req)
deferred
ensure
Result_attached: Result /= Void
end
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
res.send (response (req))
end
note
copyright: "2011-2017, 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)"

View File

@@ -8,10 +8,20 @@ deferred class
WSF_URI_TEMPLATE_HANDLER
inherit
WSF_EXECUTE_HANDLER
WSF_HANDLER
WSF_ROUTER_MAPPING_FACTORY
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute `req' responding in `res'.
require
req_attached: req /= Void
res_attached: res /= Void
deferred
end
feature {WSF_ROUTER} -- Mapping
new_mapping (a_tpl: READABLE_STRING_8): WSF_ROUTER_MAPPING

View File

@@ -0,0 +1,24 @@
note
description: "[
Represents the ancestor of all the WSF_ROUTER handler based on message response.
]"
date: "$Date$"
revision: "$Revision$"
class
WSF_RESPONSE_HANDLER
inherit
WSF_HANDLER
note
copyright: "2011-2015, 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)"
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

View File

@@ -8,7 +8,7 @@ deferred class
WSF_ROUTING_HANDLER
inherit
WSF_EXECUTE_HANDLER
WSF_HANDLER
feature {NONE} -- Initialization
@@ -48,7 +48,10 @@ feature -- Element change
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
-- Execute `req' responding in `res'.
require
req_attached: req /= Void
res_attached: res /= Void
local
sess: WSF_ROUTER_SESSION
do
@@ -60,7 +63,7 @@ feature -- Execution
end
note
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
copyright: "2011-2017, 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)"
source: "[
Eiffel Software