First integration of the new GW_ design more centralized on connector, and does not require specific feature on GW_APPLICATION depending on the connector.
So this is really more flexible this way, and much easier to write application supporting CGI, FCGI, Nino and so on .. as demonstrated in hello_world This is a first version, more will come later, mainly migrating from Eiffel Web Reloaded to this Eiffel Web Framework project.
This commit is contained in:
7
library/server/libfcgi/README.txt
Normal file
7
library/server/libfcgi/README.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
To compile your own binaries .lib and .dll on Windows
|
||||
please get the source from
|
||||
|
||||
https://github.com/EiffelSoftware/libfcgi
|
||||
|
||||
git repository:
|
||||
git clone https://github.com/EiffelSoftware/libfcgi.git
|
||||
50
library/server/libfcgi/doc/Configuration_examples.txt
Normal file
50
library/server/libfcgi/doc/Configuration_examples.txt
Normal file
@@ -0,0 +1,50 @@
|
||||
= How to configure FCGI =
|
||||
== Apache2/Windows ==
|
||||
* in apache2/conf/httpd.conf add
|
||||
LoadModule fcgid_module modules/mod_fcgid.so
|
||||
|
||||
* and for instance, you can put the following code to test the tests/eiffelweb example
|
||||
|
||||
<IfModule mod_fcgid.c>
|
||||
FcgidIdleTimeout 60
|
||||
FcgidBusyScanInterval 120
|
||||
FcgidProcessLifeTime 1600
|
||||
#7200
|
||||
FcgidMaxProcesses 5
|
||||
FcgidMaxProcessesPerClass 100
|
||||
FcgidMinProcessesPerClass 100
|
||||
FcgidConnectTimeout 8
|
||||
FcgidIOTimeout 3000
|
||||
FcgidBusyTimeout 3200
|
||||
FcgidPassHeader Authorization
|
||||
|
||||
|
||||
alias /eiffelweb/ "c:/_dev/EiffelWebReloaded/library/fcgi/tests/EIFGENs/eiffelweb/W_code/"
|
||||
<Location /eiffelweb/>
|
||||
AddHandler fcgid-script .exe
|
||||
Options Indexes FollowSymLinks ExecCGI
|
||||
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Location>
|
||||
</IfModule>
|
||||
|
||||
|
||||
== IIS/Windows ==
|
||||
* When you install IIS on Windows 7, you just need to enable to CGI module which also include the FastCGI module
|
||||
* otherwise, have a look at http://www.iis.net/download/FastCGI and also http://learn.iis.net/page.aspx/375/set-up-fastcgi-for-php/
|
||||
* Then open the IIS Manager
|
||||
Modules: to check you really have FastCGIModule
|
||||
Handler Mappings and then "Add Module Mapping"
|
||||
Request path: *.exe
|
||||
Module: FastCgiModule
|
||||
Executable (optional): c:\_dev\EiffelWebReloaded\library\fcgi\tests\EIFGENs\eiffelweb\W_code\eiffelweb.exe
|
||||
Name: Eiffel Web Solution using FastCGI on IIS
|
||||
|
||||
|
||||
= Notes =
|
||||
* The notes in this readme are very basic, mainly to test your executable.
|
||||
* You will need to configure more precisely your httpd server to fulfill your needs
|
||||
|
||||
== for execution ==
|
||||
* On Windows, be sure to have the libfcgi.dll in your path (or in same folder as executable)
|
||||
52
library/server/libfcgi/fcgi.ecf
Normal file
52
library/server/libfcgi/fcgi.ecf
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-6-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-6-0 http://www.eiffel.com/developers/xml/configuration-1-6-0.xsd" name="fcgi" uuid="3F4BCF74-3503-4533-9D74-5A65EC4CA3C4" library_target="fcgi">
|
||||
<target name="fcgi">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
</file_rule>
|
||||
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" >
|
||||
</option>
|
||||
<external_include location="$ECF_CONFIG_PATH/spec/include/libfcgi">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$ECF_CONFIG_PATH\spec\include\libfcgi">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_library location="$ECF_CONFIG_PATH\spec\lib\$ISE_PLATFORM\$ISE_C_COMPILER\libfcgi.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_library>
|
||||
<external_library location="/usr/local/lib/libfcgi.so">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_library>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<cluster name="interface" location="interface" recursive="true"/>
|
||||
<cluster name="implementation" location="implementation" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/linux$</exclude>
|
||||
<exclude>/fake$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/windows$</exclude>
|
||||
<exclude>/fake$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
</system>
|
||||
104
library/server/libfcgi/implementation/fake/fcgi_imp.e
Normal file
104
library/server/libfcgi/implementation/fake/fcgi_imp.e
Normal file
@@ -0,0 +1,104 @@
|
||||
note
|
||||
description: "Implementation for the FCGI_I interface"
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class FCGI_IMP
|
||||
|
||||
inherit
|
||||
FCGI_I
|
||||
|
||||
feature -- Access
|
||||
|
||||
environ: POINTER
|
||||
-- Get the (char**) environ variable from the DLL.
|
||||
external
|
||||
"C inline use %"fcgi_stdio.h%""
|
||||
alias
|
||||
"return (char**) environ;"
|
||||
end
|
||||
|
||||
feature -- FCGI connection
|
||||
|
||||
fcgi_listen: INTEGER
|
||||
-- Listen to the FCGI input stream
|
||||
-- Return 0 for successful calls, -1 otherwise.
|
||||
do
|
||||
-- Set state on first call to prevent looping indefinitely
|
||||
if fcgi_has_run then
|
||||
Result := -1
|
||||
else --if not is_interactive then
|
||||
fcgi_has_run := True
|
||||
end
|
||||
end
|
||||
|
||||
fcgi_has_run: BOOLEAN
|
||||
-- For emulation only; Has fcgi_listen been called?
|
||||
|
||||
fcgi_finish
|
||||
-- Finish current request from HTTP server started from
|
||||
-- the most recent call to `fcgi_accept'.
|
||||
do
|
||||
end
|
||||
|
||||
set_fcgi_exit_status (v: INTEGER)
|
||||
do
|
||||
end
|
||||
|
||||
feature -- FCGI output
|
||||
|
||||
put_string (a_str: STRING)
|
||||
-- Put `a_str' on the FastCGI stdout.
|
||||
do
|
||||
io.put_string (a_str)
|
||||
end
|
||||
|
||||
-- fcgi_printf (fmt: STRING; args: FINITE[ANY])
|
||||
-- -- Put args, formatted per 'fmt' on the FastCGI stdout.
|
||||
-- do
|
||||
-- apf.printf (fmt, args)
|
||||
-- end
|
||||
|
||||
feature -- FCGI Input
|
||||
|
||||
read_from_stdin (n: INTEGER)
|
||||
-- Read up to n bytes from stdin and store in input buffer
|
||||
do
|
||||
end
|
||||
|
||||
copy_from_stdin (n: INTEGER; tf: FILE)
|
||||
-- Read up to n bytes from stdin and write to given file
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Status
|
||||
|
||||
buffer_contents: STRING
|
||||
do
|
||||
if attached private_input_buffer as buf then
|
||||
Result := buf
|
||||
else
|
||||
Result := ""
|
||||
end
|
||||
end
|
||||
|
||||
buffer_capacity: INTEGER
|
||||
do
|
||||
if attached private_input_buffer as bug then
|
||||
Result := buf.capacity
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, 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
|
||||
97
library/server/libfcgi/implementation/linux/fcgi_c_api.e
Normal file
97
library/server/libfcgi/implementation/linux/fcgi_c_api.e
Normal file
@@ -0,0 +1,97 @@
|
||||
note
|
||||
description: "Wrappers around FastCGI C API."
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
FCGI_C_API
|
||||
|
||||
feature -- Connection
|
||||
|
||||
accept: INTEGER
|
||||
-- Accept a Fast CGI connection.
|
||||
-- Return 0 for successful calls, -1 otherwise.
|
||||
external
|
||||
"C inline use %"fcgi_stdio.h%""
|
||||
alias
|
||||
"return FCGI_Accept();"
|
||||
end
|
||||
|
||||
environ: POINTER
|
||||
-- Get the (char**) environ variable from the DLL.
|
||||
external
|
||||
"C inline use %"fcgi_stdio.h%""
|
||||
alias
|
||||
"return (char**) environ;"
|
||||
end
|
||||
|
||||
finish
|
||||
-- Finished current request from HTTP server started from
|
||||
-- the most recent call to `fcgi_accept'.
|
||||
external
|
||||
"C inline use %"fcgi_stdio.h%""
|
||||
alias
|
||||
"FCGI_Finish();"
|
||||
end
|
||||
|
||||
set_exit_status (v: INTEGER)
|
||||
-- Set the exit status for the most recent request
|
||||
external
|
||||
"C inline use %"fcgi_stdio.h%""
|
||||
alias
|
||||
"FCGI_SetExitStatus($v);"
|
||||
end
|
||||
|
||||
feature -- Input
|
||||
|
||||
read_content_into (a_buffer: POINTER; a_length: INTEGER): INTEGER
|
||||
-- Read content stream into `a_buffer' but no more than `a_length' character.
|
||||
external
|
||||
"C inline use %"fcgi_stdio.h%""
|
||||
alias
|
||||
"[
|
||||
{
|
||||
size_t n;
|
||||
if (! FCGI_feof(FCGI_stdin)) {
|
||||
n = FCGI_fread($a_buffer, 1, $a_length, FCGI_stdin);
|
||||
} else {
|
||||
n = 0;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
gets (s: POINTER): POINTER
|
||||
-- gets() reads a line from stdin into the buffer pointed to
|
||||
-- by s until either a terminating newline or EOF, which it
|
||||
-- replaces with '\0'
|
||||
-- No check for buffer overrun is performed
|
||||
external
|
||||
"C inline use %"fcgi_stdio.h%""
|
||||
alias
|
||||
"return FCGI_gets($s);"
|
||||
end
|
||||
|
||||
feature -- Output
|
||||
|
||||
put_string (v: POINTER; n: INTEGER)
|
||||
external
|
||||
"C inline use %"fcgi_stdio.h%""
|
||||
alias
|
||||
"FCGI_fwrite($v, 1, $n, FCGI_stdout);"
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, 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
|
||||
183
library/server/libfcgi/implementation/linux/fcgi_imp.e
Normal file
183
library/server/libfcgi/implementation/linux/fcgi_imp.e
Normal file
@@ -0,0 +1,183 @@
|
||||
note
|
||||
description: "Implementation for the FCGI_I interface"
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class FCGI_IMP
|
||||
|
||||
inherit
|
||||
FCGI_I
|
||||
STRING_HANDLER
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize FCGI interface
|
||||
do
|
||||
create fcgi
|
||||
end
|
||||
|
||||
fcgi: FCGI_C_API
|
||||
-- FastCGI C API primitives
|
||||
|
||||
|
||||
feature -- Access
|
||||
|
||||
fcgi_environ: POINTER
|
||||
do
|
||||
Result := fcgi.environ
|
||||
end
|
||||
|
||||
feature -- FCGI Connection
|
||||
|
||||
fcgi_listen: INTEGER
|
||||
-- Listen to the FCGI input stream
|
||||
-- Return 0 for successful calls, -1 otherwise.
|
||||
do
|
||||
Result := {FCGI_C_API}.accept
|
||||
end
|
||||
|
||||
update_eif_environ
|
||||
external
|
||||
"C inline use <string.h>"
|
||||
alias
|
||||
"[
|
||||
eif_environ = (char**) environ;
|
||||
]"
|
||||
end
|
||||
|
||||
fcgi_finish
|
||||
-- Finish current request from HTTP server started from
|
||||
-- the most recent call to `fcgi_accept'.
|
||||
do
|
||||
{FCGI_C_API}.finish
|
||||
end
|
||||
|
||||
set_fcgi_exit_status (v: INTEGER)
|
||||
do
|
||||
{FCGI_C_API}.set_exit_status (-2)
|
||||
end
|
||||
|
||||
feature -- FCGI output
|
||||
|
||||
put_string (a_str: STRING)
|
||||
-- Put `a_str' on the FastCGI stdout.
|
||||
local
|
||||
l_c_str: C_STRING
|
||||
do
|
||||
l_c_str := c_buffer
|
||||
l_c_str.set_string (a_str)
|
||||
{FCGI_C_API}.put_string (l_c_str.item, l_c_str.count)
|
||||
end
|
||||
|
||||
-- fcgi_printf (fmt: STRING; args: FINITE[ANY])
|
||||
-- -- Put args, formatted per 'fmt' on the FastCGI stdout.
|
||||
-- local
|
||||
-- l_c_str: C_STRING
|
||||
-- do
|
||||
-- create l_c_str.make (apf.aprintf (fmt, args))
|
||||
-- {FCGI_C_API}.put_string (l_c_str.item, l_c_str.count)
|
||||
-- end
|
||||
|
||||
feature -- FCGI Input
|
||||
|
||||
copy_from_stdin (n: INTEGER; tf: FILE)
|
||||
-- Read up to n bytes from stdin and write to given file
|
||||
local
|
||||
l_c_str: C_STRING
|
||||
num, readsize, writecount: INTEGER
|
||||
done: BOOLEAN
|
||||
do
|
||||
--put_trace ("copy_from_stdin, n=" +n.out)
|
||||
readsize := n.min (K_input_bufsize)
|
||||
--put_trace ("copy_from_stdin, readsize=" +readsize.out)
|
||||
l_c_str := c_buffer
|
||||
from
|
||||
until done or writecount >= n
|
||||
loop
|
||||
num := {FCGI_C_API}.read_content_into (l_c_str.item, readsize)
|
||||
--put_trace ("copy_from_stdin, num=" +num.out)
|
||||
if num = 0 then
|
||||
-- EOF
|
||||
done := True
|
||||
else
|
||||
tf.put_managed_pointer (c_buffer.managed_data, 0, num)
|
||||
writecount := writecount + num
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: FCGI Input
|
||||
|
||||
fill_pointer_from_stdin (p: POINTER; n: INTEGER): INTEGER
|
||||
-- Read up to `n' bytes from stdin and store in pointer `p'
|
||||
-- and return number of bytes read.
|
||||
do
|
||||
Result := {FCGI_C_API}.read_content_into (p, n)
|
||||
end
|
||||
|
||||
feature -- I/O Routines
|
||||
|
||||
--RFO read_stdin_into (a_str: STRING)
|
||||
--RFO -- Read a string from the `stdin' into `a_str'.
|
||||
--RFO require
|
||||
--RFO a_str_not_void: a_str /= Void
|
||||
--RFO local
|
||||
--RFO l_c_str: C_STRING
|
||||
--RFO n: INTEGER
|
||||
--RFO do
|
||||
--RFO l_c_str := c_buffer
|
||||
--RFO n := {FCGI_C_API}.read_content_into (l_c_str.item, l_c_str.capacity)
|
||||
--RFO a_str.set_count (n)
|
||||
--RFO l_c_str.read_substring_into (a_str, 1, n)
|
||||
--RFO end
|
||||
|
||||
--RFO read_string_into (a_str: STRING)
|
||||
--RFO require
|
||||
--RFO exists: a_str /= Void
|
||||
--RFO local
|
||||
--RFO l_c_str: C_STRING
|
||||
--RFO p: POINTER
|
||||
--RFO do
|
||||
--RFO create l_c_str.make_empty (1024)
|
||||
--RFO p := {FCGI_C_API}.gets (l_c_str.item)
|
||||
--RFO-- if p /= default_pointer and p = l_c_str.item then
|
||||
--RFO a_str.resize (l_c_str.count)
|
||||
--RFO l_c_str.read_string_into (a_str)
|
||||
--RFO-- else
|
||||
--RFO-- put_error_line ("Bad pointer from gets")
|
||||
--RFO-- end
|
||||
--RFO end
|
||||
|
||||
--RFO read_line
|
||||
--RFO -- Read up to the next end of line, or end of input
|
||||
--RFO -- Leave result in last_string
|
||||
--RFO -- Newline character is absent from result
|
||||
--RFO do
|
||||
--RFO if last_string = Void then
|
||||
--RFO create Result.make (K_input_bufsize)
|
||||
--RFO else
|
||||
--RFO last_string.wipe_out
|
||||
--RFO end
|
||||
--RFO-- if input_filename /= Void then
|
||||
--RFO-- io.read_line
|
||||
--RFO-- last_string.append (io.last_string)
|
||||
--RFO-- else
|
||||
--RFO read_string_into (last_string)
|
||||
--RFO-- end
|
||||
--RFO end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, 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
|
||||
136
library/server/libfcgi/implementation/windows/fcgi_c_api.e
Normal file
136
library/server/libfcgi/implementation/windows/fcgi_c_api.e
Normal file
@@ -0,0 +1,136 @@
|
||||
note
|
||||
description: "Wrappers around FastCGI C API."
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
FCGI_C_API
|
||||
|
||||
feature -- Connections
|
||||
|
||||
accept: INTEGER
|
||||
-- Accept a Fast CGI connection.
|
||||
-- Return 0 for successful calls, -1 otherwise.
|
||||
external
|
||||
"dll libfcgi.dll signature (): EIF_INTEGER use fcgi_stdio.h "
|
||||
alias
|
||||
"FCGI_Accept"
|
||||
end
|
||||
|
||||
environ: POINTER
|
||||
-- Get the (char**) environ variable from the DLL.
|
||||
external
|
||||
"dll libfcgi.dll signature (): EIF_POINTER use fcgi_stdio.h "
|
||||
alias
|
||||
"FCGI_Environ"
|
||||
end
|
||||
|
||||
finish
|
||||
-- Finished current request from HTTP server started from
|
||||
-- the most recent call to `accept'.
|
||||
external
|
||||
"dll libfcgi.dll signature () use fcgi_stdio.h "
|
||||
alias
|
||||
"FCGI_Finish"
|
||||
end
|
||||
|
||||
set_exit_status (v: INTEGER)
|
||||
-- Set the exit status for the most recent request
|
||||
external
|
||||
"dll libfcgi.dll signature (EIF_INTEGER) use fcgi_stdio.h "
|
||||
alias
|
||||
"FCGI_SetExitStatus"
|
||||
end
|
||||
|
||||
feature -- Input
|
||||
|
||||
fread (v: POINTER; a_size: INTEGER; n: INTEGER; fp: POINTER): INTEGER
|
||||
-- FCGI_fread() read from input `fp' and put into `v'
|
||||
external
|
||||
"dll libfcgi.dll signature (EIF_POINTER, EIF_INTEGER, EIF_INTEGER, EIF_POINTER): EIF_INTEGER use fcgi_stdio.h "
|
||||
alias
|
||||
"FCGI_fread"
|
||||
end
|
||||
|
||||
feof (v: POINTER): INTEGER
|
||||
-- FCGI_feof()
|
||||
external
|
||||
"dll libfcgi.dll signature (EIF_POINTER): EIF_INTEGER use fcgi_stdio.h "
|
||||
alias
|
||||
"FCGI_feof"
|
||||
end
|
||||
|
||||
read_content_into (a_buffer: POINTER; a_length: INTEGER): INTEGER
|
||||
-- Read content stream into `a_buffer' but no more than `a_length' character.
|
||||
local
|
||||
i: INTEGER
|
||||
l_stdin: POINTER
|
||||
do
|
||||
l_stdin := stdin
|
||||
i := feof (l_stdin)
|
||||
if i /= 0 then
|
||||
Result := 0
|
||||
else
|
||||
Result := fread(a_buffer, 1, a_length, l_stdin)
|
||||
end
|
||||
end
|
||||
|
||||
gets (s: POINTER): POINTER
|
||||
-- gets() reads a line from stdin into the buffer pointed to
|
||||
-- by `s' until either a terminating newline or EOF, which it
|
||||
-- replaces with '\0'
|
||||
-- No check for buffer overrun is performed
|
||||
external
|
||||
"dll libfcgi.dll signature (EIF_POINTER): EIF_POINTER use fcgi_stdio.h "
|
||||
alias
|
||||
"FCGI_gets"
|
||||
end
|
||||
|
||||
feature -- Output
|
||||
|
||||
put_string (v: POINTER; n: INTEGER)
|
||||
local
|
||||
i: INTEGER
|
||||
do
|
||||
i := fwrite (v, 1, n, stdout)
|
||||
end
|
||||
|
||||
fwrite (v: POINTER; a_size: INTEGER; n: INTEGER; fp: POINTER): INTEGER
|
||||
-- FCGI_fwrite() ouput `v' to `fp'
|
||||
external
|
||||
"dll libfcgi.dll signature (EIF_POINTER, EIF_INTEGER, EIF_INTEGER, EIF_POINTER): EIF_INTEGER use fcgi_stdio.h "
|
||||
alias
|
||||
"FCGI_fwrite"
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
stdout: POINTER
|
||||
-- FCGI_stdout() return pointer on output FCGI_FILE
|
||||
external
|
||||
"C inline use %"fcgi_stdio.h%""
|
||||
alias
|
||||
"FCGI_stdout"
|
||||
end
|
||||
|
||||
stdin: POINTER
|
||||
-- FCGI_stdin() return pointer on input FCGI_FILE
|
||||
external
|
||||
"C inline use %"fcgi_stdio.h%""
|
||||
alias
|
||||
"FCGI_stdin"
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, 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
|
||||
267
library/server/libfcgi/implementation/windows/fcgi_imp.e
Normal file
267
library/server/libfcgi/implementation/windows/fcgi_imp.e
Normal file
@@ -0,0 +1,267 @@
|
||||
note
|
||||
description: "Implementation for the FCGI_I interface"
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class FCGI_IMP
|
||||
|
||||
inherit
|
||||
FCGI_I
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize FCGI interface
|
||||
do
|
||||
create fcgi
|
||||
end
|
||||
|
||||
fcgi: FCGI_C_API
|
||||
-- FastCGI C API primitives
|
||||
|
||||
feature -- Access
|
||||
|
||||
fcgi_environ: POINTER
|
||||
do
|
||||
Result := fcgi.environ
|
||||
end
|
||||
|
||||
-- updated_environ_variables: HASH_TABLE [STRING, STRING]
|
||||
-- local
|
||||
---- n, l_size,
|
||||
-- i: INTEGER
|
||||
-- p, v, null: POINTER
|
||||
-- do
|
||||
---- update_eif_environ
|
||||
---- Result := starting_environment_variables
|
||||
--
|
||||
---- p := environ_strings_pointer ($n)
|
||||
---- from
|
||||
---- i := 1
|
||||
---- l_size := 0
|
||||
---- create Result.make (n)
|
||||
---- until
|
||||
---- i > n
|
||||
---- loop
|
||||
---- create s.make_from_c (p.plus (l_size))
|
||||
---- l_size := l_size + s.count + 1
|
||||
---- if attached separated_variables (s) as t then
|
||||
---- Result.force (t.value, t.key)
|
||||
---- end
|
||||
---- i := i + 1
|
||||
---- end
|
||||
--
|
||||
-- p := fcgi.environ
|
||||
-- create Result.make (50)
|
||||
-- if p /= null then
|
||||
-- from
|
||||
-- i := 0
|
||||
-- v := fcgi_i_th_environ (i,p)
|
||||
-- until
|
||||
-- v = null
|
||||
-- loop
|
||||
-- if attached separated_variables (create {STRING}.make_from_c (v)) as t then
|
||||
-- Result.force (t.value, t.key)
|
||||
-- end
|
||||
-- i := i + 1
|
||||
-- v := fcgi_i_th_environ (i,p)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- fcgi_i_th_environ (i: INTEGER; p: POINTER): POINTER
|
||||
-- -- Environment variable at `i'-th position of `p'.
|
||||
-- require
|
||||
-- i_valid: i >=0
|
||||
-- external
|
||||
-- "C inline use <string.h>"
|
||||
-- alias
|
||||
-- "[
|
||||
-- return ((char **)$p)[$i];
|
||||
-- ]"
|
||||
-- end
|
||||
|
||||
feature -- FCGI connection
|
||||
|
||||
fcgi_listen: INTEGER
|
||||
-- Listen to the FCGI input stream
|
||||
-- Return 0 for successful calls, -1 otherwise.
|
||||
do
|
||||
Result := fcgi.accept
|
||||
end
|
||||
|
||||
-- update_eif_environ
|
||||
-- external
|
||||
-- "C inline use <string.h>"
|
||||
-- alias
|
||||
-- "[
|
||||
-- #ifdef EIF_WINDOWS
|
||||
-- #ifndef GetEnvironmentStringsA
|
||||
-- extern LPVOID WINAPI GetEnvironmentStringsA(void);
|
||||
-- #endif
|
||||
--
|
||||
-- eif_environ = (char**) GetEnvironmentStringsA();
|
||||
-- #endif
|
||||
-- ]"
|
||||
-- end
|
||||
|
||||
fcgi_finish
|
||||
-- Finish current request from HTTP server started from
|
||||
-- the most recent call to `fcgi_accept'.
|
||||
do
|
||||
fcgi.finish
|
||||
end
|
||||
|
||||
set_fcgi_exit_status (v: INTEGER)
|
||||
do
|
||||
fcgi.set_exit_status (-2)
|
||||
end
|
||||
|
||||
feature -- FCGI output
|
||||
|
||||
put_string (a_str: STRING)
|
||||
-- Put `a_str' on the FastCGI stdout.
|
||||
local
|
||||
l_c_str: C_STRING
|
||||
do
|
||||
l_c_str := c_buffer
|
||||
l_c_str.set_string (a_str)
|
||||
fcgi.put_string (l_c_str.item, l_c_str.count)
|
||||
end
|
||||
|
||||
feature -- FCGI input
|
||||
|
||||
copy_from_stdin (n: INTEGER; f: FILE)
|
||||
-- Read up to n bytes from stdin and write to given file
|
||||
local
|
||||
l_c_str: C_STRING
|
||||
num, readsize, writecount: INTEGER
|
||||
done: BOOLEAN
|
||||
l_fcgi: like fcgi
|
||||
do
|
||||
--put_trace ("copy_from_stdin, n=" +n.out)
|
||||
readsize := n.min (K_input_bufsize)
|
||||
--put_trace ("copy_from_stdin, readsize=" +readsize.out)
|
||||
l_c_str := c_buffer
|
||||
from
|
||||
l_fcgi := fcgi
|
||||
until done or writecount >= n
|
||||
loop
|
||||
num := l_fcgi.read_content_into (l_c_str.item, readsize)
|
||||
--put_trace ("copy_from_stdin, num=" +num.out)
|
||||
if num = 0 then
|
||||
-- EOF
|
||||
done := True
|
||||
else
|
||||
f.put_managed_pointer (c_buffer.managed_data, 0, num)
|
||||
writecount := writecount + num
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: FCGI Input
|
||||
|
||||
fill_pointer_from_stdin (p: POINTER; n: INTEGER): INTEGER
|
||||
-- Read up to `n' bytes from stdin and store in pointer `p'
|
||||
-- and return number of bytes read.
|
||||
do
|
||||
Result := fcgi.read_content_into (p, n)
|
||||
end
|
||||
|
||||
feature -- I/O Routines
|
||||
|
||||
--RFO read_stdin_into (a_str: STRING)
|
||||
--RFO -- Read a string from the `stdin' into `a_str'.
|
||||
--RFO require
|
||||
--RFO a_str_not_void: a_str /= Void
|
||||
--RFO local
|
||||
--RFO l_c_str: C_STRING
|
||||
--RFO n: INTEGER
|
||||
--RFO do
|
||||
--RFO l_c_str := c_buffer
|
||||
--RFO n := fcgi.read_content_into (l_c_str.item, l_c_str.capacity)
|
||||
--RFO a_str.set_count (n)
|
||||
--RFO l_c_str.read_substring_into (a_str, 1, n)
|
||||
--RFO end
|
||||
|
||||
--RFO read_string_into (a_str: STRING)
|
||||
--RFO require
|
||||
--RFO exists: a_str /= Void
|
||||
--RFO local
|
||||
--RFO l_c_str: C_STRING
|
||||
--RFO p: POINTER
|
||||
--RFO do
|
||||
--RFO create l_c_str.make_empty (1024)
|
||||
--RFO p := fcgi.gets (l_c_str.item)
|
||||
--RFO-- if p /= default_pointer and p = l_c_str.item then
|
||||
--RFO a_str.resize (l_c_str.count)
|
||||
--RFO l_c_str.read_string_into (a_str)
|
||||
--RFO-- else
|
||||
--RFO-- put_error_line ("Bad pointer from gets")
|
||||
--RFO-- end
|
||||
--RFO end
|
||||
|
||||
|
||||
--RFO read_line
|
||||
--RFO -- Read up to the next end of line, or end of input
|
||||
--RFO -- Leave result in last_string
|
||||
--RFO -- Newline character is absent from result
|
||||
--RFO do
|
||||
--RFO if last_string = Void then
|
||||
--RFO create Result.make (K_input_bufsize)
|
||||
--RFO else
|
||||
--RFO last_string.wipe_out
|
||||
--RFO end
|
||||
--RFO-- if input_filename /= Void then
|
||||
--RFO-- io.read_line
|
||||
--RFO-- last_string.append (io.last_string)
|
||||
--RFO-- else
|
||||
--RFO read_string_into (last_string)
|
||||
--RFO-- end
|
||||
--RFO end
|
||||
|
||||
|
||||
|
||||
feature {NONE} -- Implementation: environment
|
||||
|
||||
-- environ_strings_pointer (p_nb: TYPED_POINTER [INTEGER]): POINTER
|
||||
-- -- Environment variable strings returned by `GetEnvironmentStringsA'
|
||||
-- -- `p_nb' return the count of environment variables.
|
||||
-- external
|
||||
-- "C inline use <string.h>"
|
||||
-- alias
|
||||
-- "[
|
||||
-- #ifdef EIF_WINDOWS
|
||||
-- #ifndef GetEnvironmentStringsA
|
||||
-- extern LPVOID WINAPI GetEnvironmentStringsA(void);
|
||||
-- #endif
|
||||
--
|
||||
-- int cnt = 0;
|
||||
-- LPSTR vars = GetEnvironmentStringsA();
|
||||
-- char** p = (char**) vars;
|
||||
--
|
||||
-- for (; *vars; vars++) {
|
||||
-- while (*vars) { vars++; }
|
||||
-- cnt++;
|
||||
-- }
|
||||
--
|
||||
-- *$p_nb = cnt;
|
||||
-- return (EIF_POINTER) p;
|
||||
-- #endif
|
||||
-- ]"
|
||||
-- end
|
||||
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, 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
|
||||
26
library/server/libfcgi/interface/fcgi.e
Normal file
26
library/server/libfcgi/interface/fcgi.e
Normal file
@@ -0,0 +1,26 @@
|
||||
note
|
||||
description: "Interface to FCGI C library"
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class FCGI
|
||||
|
||||
inherit
|
||||
FCGI_IMP
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, 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
|
||||
236
library/server/libfcgi/interface/fcgi_i.e
Normal file
236
library/server/libfcgi/interface/fcgi_i.e
Normal file
@@ -0,0 +1,236 @@
|
||||
note
|
||||
description: "Abstract interface to FCGI C library"
|
||||
legal: "See notice at end of class."
|
||||
status: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class FCGI_I
|
||||
|
||||
inherit
|
||||
STRING_HANDLER
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize FCGI interface
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
updated_environ_variables: HASH_TABLE [STRING, STRING]
|
||||
local
|
||||
i: INTEGER
|
||||
p, v, null: POINTER
|
||||
do
|
||||
p := fcgi_environ
|
||||
create Result.make (50)
|
||||
if p /= null then
|
||||
from
|
||||
i := 0
|
||||
v := fcgi_i_th_environ (i,p)
|
||||
until
|
||||
v = null
|
||||
loop
|
||||
if attached separated_variables (create {STRING}.make_from_c (v)) as t then
|
||||
Result.force (t.value, t.key)
|
||||
end
|
||||
i := i + 1
|
||||
v := fcgi_i_th_environ (i,p)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- FCGI interface
|
||||
|
||||
fcgi_listen: INTEGER
|
||||
-- Listen to the FCGI input stream
|
||||
-- Return 0 for successful calls, -1 otherwise.
|
||||
deferred
|
||||
end
|
||||
|
||||
fcgi_environ: POINTER
|
||||
-- Get the (char**) environ variable from the DLL.
|
||||
deferred
|
||||
end
|
||||
|
||||
fcgi_finish
|
||||
-- Finish current request from HTTP server started from
|
||||
-- the most recent call to `fcgi_accept'.
|
||||
deferred
|
||||
end
|
||||
|
||||
set_fcgi_exit_status (v: INTEGER)
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Status
|
||||
|
||||
is_interactive: BOOLEAN
|
||||
-- Is execution interactive? (for debugging)
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Input
|
||||
|
||||
fill_string_from_stdin (s: STRING; n: INTEGER)
|
||||
-- Read up to `n' bytes from stdin and store in string `s'
|
||||
local
|
||||
new_count: INTEGER
|
||||
str_area: ANY
|
||||
do
|
||||
s.grow (n)
|
||||
str_area := s.area
|
||||
new_count := fill_pointer_from_stdin ($str_area, n)
|
||||
s.set_count (new_count)
|
||||
end
|
||||
|
||||
read_from_stdin (n: INTEGER)
|
||||
-- Read up to n bytes from stdin and store in input buffer
|
||||
require
|
||||
small_enough: n <= buffer_capacity
|
||||
local
|
||||
l_c_str: C_STRING
|
||||
l_count: INTEGER
|
||||
do
|
||||
last_read_is_empty_ref.set_item (False)
|
||||
l_c_str := c_buffer
|
||||
l_count := fill_pointer_from_stdin (l_c_str.item, n)
|
||||
last_read_count_ref.set_item (l_count)
|
||||
if l_count <= 0 then
|
||||
last_read_is_empty_ref.set_item (True)
|
||||
end
|
||||
end
|
||||
|
||||
fill_pointer_from_stdin (p: POINTER; n: INTEGER): INTEGER
|
||||
-- Read up to `n' bytes from stdin and store in pointer `p'
|
||||
-- and return number of bytes read.
|
||||
deferred
|
||||
end
|
||||
|
||||
copy_from_stdin (n: INTEGER; f: FILE)
|
||||
-- Read up to n bytes from stdin and write to given file
|
||||
require
|
||||
-- small_enough: n <= buffer_capacity
|
||||
file_exists: f /= Void
|
||||
file_open: f.is_open_write or f.is_open_append
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Output
|
||||
|
||||
put_string (a_str: STRING)
|
||||
-- Put `a_str' on the FastCGI stdout.
|
||||
require
|
||||
a_str_not_void: a_str /= Void
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Implementation
|
||||
|
||||
buffer_contents: STRING
|
||||
local
|
||||
n: like last_read_count
|
||||
do
|
||||
n := last_read_count
|
||||
create Result.make (n)
|
||||
Result.set_count (n)
|
||||
c_buffer.read_substring_into (Result, 1, n)
|
||||
end
|
||||
|
||||
buffer_capacity: INTEGER
|
||||
do
|
||||
Result := c_buffer.capacity
|
||||
end
|
||||
|
||||
--RFO last_string: STRING
|
||||
--RFO once
|
||||
--RFO create Result.make (K_input_bufsize)
|
||||
--RFO end
|
||||
|
||||
last_read_count: INTEGER
|
||||
do
|
||||
Result := last_read_count_ref.item
|
||||
end
|
||||
|
||||
last_read_is_empty: BOOLEAN
|
||||
do
|
||||
Result := last_read_is_empty_ref.item
|
||||
end
|
||||
|
||||
feature {NONE} -- Shared buffer
|
||||
|
||||
c_buffer: C_STRING
|
||||
-- Buffer for Eiffel to C and C to Eiffel string conversions.
|
||||
once
|
||||
create Result.make_empty (K_input_bufsize)
|
||||
ensure
|
||||
c_buffer_not_void: Result /= Void
|
||||
end
|
||||
|
||||
|
||||
feature {NONE} -- Constants
|
||||
|
||||
last_read_count_ref: INTEGER_REF
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
last_read_is_empty_ref: BOOLEAN_REF
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
K_input_bufsize: INTEGER = 1024_000
|
||||
|
||||
feature {NONE} -- Implementation: Environment
|
||||
|
||||
fcgi_i_th_environ (i: INTEGER; p: POINTER): POINTER
|
||||
-- Environment variable at `i'-th position of `p'.
|
||||
require
|
||||
i_valid: i >=0
|
||||
external
|
||||
"C inline use <string.h>"
|
||||
alias
|
||||
"return ((char **)$p)[$i];"
|
||||
end
|
||||
|
||||
separated_variables (a_var: STRING): detachable TUPLE [value: STRING; key: STRING]
|
||||
-- Given an environment variable `a_var' in form of "key=value",
|
||||
-- return separated key and value.
|
||||
-- Return Void if `a_var' is in incorrect format.
|
||||
require
|
||||
a_var_attached: a_var /= Void
|
||||
local
|
||||
i, j: INTEGER
|
||||
done: BOOLEAN
|
||||
do
|
||||
j := a_var.count
|
||||
from
|
||||
i := 1
|
||||
until
|
||||
i > j or done
|
||||
loop
|
||||
if a_var.item (i) = '=' then
|
||||
done := True
|
||||
else
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
if i > 1 and then i < j then
|
||||
Result := [a_var.substring (i + 1, j), a_var.substring (1, i - 1)]
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, 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
|
||||
52
library/server/libfcgi/libfcgi-safe.ecf
Normal file
52
library/server/libfcgi/libfcgi-safe.ecf
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-6-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-6-0 http://www.eiffel.com/developers/xml/configuration-1-6-0.xsd" name="libfcgi" uuid="3F4BCF74-3503-4533-9D74-5A65EC4CA3C4" library_target="libfcgi">
|
||||
<target name="libfcgi">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
</file_rule>
|
||||
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" >
|
||||
</option>
|
||||
<external_include location="$ECF_CONFIG_PATH/spec/include/libfcgi">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$ECF_CONFIG_PATH\spec\include\libfcgi">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_library location="$ECF_CONFIG_PATH\spec\lib\$ISE_PLATFORM\$ISE_C_COMPILER\libfcgi.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_library>
|
||||
<external_library location="/usr/local/lib/libfcgi.so">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_library>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<cluster name="interface" location="interface" recursive="true"/>
|
||||
<cluster name="implementation" location="implementation" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/linux$</exclude>
|
||||
<exclude>/fake$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/windows$</exclude>
|
||||
<exclude>/fake$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
</system>
|
||||
52
library/server/libfcgi/libfcgi.ecf
Normal file
52
library/server/libfcgi/libfcgi.ecf
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-6-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-6-0 http://www.eiffel.com/developers/xml/configuration-1-6-0.xsd" name="libfcgi" uuid="3F4BCF74-3503-4533-9D74-5A65EC4CA3C4" library_target="libfcgi">
|
||||
<target name="libfcgi">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
</file_rule>
|
||||
|
||||
<option warning="true" full_class_checking="true">
|
||||
</option>
|
||||
<external_include location="$ECF_CONFIG_PATH/spec/include/libfcgi">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$ECF_CONFIG_PATH\spec\include\libfcgi">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_library location="$ECF_CONFIG_PATH\spec\lib\$ISE_PLATFORM\$ISE_C_COMPILER\libfcgi.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_library>
|
||||
<external_library location="/usr/local/lib/libfcgi.so">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_library>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<cluster name="interface" location="interface" recursive="true"/>
|
||||
<cluster name="implementation" location="implementation" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/linux$</exclude>
|
||||
<exclude>/fake$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/windows$</exclude>
|
||||
<exclude>/fake$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
</system>
|
||||
1
library/server/libfcgi/license.lic
Normal file
1
library/server/libfcgi/license.lic
Normal file
@@ -0,0 +1 @@
|
||||
reference:forum2
|
||||
136
library/server/libfcgi/spec/include/libfcgi/fastcgi.h
Normal file
136
library/server/libfcgi/spec/include/libfcgi/fastcgi.h
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* fastcgi.h --
|
||||
*
|
||||
* Defines for the FastCGI protocol.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1995-1996 Open Market, Inc.
|
||||
*
|
||||
* See the file "LICENSE.TERMS" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
* $Id: fastcgi.h,v 1.1.1.1 1997/09/16 15:36:32 stanleyg Exp $
|
||||
*/
|
||||
|
||||
#ifndef _FASTCGI_H
|
||||
#define _FASTCGI_H
|
||||
|
||||
/*
|
||||
* Listening socket file number
|
||||
*/
|
||||
#define FCGI_LISTENSOCK_FILENO 0
|
||||
|
||||
typedef struct {
|
||||
unsigned char version;
|
||||
unsigned char type;
|
||||
unsigned char requestIdB1;
|
||||
unsigned char requestIdB0;
|
||||
unsigned char contentLengthB1;
|
||||
unsigned char contentLengthB0;
|
||||
unsigned char paddingLength;
|
||||
unsigned char reserved;
|
||||
} FCGI_Header;
|
||||
|
||||
#define FCGI_MAX_LENGTH 0xffff
|
||||
|
||||
/*
|
||||
* Number of bytes in a FCGI_Header. Future versions of the protocol
|
||||
* will not reduce this number.
|
||||
*/
|
||||
#define FCGI_HEADER_LEN 8
|
||||
|
||||
/*
|
||||
* Value for version component of FCGI_Header
|
||||
*/
|
||||
#define FCGI_VERSION_1 1
|
||||
|
||||
/*
|
||||
* Values for type component of FCGI_Header
|
||||
*/
|
||||
#define FCGI_BEGIN_REQUEST 1
|
||||
#define FCGI_ABORT_REQUEST 2
|
||||
#define FCGI_END_REQUEST 3
|
||||
#define FCGI_PARAMS 4
|
||||
#define FCGI_STDIN 5
|
||||
#define FCGI_STDOUT 6
|
||||
#define FCGI_STDERR 7
|
||||
#define FCGI_DATA 8
|
||||
#define FCGI_GET_VALUES 9
|
||||
#define FCGI_GET_VALUES_RESULT 10
|
||||
#define FCGI_UNKNOWN_TYPE 11
|
||||
#define FCGI_MAXTYPE (FCGI_UNKNOWN_TYPE)
|
||||
|
||||
/*
|
||||
* Value for requestId component of FCGI_Header
|
||||
*/
|
||||
#define FCGI_NULL_REQUEST_ID 0
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char roleB1;
|
||||
unsigned char roleB0;
|
||||
unsigned char flags;
|
||||
unsigned char reserved[5];
|
||||
} FCGI_BeginRequestBody;
|
||||
|
||||
typedef struct {
|
||||
FCGI_Header header;
|
||||
FCGI_BeginRequestBody body;
|
||||
} FCGI_BeginRequestRecord;
|
||||
|
||||
/*
|
||||
* Mask for flags component of FCGI_BeginRequestBody
|
||||
*/
|
||||
#define FCGI_KEEP_CONN 1
|
||||
|
||||
/*
|
||||
* Values for role component of FCGI_BeginRequestBody
|
||||
*/
|
||||
#define FCGI_RESPONDER 1
|
||||
#define FCGI_AUTHORIZER 2
|
||||
#define FCGI_FILTER 3
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char appStatusB3;
|
||||
unsigned char appStatusB2;
|
||||
unsigned char appStatusB1;
|
||||
unsigned char appStatusB0;
|
||||
unsigned char protocolStatus;
|
||||
unsigned char reserved[3];
|
||||
} FCGI_EndRequestBody;
|
||||
|
||||
typedef struct {
|
||||
FCGI_Header header;
|
||||
FCGI_EndRequestBody body;
|
||||
} FCGI_EndRequestRecord;
|
||||
|
||||
/*
|
||||
* Values for protocolStatus component of FCGI_EndRequestBody
|
||||
*/
|
||||
#define FCGI_REQUEST_COMPLETE 0
|
||||
#define FCGI_CANT_MPX_CONN 1
|
||||
#define FCGI_OVERLOADED 2
|
||||
#define FCGI_UNKNOWN_ROLE 3
|
||||
|
||||
|
||||
/*
|
||||
* Variable names for FCGI_GET_VALUES / FCGI_GET_VALUES_RESULT records
|
||||
*/
|
||||
#define FCGI_MAX_CONNS "FCGI_MAX_CONNS"
|
||||
#define FCGI_MAX_REQS "FCGI_MAX_REQS"
|
||||
#define FCGI_MPXS_CONNS "FCGI_MPXS_CONNS"
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char type;
|
||||
unsigned char reserved[7];
|
||||
} FCGI_UnknownTypeBody;
|
||||
|
||||
typedef struct {
|
||||
FCGI_Header header;
|
||||
FCGI_UnknownTypeBody body;
|
||||
} FCGI_UnknownTypeRecord;
|
||||
|
||||
#endif /* _FASTCGI_H */
|
||||
|
||||
39
library/server/libfcgi/spec/include/libfcgi/fcgi_config.h
Normal file
39
library/server/libfcgi/spec/include/libfcgi/fcgi_config.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copied to fcgi_config.h when building on WinNT without cygwin,
|
||||
* i.e. configure is not run. See fcgi_config.h.in for details.
|
||||
*/
|
||||
|
||||
#define HAVE_FPOS 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_STREAMBUF_CHAR_TYPE 1
|
||||
#define HAVE_STRERROR 1
|
||||
#undef HAVE_ARPA_INET_H
|
||||
#undef HAVE_DLFCN_H
|
||||
#undef HAVE_FILENO_PROTO
|
||||
#undef HAVE_INTTYPES_H
|
||||
#undef HAVE_IOSTREAM_WITHASSIGN_STREAMBUF
|
||||
#undef HAVE_LIBNSL
|
||||
#undef HAVE_LIBSOCKET
|
||||
#undef HAVE_MEMORY_H
|
||||
#undef HAVE_NETDB_H
|
||||
#undef HAVE_NETINET_IN_H
|
||||
#undef HAVE_PTHREAD
|
||||
#undef HAVE_SOCKADDR_UN_SUN_LEN
|
||||
#undef HAVE_SOCKLEN
|
||||
#undef HAVE_STDINT_H
|
||||
#undef HAVE_STDLIB_H
|
||||
#undef HAVE_STRING_H
|
||||
#undef HAVE_STRINGS_H
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
#undef HAVE_SYS_SOCKET_H
|
||||
#undef HAVE_SYS_STAT_H
|
||||
#undef HAVE_SYS_TIME_H
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
#undef HAVE_UNISTD_H
|
||||
#undef HAVE_VA_ARG_LONG_DOUBLE_BUG
|
||||
#undef PTHREAD_CREATE_JOINABLE
|
||||
#undef STDC_HEADERS
|
||||
#undef USE_LOCKING
|
||||
#undef const
|
||||
#undef inline
|
||||
#undef ssize_t
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copied to fcgi_config.h when building on WinNT without cygwin,
|
||||
* i.e. configure is not run. See fcgi_config.h.in for details.
|
||||
*/
|
||||
|
||||
#define HAVE_FPOS 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
#define HAVE_STREAMBUF_CHAR_TYPE 1
|
||||
#define HAVE_STRERROR 1
|
||||
#undef HAVE_ARPA_INET_H
|
||||
#undef HAVE_DLFCN_H
|
||||
#undef HAVE_FILENO_PROTO
|
||||
#undef HAVE_INTTYPES_H
|
||||
#undef HAVE_IOSTREAM_WITHASSIGN_STREAMBUF
|
||||
#undef HAVE_LIBNSL
|
||||
#undef HAVE_LIBSOCKET
|
||||
#undef HAVE_MEMORY_H
|
||||
#undef HAVE_NETDB_H
|
||||
#undef HAVE_NETINET_IN_H
|
||||
#undef HAVE_PTHREAD
|
||||
#undef HAVE_SOCKADDR_UN_SUN_LEN
|
||||
#undef HAVE_SOCKLEN
|
||||
#undef HAVE_STDINT_H
|
||||
#undef HAVE_STDLIB_H
|
||||
#undef HAVE_STRING_H
|
||||
#undef HAVE_STRINGS_H
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
#undef HAVE_SYS_SOCKET_H
|
||||
#undef HAVE_SYS_STAT_H
|
||||
#undef HAVE_SYS_TIME_H
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
#undef HAVE_UNISTD_H
|
||||
#undef HAVE_VA_ARG_LONG_DOUBLE_BUG
|
||||
#undef PTHREAD_CREATE_JOINABLE
|
||||
#undef STDC_HEADERS
|
||||
#undef USE_LOCKING
|
||||
#undef const
|
||||
#undef inline
|
||||
#undef ssize_t
|
||||
246
library/server/libfcgi/spec/include/libfcgi/fcgi_stdio.h
Normal file
246
library/server/libfcgi/spec/include/libfcgi/fcgi_stdio.h
Normal file
@@ -0,0 +1,246 @@
|
||||
/*
|
||||
* fcgi_stdio.h --
|
||||
*
|
||||
* FastCGI-stdio compatibility package
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1996 Open Market, Inc.
|
||||
*
|
||||
* See the file "LICENSE.TERMS" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
* $Id: fcgi_stdio.h,v 1.5 2001/06/22 13:21:15 robs Exp $
|
||||
*/
|
||||
|
||||
#ifndef _FCGI_STDIO
|
||||
#define _FCGI_STDIO 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "fcgiapp.h"
|
||||
|
||||
#if defined (c_plusplus) || defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef DLLAPI
|
||||
#ifdef _WIN32
|
||||
#define DLLAPI __declspec(dllimport)
|
||||
#else
|
||||
#define DLLAPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Wrapper type for FILE
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
FILE *stdio_stream;
|
||||
FCGX_Stream *fcgx_stream;
|
||||
} FCGI_FILE;
|
||||
|
||||
/*
|
||||
* The four new functions and two new macros
|
||||
*/
|
||||
|
||||
DLLAPI int FCGI_Accept(void);
|
||||
DLLAPI char** FCGI_Environ(void);
|
||||
DLLAPI void FCGI_Finish(void);
|
||||
DLLAPI int FCGI_StartFilterData(void);
|
||||
DLLAPI void FCGI_SetExitStatus(int status);
|
||||
|
||||
#define FCGI_ToFILE(fcgi_file) (fcgi_file->stdio_stream)
|
||||
#define FCGI_ToFcgiStream(fcgi_file) (fcgi_file->fcgx_stream)
|
||||
|
||||
/*
|
||||
* Wrapper stdin, stdout, and stderr variables, set up by FCGI_Accept()
|
||||
*/
|
||||
|
||||
DLLAPI extern FCGI_FILE _fcgi_sF[];
|
||||
#define FCGI_stdin (&_fcgi_sF[0])
|
||||
#define FCGI_stdout (&_fcgi_sF[1])
|
||||
#define FCGI_stderr (&_fcgi_sF[2])
|
||||
|
||||
/*
|
||||
* Wrapper function prototypes, grouped according to sections
|
||||
* of Harbison & Steele, "C: A Reference Manual," fourth edition,
|
||||
* Prentice-Hall, 1995.
|
||||
*/
|
||||
|
||||
DLLAPI void FCGI_perror(const char *str);
|
||||
|
||||
DLLAPI FCGI_FILE *FCGI_fopen(const char *path, const char *mode);
|
||||
DLLAPI int FCGI_fclose(FCGI_FILE *fp);
|
||||
DLLAPI int FCGI_fflush(FCGI_FILE *fp);
|
||||
DLLAPI FCGI_FILE *FCGI_freopen(const char *path, const char *mode, FCGI_FILE *fp);
|
||||
|
||||
DLLAPI int FCGI_setvbuf(FCGI_FILE *fp, char *buf, int bufmode, size_t size);
|
||||
DLLAPI void FCGI_setbuf(FCGI_FILE *fp, char *buf);
|
||||
|
||||
DLLAPI int FCGI_fseek(FCGI_FILE *fp, long offset, int whence);
|
||||
DLLAPI int FCGI_ftell(FCGI_FILE *fp);
|
||||
DLLAPI void FCGI_rewind(FCGI_FILE *fp);
|
||||
#ifdef HAVE_FPOS
|
||||
DLLAPI int FCGI_fgetpos(FCGI_FILE *fp, fpos_t *pos);
|
||||
DLLAPI int FCGI_fsetpos(FCGI_FILE *fp, const fpos_t *pos);
|
||||
#endif
|
||||
DLLAPI int FCGI_fgetc(FCGI_FILE *fp);
|
||||
DLLAPI int FCGI_getchar(void);
|
||||
DLLAPI int FCGI_ungetc(int c, FCGI_FILE *fp);
|
||||
|
||||
DLLAPI char *FCGI_fgets(char *str, int size, FCGI_FILE *fp);
|
||||
DLLAPI char *FCGI_gets(char *str);
|
||||
|
||||
/*
|
||||
* Not yet implemented
|
||||
*
|
||||
* int FCGI_fscanf(FCGI_FILE *fp, const char *format, ...);
|
||||
* int FCGI_scanf(const char *format, ...);
|
||||
*
|
||||
*/
|
||||
|
||||
DLLAPI int FCGI_fputc(int c, FCGI_FILE *fp);
|
||||
DLLAPI int FCGI_putchar(int c);
|
||||
|
||||
DLLAPI int FCGI_fputs(const char *str, FCGI_FILE *fp);
|
||||
DLLAPI int FCGI_puts(const char *str);
|
||||
|
||||
DLLAPI int FCGI_fprintf(FCGI_FILE *fp, const char *format, ...);
|
||||
DLLAPI int FCGI_printf(const char *format, ...);
|
||||
|
||||
DLLAPI int FCGI_vfprintf(FCGI_FILE *fp, const char *format, va_list ap);
|
||||
DLLAPI int FCGI_vprintf(const char *format, va_list ap);
|
||||
|
||||
DLLAPI size_t FCGI_fread(void *ptr, size_t size, size_t nmemb, FCGI_FILE *fp);
|
||||
DLLAPI size_t FCGI_fwrite(void *ptr, size_t size, size_t nmemb, FCGI_FILE *fp);
|
||||
|
||||
DLLAPI int FCGI_feof(FCGI_FILE *fp);
|
||||
DLLAPI int FCGI_ferror(FCGI_FILE *fp);
|
||||
DLLAPI void FCGI_clearerr(FCGI_FILE *fp);
|
||||
|
||||
DLLAPI FCGI_FILE *FCGI_tmpfile(void);
|
||||
|
||||
DLLAPI int FCGI_fileno(FCGI_FILE *fp);
|
||||
DLLAPI FCGI_FILE *FCGI_fdopen(int fd, const char *mode);
|
||||
DLLAPI FCGI_FILE *FCGI_popen(const char *cmd, const char *type);
|
||||
DLLAPI int FCGI_pclose(FCGI_FILE *);
|
||||
|
||||
/*
|
||||
* The remaining definitions are for application programs,
|
||||
* not for fcgi_stdio.c
|
||||
*/
|
||||
|
||||
#ifndef NO_FCGI_DEFINES
|
||||
|
||||
/*
|
||||
* Replace standard types, variables, and functions with FastCGI wrappers.
|
||||
* Use undef in case a macro is already defined.
|
||||
*/
|
||||
|
||||
#undef FILE
|
||||
#define FILE FCGI_FILE
|
||||
|
||||
#undef stdin
|
||||
#define stdin FCGI_stdin
|
||||
#undef stdout
|
||||
#define stdout FCGI_stdout
|
||||
#undef stderr
|
||||
#define stderr FCGI_stderr
|
||||
|
||||
#undef perror
|
||||
#define perror FCGI_perror
|
||||
|
||||
#undef fopen
|
||||
#define fopen FCGI_fopen
|
||||
#undef fclose
|
||||
#define fclose FCGI_fclose
|
||||
#undef fflush
|
||||
#define fflush FCGI_fflush
|
||||
#undef freopen
|
||||
#define freopen FCGI_freopen
|
||||
|
||||
#undef setvbuf
|
||||
#define setvbuf FCGI_setvbuf
|
||||
#undef setbuf
|
||||
#define setbuf FCGI_setbuf
|
||||
|
||||
#undef fseek
|
||||
#define fseek FCGI_fseek
|
||||
#undef ftell
|
||||
#define ftell FCGI_ftell
|
||||
#undef rewind
|
||||
#define rewind FCGI_rewind
|
||||
#undef fgetpos
|
||||
#define fgetpos FCGI_fgetpos
|
||||
#undef fsetpos
|
||||
#define fsetpos FCGI_fsetpos
|
||||
|
||||
#undef fgetc
|
||||
#define fgetc FCGI_fgetc
|
||||
#undef getc
|
||||
#define getc FCGI_fgetc
|
||||
#undef getchar
|
||||
#define getchar FCGI_getchar
|
||||
#undef ungetc
|
||||
#define ungetc FCGI_ungetc
|
||||
|
||||
#undef fgets
|
||||
#define fgets FCGI_fgets
|
||||
#undef gets
|
||||
#define gets FCGI_gets
|
||||
|
||||
#undef fputc
|
||||
#define fputc FCGI_fputc
|
||||
#undef putc
|
||||
#define putc FCGI_fputc
|
||||
#undef putchar
|
||||
#define putchar FCGI_putchar
|
||||
|
||||
#undef fputs
|
||||
#define fputs FCGI_fputs
|
||||
#undef puts
|
||||
#define puts FCGI_puts
|
||||
|
||||
#undef fprintf
|
||||
#define fprintf FCGI_fprintf
|
||||
#undef printf
|
||||
#define printf FCGI_printf
|
||||
|
||||
#undef vfprintf
|
||||
#define vfprintf FCGI_vfprintf
|
||||
#undef vprintf
|
||||
#define vprintf FCGI_vprintf
|
||||
|
||||
#undef fread
|
||||
#define fread FCGI_fread
|
||||
#undef fwrite
|
||||
#define fwrite FCGI_fwrite
|
||||
|
||||
#undef feof
|
||||
#define feof FCGI_feof
|
||||
#undef ferror
|
||||
#define ferror FCGI_ferror
|
||||
#undef clearerr
|
||||
#define clearerr FCGI_clearerr
|
||||
|
||||
#undef tmpfile
|
||||
#define tmpfile FCGI_tmpfile
|
||||
|
||||
#undef fileno
|
||||
#define fileno FCGI_fileno
|
||||
#undef fdopen
|
||||
#define fdopen FCGI_fdopen
|
||||
#undef popen
|
||||
#define popen FCGI_popen
|
||||
#undef pclose
|
||||
#define pclose FCGI_pclose
|
||||
|
||||
#endif /* NO_FCGI_DEFINES */
|
||||
|
||||
#if defined (__cplusplus) || defined (c_plusplus)
|
||||
} /* terminate extern "C" { */
|
||||
#endif
|
||||
|
||||
#endif /* _FCGI_STDIO */
|
||||
|
||||
622
library/server/libfcgi/spec/include/libfcgi/fcgiapp.h
Normal file
622
library/server/libfcgi/spec/include/libfcgi/fcgiapp.h
Normal file
@@ -0,0 +1,622 @@
|
||||
/*
|
||||
* fcgiapp.h --
|
||||
*
|
||||
* Definitions for FastCGI application server programs
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1996 Open Market, Inc.
|
||||
*
|
||||
* See the file "LICENSE.TERMS" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
* $Id: fcgiapp.h,v 1.12 2001/11/21 21:10:11 robs Exp $
|
||||
*/
|
||||
|
||||
#ifndef _FCGIAPP_H
|
||||
#define _FCGIAPP_H
|
||||
|
||||
/* Hack to see if we are building TCL - TCL needs varargs not stdarg */
|
||||
#ifndef TCL_LIBRARY
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#ifndef DLLAPI
|
||||
#ifdef _WIN32
|
||||
#define DLLAPI __declspec(dllimport)
|
||||
#else
|
||||
#define DLLAPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (c_plusplus) || defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Error codes. Assigned to avoid conflict with EOF and errno(2).
|
||||
*/
|
||||
#define FCGX_UNSUPPORTED_VERSION -2
|
||||
#define FCGX_PROTOCOL_ERROR -3
|
||||
#define FCGX_PARAMS_ERROR -4
|
||||
#define FCGX_CALL_SEQ_ERROR -5
|
||||
|
||||
/*
|
||||
* This structure defines the state of a FastCGI stream.
|
||||
* Streams are modeled after the FILE type defined in stdio.h.
|
||||
* (We wouldn't need our own if platform vendors provided a
|
||||
* standard way to subclass theirs.)
|
||||
* The state of a stream is private and should only be accessed
|
||||
* by the procedures defined below.
|
||||
*/
|
||||
typedef struct FCGX_Stream {
|
||||
unsigned char *rdNext; /* reader: first valid byte
|
||||
* writer: equals stop */
|
||||
unsigned char *wrNext; /* writer: first free byte
|
||||
* reader: equals stop */
|
||||
unsigned char *stop; /* reader: last valid byte + 1
|
||||
* writer: last free byte + 1 */
|
||||
unsigned char *stopUnget; /* reader: first byte of current buffer
|
||||
* fragment, for ungetc
|
||||
* writer: undefined */
|
||||
int isReader;
|
||||
int isClosed;
|
||||
int wasFCloseCalled;
|
||||
int FCGI_errno; /* error status */
|
||||
void (*fillBuffProc) (struct FCGX_Stream *stream);
|
||||
void (*emptyBuffProc) (struct FCGX_Stream *stream, int doClose);
|
||||
void *data;
|
||||
} FCGX_Stream;
|
||||
|
||||
/*
|
||||
* An environment (as defined by environ(7)): A NULL-terminated array
|
||||
* of strings, each string having the form name=value.
|
||||
*/
|
||||
typedef char **FCGX_ParamArray;
|
||||
|
||||
/*
|
||||
* FCGX_Request Flags
|
||||
*
|
||||
* Setting FCGI_FAIL_ACCEPT_ON_INTR prevents FCGX_Accept() from
|
||||
* restarting upon being interrupted.
|
||||
*/
|
||||
#define FCGI_FAIL_ACCEPT_ON_INTR 1
|
||||
|
||||
/*
|
||||
* FCGX_Request -- State associated with a request.
|
||||
*
|
||||
* Its exposed for API simplicity, I expect parts of it to change!
|
||||
*/
|
||||
typedef struct FCGX_Request {
|
||||
int requestId; /* valid if isBeginProcessed */
|
||||
int role;
|
||||
FCGX_Stream *in;
|
||||
FCGX_Stream *out;
|
||||
FCGX_Stream *err;
|
||||
char **envp;
|
||||
|
||||
/* Don't use anything below here */
|
||||
|
||||
struct Params *paramsPtr;
|
||||
int ipcFd; /* < 0 means no connection */
|
||||
int isBeginProcessed; /* FCGI_BEGIN_REQUEST seen */
|
||||
int keepConnection; /* don't close ipcFd at end of request */
|
||||
int appStatus;
|
||||
int nWriters; /* number of open writers (0..2) */
|
||||
int flags;
|
||||
int listen_sock;
|
||||
} FCGX_Request;
|
||||
|
||||
|
||||
/*
|
||||
*======================================================================
|
||||
* Control
|
||||
*======================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_IsCGI --
|
||||
*
|
||||
* Returns TRUE iff this process appears to be a CGI process
|
||||
* rather than a FastCGI process.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_IsCGI(void);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_Init --
|
||||
*
|
||||
* Initialize the FCGX library. Call in multi-threaded apps
|
||||
* before calling FCGX_Accept_r().
|
||||
*
|
||||
* Returns 0 upon success.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_Init(void);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_OpenSocket --
|
||||
*
|
||||
* Create a FastCGI listen socket.
|
||||
*
|
||||
* path is the Unix domain socket (named pipe for WinNT), or a colon
|
||||
* followed by a port number. e.g. "/tmp/fastcgi/mysocket", ":5000"
|
||||
*
|
||||
* backlog is the listen queue depth used in the listen() call.
|
||||
*
|
||||
* Returns the socket's file descriptor or -1 on error.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_OpenSocket(const char *path, int backlog);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_InitRequest --
|
||||
*
|
||||
* Initialize a FCGX_Request for use with FCGX_Accept_r().
|
||||
*
|
||||
* sock is a file descriptor returned by FCGX_OpenSocket() or 0 (default).
|
||||
* The only supported flag at this time is FCGI_FAIL_ON_INTR.
|
||||
*
|
||||
* Returns 0 upon success.
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_InitRequest(FCGX_Request *request, int sock, int flags);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_Accept_r --
|
||||
*
|
||||
* Accept a new request (multi-thread safe). Be sure to call
|
||||
* FCGX_Init() first.
|
||||
*
|
||||
* Results:
|
||||
* 0 for successful call, -1 for error.
|
||||
*
|
||||
* Side effects:
|
||||
*
|
||||
* Finishes the request accepted by (and frees any
|
||||
* storage allocated by) the previous call to FCGX_Accept.
|
||||
* Creates input, output, and error streams and
|
||||
* assigns them to *in, *out, and *err respectively.
|
||||
* Creates a parameters data structure to be accessed
|
||||
* via getenv(3) (if assigned to environ) or by FCGX_GetParam
|
||||
* and assigns it to *envp.
|
||||
*
|
||||
* DO NOT retain pointers to the envp array or any strings
|
||||
* contained in it (e.g. to the result of calling FCGX_GetParam),
|
||||
* since these will be freed by the next call to FCGX_Finish
|
||||
* or FCGX_Accept.
|
||||
*
|
||||
* DON'T use the FCGX_Request, its structure WILL change.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_Accept_r(FCGX_Request *request);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_Finish_r --
|
||||
*
|
||||
* Finish the request (multi-thread safe).
|
||||
*
|
||||
* Side effects:
|
||||
*
|
||||
* Finishes the request accepted by (and frees any
|
||||
* storage allocated by) the previous call to FCGX_Accept.
|
||||
*
|
||||
* DO NOT retain pointers to the envp array or any strings
|
||||
* contained in it (e.g. to the result of calling FCGX_GetParam),
|
||||
* since these will be freed by the next call to FCGX_Finish
|
||||
* or FCGX_Accept.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI void FCGX_Finish_r(FCGX_Request *request);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_Free --
|
||||
*
|
||||
* Free the memory and, if close is true,
|
||||
* IPC FD associated with the request (multi-thread safe).
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI void FCGX_Free(FCGX_Request * request, int close);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_Accept --
|
||||
*
|
||||
* Accept a new request (NOT multi-thread safe).
|
||||
*
|
||||
* Results:
|
||||
* 0 for successful call, -1 for error.
|
||||
*
|
||||
* Side effects:
|
||||
*
|
||||
* Finishes the request accepted by (and frees any
|
||||
* storage allocated by) the previous call to FCGX_Accept.
|
||||
* Creates input, output, and error streams and
|
||||
* assigns them to *in, *out, and *err respectively.
|
||||
* Creates a parameters data structure to be accessed
|
||||
* via getenv(3) (if assigned to environ) or by FCGX_GetParam
|
||||
* and assigns it to *envp.
|
||||
*
|
||||
* DO NOT retain pointers to the envp array or any strings
|
||||
* contained in it (e.g. to the result of calling FCGX_GetParam),
|
||||
* since these will be freed by the next call to FCGX_Finish
|
||||
* or FCGX_Accept.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_Accept(
|
||||
FCGX_Stream **in,
|
||||
FCGX_Stream **out,
|
||||
FCGX_Stream **err,
|
||||
FCGX_ParamArray *envp);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_Finish --
|
||||
*
|
||||
* Finish the current request (NOT multi-thread safe).
|
||||
*
|
||||
* Side effects:
|
||||
*
|
||||
* Finishes the request accepted by (and frees any
|
||||
* storage allocated by) the previous call to FCGX_Accept.
|
||||
*
|
||||
* DO NOT retain pointers to the envp array or any strings
|
||||
* contained in it (e.g. to the result of calling FCGX_GetParam),
|
||||
* since these will be freed by the next call to FCGX_Finish
|
||||
* or FCGX_Accept.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI void FCGX_Finish(void);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_StartFilterData --
|
||||
*
|
||||
* stream is an input stream for a FCGI_FILTER request.
|
||||
* stream is positioned at EOF on FCGI_STDIN.
|
||||
* Repositions stream to the start of FCGI_DATA.
|
||||
* If the preconditions are not met (e.g. FCGI_STDIN has not
|
||||
* been read to EOF) sets the stream error code to
|
||||
* FCGX_CALL_SEQ_ERROR.
|
||||
*
|
||||
* Results:
|
||||
* 0 for a normal return, < 0 for error
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_StartFilterData(FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_SetExitStatus --
|
||||
*
|
||||
* Sets the exit status for stream's request. The exit status
|
||||
* is the status code the request would have exited with, had
|
||||
* the request been run as a CGI program. You can call
|
||||
* SetExitStatus several times during a request; the last call
|
||||
* before the request ends determines the value.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI void FCGX_SetExitStatus(int status, FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*======================================================================
|
||||
* Parameters
|
||||
*======================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_GetParam -- obtain value of FCGI parameter in environment
|
||||
*
|
||||
*
|
||||
* Results:
|
||||
* Value bound to name, NULL if name not present in the
|
||||
* environment envp. Caller must not mutate the result
|
||||
* or retain it past the end of this request.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI char *FCGX_GetParam(const char *name, FCGX_ParamArray envp);
|
||||
|
||||
/*
|
||||
*======================================================================
|
||||
* Readers
|
||||
*======================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_GetChar --
|
||||
*
|
||||
* Reads a byte from the input stream and returns it.
|
||||
*
|
||||
* Results:
|
||||
* The byte, or EOF (-1) if the end of input has been reached.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_GetChar(FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_UnGetChar --
|
||||
*
|
||||
* Pushes back the character c onto the input stream. One
|
||||
* character of pushback is guaranteed once a character
|
||||
* has been read. No pushback is possible for EOF.
|
||||
*
|
||||
* Results:
|
||||
* Returns c if the pushback succeeded, EOF if not.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_UnGetChar(int c, FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_GetStr --
|
||||
*
|
||||
* Reads up to n consecutive bytes from the input stream
|
||||
* into the character array str. Performs no interpretation
|
||||
* of the input bytes.
|
||||
*
|
||||
* Results:
|
||||
* Number of bytes read. If result is smaller than n,
|
||||
* the end of input has been reached.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_GetStr(char *str, int n, FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_GetLine --
|
||||
*
|
||||
* Reads up to n-1 consecutive bytes from the input stream
|
||||
* into the character array str. Stops before n-1 bytes
|
||||
* have been read if '\n' or EOF is read. The terminating '\n'
|
||||
* is copied to str. After copying the last byte into str,
|
||||
* stores a '\0' terminator.
|
||||
*
|
||||
* Results:
|
||||
* NULL if EOF is the first thing read from the input stream,
|
||||
* str otherwise.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI char *FCGX_GetLine(char *str, int n, FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_HasSeenEOF --
|
||||
*
|
||||
* Returns EOF if end-of-file has been detected while reading
|
||||
* from stream; otherwise returns 0.
|
||||
*
|
||||
* Note that FCGX_HasSeenEOF(s) may return 0, yet an immediately
|
||||
* following FCGX_GetChar(s) may return EOF. This function, like
|
||||
* the standard C stdio function feof, does not provide the
|
||||
* ability to peek ahead.
|
||||
*
|
||||
* Results:
|
||||
* EOF if end-of-file has been detected, 0 if not.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
DLLAPI int FCGX_HasSeenEOF(FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*======================================================================
|
||||
* Writers
|
||||
*======================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_PutChar --
|
||||
*
|
||||
* Writes a byte to the output stream.
|
||||
*
|
||||
* Results:
|
||||
* The byte, or EOF (-1) if an error occurred.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_PutChar(int c, FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_PutStr --
|
||||
*
|
||||
* Writes n consecutive bytes from the character array str
|
||||
* into the output stream. Performs no interpretation
|
||||
* of the output bytes.
|
||||
*
|
||||
* Results:
|
||||
* Number of bytes written (n) for normal return,
|
||||
* EOF (-1) if an error occurred.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_PutStr(const char *str, int n, FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_PutS --
|
||||
*
|
||||
* Writes a null-terminated character string to the output stream.
|
||||
*
|
||||
* Results:
|
||||
* number of bytes written for normal return,
|
||||
* EOF (-1) if an error occurred.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_PutS(const char *str, FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_FPrintF, FCGX_VFPrintF --
|
||||
*
|
||||
* Performs printf-style output formatting and writes the results
|
||||
* to the output stream.
|
||||
*
|
||||
* Results:
|
||||
* number of bytes written for normal return,
|
||||
* EOF (-1) if an error occurred.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_FPrintF(FCGX_Stream *stream, const char *format, ...);
|
||||
|
||||
DLLAPI int FCGX_VFPrintF(FCGX_Stream *stream, const char *format, va_list arg);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_FFlush --
|
||||
*
|
||||
* Flushes any buffered output.
|
||||
*
|
||||
* Server-push is a legitimate application of FCGX_FFlush.
|
||||
* Otherwise, FCGX_FFlush is not very useful, since FCGX_Accept
|
||||
* does it implicitly. Calling FCGX_FFlush in non-push applications
|
||||
* results in extra writes and therefore reduces performance.
|
||||
*
|
||||
* Results:
|
||||
* EOF (-1) if an error occurred.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_FFlush(FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*======================================================================
|
||||
* Both Readers and Writers
|
||||
*======================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_FClose --
|
||||
*
|
||||
* Closes the stream. For writers, flushes any buffered
|
||||
* output.
|
||||
*
|
||||
* Close is not a very useful operation since FCGX_Accept
|
||||
* does it implicitly. Closing the out stream before the
|
||||
* err stream results in an extra write if there's nothing
|
||||
* in the err stream, and therefore reduces performance.
|
||||
*
|
||||
* Results:
|
||||
* EOF (-1) if an error occurred.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_FClose(FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_GetError --
|
||||
*
|
||||
* Return the stream error code. 0 means no error, > 0
|
||||
* is an errno(2) error, < 0 is an FastCGI error.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI int FCGX_GetError(FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_ClearError --
|
||||
*
|
||||
* Clear the stream error code and end-of-file indication.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI void FCGX_ClearError(FCGX_Stream *stream);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_CreateWriter --
|
||||
*
|
||||
* Create a FCGX_Stream (used by cgi-fcgi). This shouldn't
|
||||
* be needed by a FastCGI applictaion.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI FCGX_Stream *FCGX_CreateWriter(
|
||||
int socket,
|
||||
int requestId,
|
||||
int bufflen,
|
||||
int streamType);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* FCGX_FreeStream --
|
||||
*
|
||||
* Free a FCGX_Stream (used by cgi-fcgi). This shouldn't
|
||||
* be needed by a FastCGI applictaion.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI void FCGX_FreeStream(FCGX_Stream **stream);
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
*
|
||||
* Prevent the lib from accepting any new requests. Signal handler safe.
|
||||
*
|
||||
* ----------------------------------------------------------------------
|
||||
*/
|
||||
DLLAPI void FCGX_ShutdownPending(void);
|
||||
|
||||
#if defined (__cplusplus) || defined (c_plusplus)
|
||||
} /* terminate extern "C" { */
|
||||
#endif
|
||||
|
||||
#endif /* _FCGIAPP_H */
|
||||
38
library/server/libfcgi/spec/include/libfcgi/fcgimisc.h
Normal file
38
library/server/libfcgi/spec/include/libfcgi/fcgimisc.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* fcgimisc.h --
|
||||
*
|
||||
* Miscellaneous definitions
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1996 Open Market, Inc.
|
||||
*
|
||||
* See the file "LICENSE.TERMS" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
* $Id: fcgimisc.h,v 1.3 2001/06/18 14:25:47 robs Exp $
|
||||
*/
|
||||
|
||||
#ifndef _FCGIMISC_H
|
||||
#define _FCGIMISC_H
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE (0)
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE (1)
|
||||
#endif
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef max
|
||||
#define max(a,b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(assertion) assert(assertion)
|
||||
#endif
|
||||
|
||||
#endif /* _FCGIMISC_H */
|
||||
151
library/server/libfcgi/spec/include/libfcgi/fcgio.h
Normal file
151
library/server/libfcgi/spec/include/libfcgi/fcgio.h
Normal file
@@ -0,0 +1,151 @@
|
||||
//
|
||||
// Provides support for FastCGI via C++ iostreams.
|
||||
//
|
||||
// $Id: fcgio.h,v 1.15 2002/02/25 13:16:11 robs Exp $
|
||||
//
|
||||
// This work is based on routines written by George Feinberg. They
|
||||
// have been mostly re-written and extensively changed by
|
||||
// Michael Richards.
|
||||
//
|
||||
// Rewritten again with bug fixes and numerous enhancements by
|
||||
// Michael Shell.
|
||||
//
|
||||
// And rewritten again by Rob Saccoccio.
|
||||
//
|
||||
// Special Thanks to Dietmar Kuehl for his help and the numerous custom
|
||||
// streambuf examples on his web site.
|
||||
//
|
||||
// Copyright (c) 2000 Tux the Linux Penguin
|
||||
// Copyright (c) 2001 Rob Saccoccio and Chelsea Networks
|
||||
//
|
||||
// You are free to use this software without charge or royalty
|
||||
// as long as this notice is not removed or altered, and recognition
|
||||
// is given to the author(s)
|
||||
//
|
||||
// This code is offered as-is without any warranty either expressed or
|
||||
// implied; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. If it breaks, you get to keep
|
||||
// both halves.
|
||||
|
||||
#ifndef FCGIO_H
|
||||
#define FCGIO_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "fcgiapp.h"
|
||||
|
||||
#ifndef DLLAPI
|
||||
#ifdef _WIN32
|
||||
#define DLLAPI __declspec(dllimport)
|
||||
#else
|
||||
#define DLLAPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ! HAVE_STREAMBUF_CHAR_TYPE
|
||||
typedef char char_type;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* fcgi_streambuf
|
||||
*/
|
||||
class DLLAPI fcgi_streambuf : public std::streambuf
|
||||
{
|
||||
public:
|
||||
|
||||
// Note that if no buf is assigned (the default), iostream methods
|
||||
// such as peek(), unget() and putback() will fail. If a buf is
|
||||
// assigned, I/O is a bit less effecient and output streams will
|
||||
// have to be flushed (or the streambuf destroyed) before the next
|
||||
// call to "accept".
|
||||
fcgi_streambuf(FCGX_Stream * fcgx, char * buf, int len);
|
||||
|
||||
fcgi_streambuf(char_type * buf, std::streamsize len);
|
||||
|
||||
fcgi_streambuf(FCGX_Stream * fcgx = 0);
|
||||
|
||||
~fcgi_streambuf(void);
|
||||
|
||||
int attach(FCGX_Stream * fcgx);
|
||||
|
||||
protected:
|
||||
|
||||
// Consume the put area (if buffered) and c (if c is not EOF).
|
||||
virtual int overflow(int);
|
||||
|
||||
// Flush the put area (if buffered) and the FCGX buffer to the client.
|
||||
virtual int sync();
|
||||
|
||||
// Remove and return the current character.
|
||||
virtual int uflow();
|
||||
|
||||
// Fill the get area (if buffered) and return the current character.
|
||||
virtual int underflow();
|
||||
|
||||
// Use a buffer. The only reasons that a buffer would be useful is
|
||||
// to support the use of the unget()/putback() or seek() methods. Using
|
||||
// a buffer will result in less efficient I/O. Note: the underlying
|
||||
// FastCGI library (FCGX) maintains its own input and output buffers.
|
||||
virtual std::streambuf * setbuf(char_type * buf, std::streamsize len);
|
||||
|
||||
virtual std::streamsize xsgetn(char_type * s, std::streamsize n);
|
||||
virtual std::streamsize xsputn(const char_type * s, std::streamsize n);
|
||||
|
||||
private:
|
||||
|
||||
FCGX_Stream * fcgx;
|
||||
|
||||
// buf is just handy to have around
|
||||
char_type * buf;
|
||||
|
||||
// this isn't kept by the base class
|
||||
std::streamsize bufsize;
|
||||
|
||||
void init(FCGX_Stream * fcgx, char_type * buf, std::streamsize bufsize);
|
||||
|
||||
void reset(void);
|
||||
};
|
||||
|
||||
/*
|
||||
* fcgi_istream - deprecated
|
||||
*/
|
||||
class DLLAPI fcgi_istream : public std::istream
|
||||
{
|
||||
public:
|
||||
|
||||
// deprecated
|
||||
fcgi_istream(FCGX_Stream * fcgx = 0);
|
||||
|
||||
// deprecated
|
||||
~fcgi_istream(void) {}
|
||||
|
||||
// deprecated
|
||||
virtual void attach(FCGX_Stream * fcgx);
|
||||
|
||||
private:
|
||||
|
||||
fcgi_streambuf fcgi_strmbuf;
|
||||
};
|
||||
|
||||
/*
|
||||
* fcgi_ostream - deprecated
|
||||
*/
|
||||
class DLLAPI fcgi_ostream : public std::ostream
|
||||
{
|
||||
public:
|
||||
|
||||
// deprecated
|
||||
fcgi_ostream(FCGX_Stream * fcgx = 0);
|
||||
|
||||
// deprecated
|
||||
~fcgi_ostream(void) {}
|
||||
|
||||
// deprecated
|
||||
virtual void attach(FCGX_Stream *fcgx);
|
||||
|
||||
private:
|
||||
|
||||
fcgi_streambuf fcgi_strmbuf;
|
||||
};
|
||||
|
||||
#endif /* FCGIO_H */
|
||||
130
library/server/libfcgi/spec/include/libfcgi/fcgios.h
Normal file
130
library/server/libfcgi/spec/include/libfcgi/fcgios.h
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* fcgios.h --
|
||||
*
|
||||
* Description of file.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1996 Open Market, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file contains proprietary and confidential information and
|
||||
* remains the unpublished property of Open Market, Inc. Use,
|
||||
* disclosure, or reproduction is prohibited except as permitted by
|
||||
* express written license agreement with Open Market, Inc.
|
||||
*
|
||||
* Bill Snapper
|
||||
* snapper@openmarket.com
|
||||
*/
|
||||
#ifndef _FCGIOS_H
|
||||
#define _FCGIOS_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#include "fcgi_config.h"
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if defined (c_plusplus) || defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define OS_Errno GetLastError()
|
||||
#define OS_SetErrno(err) SetLastError(err)
|
||||
#ifndef O_NONBLOCK
|
||||
#define O_NONBLOCK 0x0004 /* no delay */
|
||||
#endif
|
||||
#else /* !_WIN32 */
|
||||
#define OS_Errno errno
|
||||
#define OS_SetErrno(err) errno = (err)
|
||||
#endif /* !_WIN32 */
|
||||
|
||||
#ifndef DLLAPI
|
||||
#ifdef _WIN32
|
||||
#define DLLAPI __declspec(dllimport)
|
||||
#else
|
||||
#define DLLAPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* This is the initializer for a "struct timeval" used in a select() call
|
||||
* right after a new request is accept()ed to determine readablity. Its
|
||||
* a drop-dead timer. Its only used for AF_UNIX sockets (not TCP sockets).
|
||||
* Its a workaround for a kernel bug in Linux 2.0.x and SCO Unixware.
|
||||
* Making this as small as possible, yet remain reliable would be best.
|
||||
* 2 seconds is very conservative. 0,0 is not reliable. The shorter the
|
||||
* timeout, the faster request processing will recover. The longer the
|
||||
* timeout, the more likely this application being "busy" will cause other
|
||||
* requests to abort and cause more dead sockets that need this timeout. */
|
||||
#define READABLE_UNIX_FD_DROP_DEAD_TIMEVAL 2,0
|
||||
|
||||
#ifndef STDIN_FILENO
|
||||
#define STDIN_FILENO 0
|
||||
#endif
|
||||
|
||||
#ifndef STDOUT_FILENO
|
||||
#define STDOUT_FILENO 1
|
||||
#endif
|
||||
|
||||
#ifndef STDERR_FILENO
|
||||
#define STDERR_FILENO 2
|
||||
#endif
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN 1024
|
||||
#endif
|
||||
|
||||
#ifndef X_OK
|
||||
#define X_OK 0x01
|
||||
#endif
|
||||
|
||||
#ifndef _CLIENTDATA
|
||||
# if defined(__STDC__) || defined(__cplusplus)
|
||||
typedef void *ClientData;
|
||||
# else
|
||||
typedef int *ClientData;
|
||||
# endif /* __STDC__ */
|
||||
#define _CLIENTDATA
|
||||
#endif
|
||||
|
||||
typedef void (*OS_AsyncProc) (ClientData clientData, int len);
|
||||
|
||||
DLLAPI int OS_LibInit(int stdioFds[3]);
|
||||
DLLAPI void OS_LibShutdown(void);
|
||||
DLLAPI int OS_CreateLocalIpcFd(const char *bindPath, int backlog);
|
||||
DLLAPI int OS_FcgiConnect(char *bindPath);
|
||||
DLLAPI int OS_Read(int fd, char * buf, size_t len);
|
||||
DLLAPI int OS_Write(int fd, char * buf, size_t len);
|
||||
DLLAPI int OS_SpawnChild(char *execPath, int listenFd);
|
||||
DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr,
|
||||
ClientData clientData);
|
||||
DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len,
|
||||
OS_AsyncProc procPtr, ClientData clientData);
|
||||
DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len,
|
||||
OS_AsyncProc procPtr, ClientData clientData);
|
||||
DLLAPI int OS_Close(int fd);
|
||||
DLLAPI int OS_CloseRead(int fd);
|
||||
DLLAPI int OS_DoIo(struct timeval *tmo);
|
||||
DLLAPI int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs);
|
||||
DLLAPI int OS_IpcClose(int ipcFd);
|
||||
DLLAPI int OS_IsFcgi(int sock);
|
||||
DLLAPI void OS_SetFlags(int fd, int flags);
|
||||
|
||||
DLLAPI void OS_ShutdownPending(void);
|
||||
|
||||
#if defined (__cplusplus) || defined (c_plusplus)
|
||||
} /* terminate extern "C" { */
|
||||
#endif
|
||||
|
||||
#endif /* _FCGIOS_H */
|
||||
BIN
library/server/libfcgi/spec/lib/win64/msc/libfcgi.dll
Normal file
BIN
library/server/libfcgi/spec/lib/win64/msc/libfcgi.dll
Normal file
Binary file not shown.
BIN
library/server/libfcgi/spec/lib/win64/msc/libfcgi.lib
Normal file
BIN
library/server/libfcgi/spec/lib/win64/msc/libfcgi.lib
Normal file
Binary file not shown.
BIN
library/server/libfcgi/spec/lib/windows/msc/libfcgi.dll
Normal file
BIN
library/server/libfcgi/spec/lib/windows/msc/libfcgi.dll
Normal file
Binary file not shown.
BIN
library/server/libfcgi/spec/lib/windows/msc/libfcgi.lib
Normal file
BIN
library/server/libfcgi/spec/lib/windows/msc/libfcgi.lib
Normal file
Binary file not shown.
64
library/server/libfcgi/tests/apache2.conf
Normal file
64
library/server/libfcgi/tests/apache2.conf
Normal file
@@ -0,0 +1,64 @@
|
||||
<VirtualHost *:80>
|
||||
ServerAdmin webmaster@localhost
|
||||
|
||||
DocumentRoot /var/www
|
||||
<Directory />
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
</Directory>
|
||||
<Directory /var/www/>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride None
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
|
||||
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
|
||||
<Directory "/usr/lib/cgi-bin">
|
||||
AllowOverride None
|
||||
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Directory>
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit,
|
||||
# alert, emerg.
|
||||
LogLevel warn
|
||||
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
Alias /doc/ "/usr/share/doc/"
|
||||
<Directory "/usr/share/doc/">
|
||||
Options Indexes MultiViews FollowSymLinks
|
||||
AllowOverride None
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
Allow from 127.0.0.0/255.0.0.0 ::1/128
|
||||
</Directory>
|
||||
|
||||
<IfModule mod_fcgid.c>
|
||||
# FcgidIdleTimeout 600
|
||||
# FcgidBusyScanInterval 120
|
||||
# FcgidProcessLifeTime 0
|
||||
# #7200
|
||||
# FcgidMaxProcesses 1000
|
||||
# FcgidMaxProcessesPerClass 100
|
||||
# FcgidMinProcessesPerClass 100
|
||||
# FcgidConnectTimeout 8
|
||||
# FcgidIOTimeout 60
|
||||
# FcgidBusyTimeout 1200
|
||||
|
||||
alias /eiffelweb/ "/home/jfiat/_dev/EiffelWebReloaded/library/fcgi/tests/EIFGENs/eiffelweb/W_code/"
|
||||
<Location /eiffelweb/>
|
||||
AddHandler fcgid-script .ews
|
||||
Options Indexes FollowSymLinks ExecCGI
|
||||
# Customize the next two directives for your requirements.
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
|
||||
</Location>
|
||||
</IfModule>
|
||||
|
||||
</VirtualHost>
|
||||
80
library/server/libfcgi/tests/application_root.e
Normal file
80
library/server/libfcgi/tests/application_root.e
Normal file
@@ -0,0 +1,80 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
class
|
||||
APPLICATION_ROOT
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize `Current'.
|
||||
local
|
||||
res: INTEGER
|
||||
nb: INTEGER
|
||||
do
|
||||
initialize
|
||||
from
|
||||
res := fcgi.fcgi_listen
|
||||
until
|
||||
res < 0
|
||||
loop
|
||||
nb := nb + 1
|
||||
fcgi.put_string (header ("FCGI Eiffel Application"))
|
||||
|
||||
fcgi.put_string ("<h1>Hello FCGI Eiffel Application</h1>%N")
|
||||
fcgi.put_string ("Request number " + nb.out + "<br/>%N")
|
||||
|
||||
fcgi.put_string ("<ul>Environment variables%N")
|
||||
print_environment_variables (fcgi.updated_environ_variables)
|
||||
fcgi.put_string ("</ul>")
|
||||
fcgi.put_string (footer)
|
||||
|
||||
res := fcgi.fcgi_listen
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
header (a_title: STRING): STRING
|
||||
do
|
||||
Result := "Content-type: text/html%R%N"
|
||||
Result.append ("%R%N")
|
||||
Result.append ("<html>%N")
|
||||
Result.append ("<head><title>" + a_title + "</title></head>")
|
||||
Result.append ("<body>%N")
|
||||
end
|
||||
|
||||
footer: STRING
|
||||
do
|
||||
Result := "</body>%N</html>%N"
|
||||
end
|
||||
|
||||
print_environment_variables (vars: HASH_TABLE [STRING, STRING])
|
||||
local
|
||||
do
|
||||
from
|
||||
vars.start
|
||||
until
|
||||
vars.after
|
||||
loop
|
||||
fcgi.put_string ("<li><strong>" + vars.key_for_iteration + "</strong> = " + vars.item_for_iteration + "</li>%N")
|
||||
vars.forth
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
initialize
|
||||
do
|
||||
create fcgi.make
|
||||
end
|
||||
|
||||
fcgi: FCGI
|
||||
|
||||
end
|
||||
16
library/server/libfcgi/tests/eiffelweb.ecf
Normal file
16
library/server/libfcgi/tests/eiffelweb.ecf
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="eiffelweb" uuid="6A03BC65-BD03-4B68-B51E-2543F9471D42">
|
||||
<target name="eiffelweb">
|
||||
<root cluster="application" class="APPLICATION_ROOT" feature="make"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/\.svn$</exclude>
|
||||
</file_rule>
|
||||
<setting name="console_application" value="true"/>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="fcgi" location="..\fcgi.ecf" readonly="false"/>
|
||||
<cluster name="application" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
Reference in New Issue
Block a user