Fixed various issues with libfcgi on Linux, mainly related to stdout,stderr,stdin, feof and related.
Added `reset' to the libfcgi input stream so that it is possible to reset previous errors.
This commit is contained in:
@@ -62,6 +62,7 @@ feature -- Execution
|
|||||||
rescued: BOOLEAN
|
rescued: BOOLEAN
|
||||||
do
|
do
|
||||||
if not rescued then
|
if not rescued then
|
||||||
|
a_input.reset
|
||||||
create req.make (vars, a_input, Current)
|
create req.make (vars, a_input, Current)
|
||||||
create res.make (a_output, a_output)
|
create res.make (a_output, a_output)
|
||||||
service.execute (req, res)
|
service.execute (req, res)
|
||||||
|
|||||||
@@ -32,6 +32,21 @@ feature {NONE} -- Initialization
|
|||||||
create last_string.make_empty
|
create last_string.make_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Reset
|
||||||
|
|
||||||
|
reset
|
||||||
|
-- Reset current input stream
|
||||||
|
-- especially any previous error if any.
|
||||||
|
do
|
||||||
|
debug ("wsf")
|
||||||
|
io.error.put_string (generator + " : reset %N")
|
||||||
|
end
|
||||||
|
last_string.wipe_out
|
||||||
|
last_character := '%U'
|
||||||
|
internal_end_of_input := False
|
||||||
|
fcgi.fcgi_clearerr
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
is_open_read: BOOLEAN
|
is_open_read: BOOLEAN
|
||||||
@@ -43,9 +58,11 @@ feature -- Status report
|
|||||||
end_of_input: BOOLEAN
|
end_of_input: BOOLEAN
|
||||||
-- Has the end of input stream been reached?
|
-- Has the end of input stream been reached?
|
||||||
do
|
do
|
||||||
Result := fcgi.fcgi_end_of_input
|
Result := fcgi.fcgi_end_of_input or internal_end_of_input
|
||||||
end
|
end
|
||||||
|
|
||||||
|
internal_end_of_input: BOOLEAN
|
||||||
|
|
||||||
feature -- Input
|
feature -- Input
|
||||||
|
|
||||||
read_character
|
read_character
|
||||||
@@ -59,6 +76,7 @@ feature -- Input
|
|||||||
if s.count >= 1 then
|
if s.count >= 1 then
|
||||||
last_character := s.item (1)
|
last_character := s.item (1)
|
||||||
else
|
else
|
||||||
|
internal_end_of_input := True
|
||||||
last_character := '%U'
|
last_character := '%U'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -69,6 +87,7 @@ feature -- Input
|
|||||||
-- Make result available in `last_string'.
|
-- Make result available in `last_string'.
|
||||||
do
|
do
|
||||||
fcgi.fill_string_from_stdin (last_string, nb_char)
|
fcgi.fill_string_from_stdin (last_string, nb_char)
|
||||||
|
internal_end_of_input := last_string.count < nb_char
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
@@ -86,7 +105,7 @@ feature {NONE} -- Implementation
|
|||||||
-- Bridge to FCGI world
|
-- Bridge to FCGI world
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2011, Eiffel Software and others"
|
copyright: "2011-2013, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -68,10 +68,28 @@ feature {FCGI_IMP} -- Internal
|
|||||||
|
|
||||||
feof (v: POINTER): INTEGER
|
feof (v: POINTER): INTEGER
|
||||||
-- FCGI_feof()
|
-- FCGI_feof()
|
||||||
|
-- 0 means EOF not detected.
|
||||||
external
|
external
|
||||||
"C inline use %"fcgi_stdio.h%""
|
"C inline use %"fcgi_stdio.h%""
|
||||||
alias
|
alias
|
||||||
"FCGI_feof"
|
"return FCGI_feof($v);"
|
||||||
|
end
|
||||||
|
|
||||||
|
ferror (v: POINTER): INTEGER
|
||||||
|
-- FCGI_ferror()
|
||||||
|
-- 0 means no error.
|
||||||
|
external
|
||||||
|
"C inline use %"fcgi_stdio.h%""
|
||||||
|
alias
|
||||||
|
"return FCGI_ferror($v);"
|
||||||
|
end
|
||||||
|
|
||||||
|
clearerr (v: POINTER)
|
||||||
|
-- FCGI_clearerr().
|
||||||
|
external
|
||||||
|
"C inline use %"fcgi_stdio.h%""
|
||||||
|
alias
|
||||||
|
"FCGI_clearerr($v)"
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Input
|
feature {NONE} -- Input
|
||||||
@@ -108,27 +126,27 @@ feature -- Error
|
|||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
stdout: POINTER
|
stdout: POINTER
|
||||||
-- FCGI_stdout() return pointer on output FCGI_FILE
|
-- FCGI_stdout return pointer on output FCGI_FILE
|
||||||
external
|
external
|
||||||
"C inline use %"fcgi_stdio.h%""
|
"C inline use %"fcgi_stdio.h%""
|
||||||
alias
|
alias
|
||||||
"FCGI_stdout"
|
"return FCGI_stdout;"
|
||||||
end
|
end
|
||||||
|
|
||||||
stdin: POINTER
|
stdin: POINTER
|
||||||
-- FCGI_stdin() return pointer on input FCGI_FILE
|
-- FCGI_stdin return pointer on input FCGI_FILE
|
||||||
external
|
external
|
||||||
"C inline use %"fcgi_stdio.h%""
|
"C inline use %"fcgi_stdio.h%""
|
||||||
alias
|
alias
|
||||||
"FCGI_stdin"
|
"return FCGI_stdin;"
|
||||||
end
|
end
|
||||||
|
|
||||||
stderr: POINTER
|
stderr: POINTER
|
||||||
-- FCGI_stderr() return pointer on error FCGI_FILE
|
-- FCGI_stderr return pointer on error FCGI_FILE
|
||||||
external
|
external
|
||||||
"C inline use %"fcgi_stdio.h%""
|
"C inline use %"fcgi_stdio.h%""
|
||||||
alias
|
alias
|
||||||
"FCGI_stderr"
|
"return FCGI_stderr;"
|
||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
|
|||||||
@@ -32,7 +32,12 @@ feature -- Access
|
|||||||
|
|
||||||
fcgi_end_of_input: BOOLEAN
|
fcgi_end_of_input: BOOLEAN
|
||||||
do
|
do
|
||||||
Result := fcgi.feof (fcgi.stdin) = 0
|
Result := fcgi.feof (fcgi.stdin) /= 0 --| in fact, True if feof (..) = EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
fcgi_clearerr
|
||||||
|
do
|
||||||
|
fcgi.clearerr (fcgi.stdin)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- FCGI Connection
|
feature -- FCGI Connection
|
||||||
@@ -175,7 +180,7 @@ feature -- I/O Routines
|
|||||||
--RFO end
|
--RFO end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
copyright: "Copyright (c) 1984-2013, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -68,10 +68,28 @@ feature {FCGI_IMP} -- Internal
|
|||||||
|
|
||||||
feof (v: POINTER): INTEGER
|
feof (v: POINTER): INTEGER
|
||||||
-- FCGI_feof()
|
-- FCGI_feof()
|
||||||
|
-- 0 means EOF not detected.
|
||||||
external
|
external
|
||||||
"C inline use %"fcgi_stdio.h%""
|
"C inline use %"fcgi_stdio.h%""
|
||||||
alias
|
alias
|
||||||
"FCGI_feof"
|
"return FCGI_feof($v);"
|
||||||
|
end
|
||||||
|
|
||||||
|
ferror (v: POINTER): INTEGER
|
||||||
|
-- FCGI_ferror()
|
||||||
|
-- 0 means no error.
|
||||||
|
external
|
||||||
|
"C inline use %"fcgi_stdio.h%""
|
||||||
|
alias
|
||||||
|
"return FCGI_ferror($v);"
|
||||||
|
end
|
||||||
|
|
||||||
|
clearerr (v: POINTER)
|
||||||
|
-- FCGI_clearerr().
|
||||||
|
external
|
||||||
|
"C inline use %"fcgi_stdio.h%""
|
||||||
|
alias
|
||||||
|
"FCGI_clearerr($v)"
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Input
|
feature {NONE} -- Input
|
||||||
@@ -108,27 +126,27 @@ feature -- Error
|
|||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
stdout: POINTER
|
stdout: POINTER
|
||||||
-- FCGI_stdout() return pointer on output FCGI_FILE
|
-- FCGI_stdout return pointer on output FCGI_FILE
|
||||||
external
|
external
|
||||||
"C inline use %"fcgi_stdio.h%""
|
"C inline use %"fcgi_stdio.h%""
|
||||||
alias
|
alias
|
||||||
"FCGI_stdout"
|
"return FCGI_stdout;"
|
||||||
end
|
end
|
||||||
|
|
||||||
stdin: POINTER
|
stdin: POINTER
|
||||||
-- FCGI_stdin() return pointer on input FCGI_FILE
|
-- FCGI_stdin return pointer on input FCGI_FILE
|
||||||
external
|
external
|
||||||
"C inline use %"fcgi_stdio.h%""
|
"C inline use %"fcgi_stdio.h%""
|
||||||
alias
|
alias
|
||||||
"FCGI_stdin"
|
"return FCGI_stdin;"
|
||||||
end
|
end
|
||||||
|
|
||||||
stderr: POINTER
|
stderr: POINTER
|
||||||
-- FCGI_stderr() return pointer on error FCGI_FILE
|
-- FCGI_stderr return pointer on error FCGI_FILE
|
||||||
external
|
external
|
||||||
"C inline use %"fcgi_stdio.h%""
|
"C inline use %"fcgi_stdio.h%""
|
||||||
alias
|
alias
|
||||||
"FCGI_stderr"
|
"return FCGI_stderr;"
|
||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
|
|||||||
@@ -32,7 +32,12 @@ feature -- Access
|
|||||||
|
|
||||||
fcgi_end_of_input: BOOLEAN
|
fcgi_end_of_input: BOOLEAN
|
||||||
do
|
do
|
||||||
Result := fcgi.feof (fcgi.stdin) = 0
|
Result := fcgi.feof (fcgi.stdin) /= 0 --| in fact, True if feof (..) = EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
fcgi_clearerr
|
||||||
|
do
|
||||||
|
fcgi.clearerr (fcgi.stdin)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- FCGI Connection
|
feature -- FCGI Connection
|
||||||
|
|||||||
@@ -65,12 +65,30 @@ feature {FCGI_IMP} -- Internal
|
|||||||
|
|
||||||
feof (v: POINTER): INTEGER
|
feof (v: POINTER): INTEGER
|
||||||
-- FCGI_feof()
|
-- FCGI_feof()
|
||||||
|
-- 0 means EOF not detected.
|
||||||
external
|
external
|
||||||
"dll libfcgi.dll signature (EIF_POINTER): EIF_INTEGER use fcgi_stdio.h "
|
"dll libfcgi.dll signature (EIF_POINTER): EIF_INTEGER use fcgi_stdio.h "
|
||||||
alias
|
alias
|
||||||
"FCGI_feof"
|
"FCGI_feof"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ferror (v: POINTER): INTEGER
|
||||||
|
-- FCGI_ferror()
|
||||||
|
-- 0 means no error.
|
||||||
|
external
|
||||||
|
"dll libfcgi.dll signature (EIF_POINTER): EIF_INTEGER use fcgi_stdio.h "
|
||||||
|
alias
|
||||||
|
"FCGI_ferror"
|
||||||
|
end
|
||||||
|
|
||||||
|
clearerr (v: POINTER)
|
||||||
|
-- FCGI_clearerr().
|
||||||
|
external
|
||||||
|
"dll libfcgi.dll signature (EIF_POINTER) use fcgi_stdio.h "
|
||||||
|
alias
|
||||||
|
"FCGI_clearerr"
|
||||||
|
end
|
||||||
|
|
||||||
feature {NONE} -- Input
|
feature {NONE} -- Input
|
||||||
|
|
||||||
fread (v: POINTER; a_size: INTEGER; n: INTEGER; fp: POINTER): INTEGER
|
fread (v: POINTER; a_size: INTEGER; n: INTEGER; fp: POINTER): INTEGER
|
||||||
@@ -123,30 +141,29 @@ feature {NONE} -- Output
|
|||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
stdout: POINTER
|
stdout: POINTER
|
||||||
-- FCGI_stdout() return pointer on output FCGI_FILE
|
-- FCGI_stdout return pointer on output FCGI_FILE
|
||||||
external
|
external
|
||||||
"C inline use %"fcgi_stdio.h%""
|
"C inline use %"fcgi_stdio.h%""
|
||||||
alias
|
alias
|
||||||
"FCGI_stdout"
|
"return FCGI_stdout;"
|
||||||
end
|
end
|
||||||
|
|
||||||
stdin: POINTER
|
stdin: POINTER
|
||||||
-- FCGI_stdin() return pointer on input FCGI_FILE
|
-- FCGI_stdin return pointer on input FCGI_FILE
|
||||||
external
|
external
|
||||||
"C inline use %"fcgi_stdio.h%""
|
"C inline use %"fcgi_stdio.h%""
|
||||||
alias
|
alias
|
||||||
"FCGI_stdin"
|
"return FCGI_stdin;"
|
||||||
end
|
end
|
||||||
|
|
||||||
stderr: POINTER
|
stderr: POINTER
|
||||||
-- FCGI_stderr() return pointer on error FCGI_FILE
|
-- FCGI_stderr return pointer on error FCGI_FILE
|
||||||
external
|
external
|
||||||
"C inline use %"fcgi_stdio.h%""
|
"C inline use %"fcgi_stdio.h%""
|
||||||
alias
|
alias
|
||||||
"FCGI_stderr"
|
"return FCGI_stderr;"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
|||||||
@@ -30,7 +30,12 @@ feature -- Access
|
|||||||
|
|
||||||
fcgi_end_of_input: BOOLEAN
|
fcgi_end_of_input: BOOLEAN
|
||||||
do
|
do
|
||||||
Result := fcgi.feof (fcgi.stdin) = 0
|
Result := fcgi.feof (fcgi.stdin) /= 0 --| in fact, True if feof (..) = EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
fcgi_clearerr
|
||||||
|
do
|
||||||
|
fcgi.clearerr (fcgi.stdin)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- updated_environ_variables: HASH_TABLE [STRING, STRING]
|
-- updated_environ_variables: HASH_TABLE [STRING, STRING]
|
||||||
|
|||||||
Reference in New Issue
Block a user