Have the github pages source in the same branch.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
note
|
||||
description: "Basic Service launcher"
|
||||
|
||||
class
|
||||
APPLICATION
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE [APPLICATION_EXECUTION]
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
-- Initialize current service.
|
||||
do
|
||||
set_service_option ("port", 9090)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,303 @@
|
||||
note
|
||||
description : "Basic Service that shows the standard CGI variables"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
EIS: "name=CGI specification","src=(https://tools.ietf.org/html/rfc3875", "protocol=url"
|
||||
|
||||
class
|
||||
APPLICATION_EXECUTION
|
||||
|
||||
inherit
|
||||
WSF_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Basic operations
|
||||
|
||||
execute
|
||||
-- Execute the incomming request
|
||||
local
|
||||
l_raw_data: STRING
|
||||
l_page_response: STRING
|
||||
l_rows: STRING
|
||||
do
|
||||
create l_page_response.make_from_string (html_template)
|
||||
if request.path_info.same_string ("/") then
|
||||
|
||||
-- HTTP method
|
||||
l_page_response.replace_substring_all ("$http_method", request.request_method)
|
||||
-- URI
|
||||
l_page_response.replace_substring_all ("$uri", request.path_info)
|
||||
-- Protocol
|
||||
l_page_response.replace_substring_all ("$protocol", request.server_protocol)
|
||||
|
||||
-- Fill the table rows with CGI standard variables
|
||||
create l_rows.make_empty
|
||||
|
||||
-- Auth_type
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("AUTH_TYPE")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
if attached request.auth_type as l_type then
|
||||
l_rows.append (l_type)
|
||||
else
|
||||
l_rows.append ("Not present")
|
||||
end
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
|
||||
-- Content length
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("CONTENT_LENGTH")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
if attached request.content_length as l_content_length then
|
||||
l_rows.append (l_content_length)
|
||||
else
|
||||
l_rows.append ("Not present")
|
||||
end
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
-- Content length
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("CONTENT_TYPE")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
if attached request.content_type as l_content_type then
|
||||
l_rows.append (l_content_type.string)
|
||||
else
|
||||
l_rows.append ("Not present")
|
||||
end
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
|
||||
-- Gateway interface
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("GATEWAY_INTERFACE")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
if attached request.gateway_interface as l_gateway_interface then
|
||||
l_rows.append (l_gateway_interface)
|
||||
else
|
||||
l_rows.append ("Not present")
|
||||
end
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
|
||||
-- Path info
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("PATH_INFO")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
if attached request.path_info as l_path_info then
|
||||
l_rows.append (l_path_info)
|
||||
else
|
||||
l_rows.append ("Not present")
|
||||
end
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
-- Path translated
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("PATH_TRANSLATED")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
if attached request.path_translated as l_path_translated then
|
||||
l_rows.append (l_path_translated)
|
||||
else
|
||||
l_rows.append ("Not present")
|
||||
end
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
-- Query string
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("QUERY_STRING")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
if attached request.query_string as l_query_string then
|
||||
l_rows.append (l_query_string)
|
||||
else
|
||||
l_rows.append ("Not present")
|
||||
end
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
-- Remote addr
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("REMOTE_ADDR")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append (request.remote_addr)
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
|
||||
-- Remote host
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("REMOTE_HOST")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
if attached request.remote_host as l_remote_host then
|
||||
l_rows.append (l_remote_host)
|
||||
else
|
||||
l_rows.append ("Not present")
|
||||
end
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
|
||||
|
||||
-- Remote ident
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("REMOTE_IDENT")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
if attached request.remote_ident as l_remote_ident then
|
||||
l_rows.append (l_remote_ident)
|
||||
else
|
||||
l_rows.append ("Not present")
|
||||
end
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
|
||||
-- Remote user
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("REMOTE_USER")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
if attached request.remote_user as l_remote_user then
|
||||
l_rows.append (l_remote_user)
|
||||
else
|
||||
l_rows.append ("Not present")
|
||||
end
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
|
||||
-- Request method
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("REQUEST_METHOD")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append (request.request_method)
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
|
||||
-- Script name
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("SCRIPT_NAME")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append (request.script_name)
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
-- Server name
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("SERVER_NAME")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append (request.server_name)
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
-- Server protocol
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("SERVER_PROTOCOL")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append (request.server_protocol)
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
-- Server software
|
||||
l_rows.append ("<tr>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append ("SERVER_SOFTWARE")
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("<td>")
|
||||
l_rows.append (request.server_software)
|
||||
l_rows.append ("</td>")
|
||||
l_rows.append ("</tr>")
|
||||
|
||||
|
||||
l_page_response.replace_substring_all ("$rows", l_rows)
|
||||
|
||||
-- Reading the raw header
|
||||
if attached request.raw_header_data as l_raw_header then
|
||||
l_page_response.replace_substring_all ("$raw_header", l_raw_header)
|
||||
end
|
||||
response.put_header ({HTTP_STATUS_CODE}.ok, <<["Content-Type", "text/html"], ["Content-Length", l_page_response.count.out]>>)
|
||||
response.put_string (l_page_response)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
html_template: STRING = "[
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
thead {color:green;}
|
||||
tbody {color:blue;}
|
||||
table, th, td {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>EWF service example: Showing Standard CGI Variables</h1>
|
||||
|
||||
<strong>HTTP METHOD:</strong>$http_method<br>
|
||||
<strong>URI:</strong>$uri<br>
|
||||
<strong>PROTOCOL:</strong>$protocol<br>
|
||||
|
||||
<br>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>CGI Name</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
$rows
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<h2>Raw header</h2>
|
||||
|
||||
$raw_header
|
||||
</body>
|
||||
</html>
|
||||
]"
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="cgi_variables" uuid="73FCA1D1-DE9D-4112-96BB-92F2C40AC5D1">
|
||||
<target name="common" abstract="true">
|
||||
<file_rule>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" void_safety="all">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
|
||||
</target>
|
||||
<target name="cgi_variables_standalone" extends="common">
|
||||
<root class="APPLICATION" feature="make_and_launch"/>
|
||||
<option warning="true" void_safety="all">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone-safe.ecf"/>
|
||||
<cluster name="cgi_variables" location=".\" recursive="true"/>
|
||||
</target>
|
||||
<target name="cgi_variables_cgi" extends="common">
|
||||
<root class="APPLICATION" feature="make_and_launch"/>
|
||||
<option warning="true" void_safety="all">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/>
|
||||
<cluster name="cgi_variables" location=".\" recursive="true"/>
|
||||
</target>
|
||||
<target name="cgi_variables_libfcgi" extends="common">
|
||||
<root class="APPLICATION" feature="make_and_launch"/>
|
||||
<option warning="true" void_safety="all">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/>
|
||||
<cluster name="cgi_variables" location=".\" recursive="true"/>
|
||||
</target>
|
||||
<target name="cgi_variables" extends="cgi_variables_standalone">
|
||||
</target>
|
||||
</system>
|
||||
Reference in New Issue
Block a user