Nino connector:

- fixed issue related to `ready_for_reading'  now use the `try_...' variant
 - for now Nino does not support persistent connection, then we have to respond with "Connection: close"

REQUEST_FILE_SYSTEM_HANDLER:
 - added not_found_handler and access_denied_handler, so that the user can customize related response

WSF_REQUEST and WSF_VALUE:
 - modified how uploaded file are handled, fixed various issues, and added WSF_UPLOADED_FILE (it is a WSF_VALUE)

WSF_VALUE:
 - added change_name (a_name: like name)
 - added url_encoded_name to other WSF_values

WSF_REQUEST:
 - added `destroy' to perform end of request cleaning (such as deleting temp uploaded files)
 - renamed `raw_post_data_recorded' as `raw_input_data_recorded', and related feature
 - do not store the RAW_POST_DATA in meta variable anymore, but in WSF_REQUEST.raw_input_data is asked

Added WSF_HTML_PAGE_RESPONSE to help user

WSF_REPONSE.redirect_... now use "temp_redirect" as default
  instead of "moved_permanently" which is specific usage

Removed many obsolete features.
This commit is contained in:
Jocelyn Fiat
2012-03-13 18:07:28 +01:00
parent c5fe539acb
commit 5abc79b7c3
33 changed files with 993 additions and 306 deletions

View File

@@ -117,7 +117,7 @@ feature -- Server
process_request (env: HASH_TABLE [STRING, STRING]; a_headers_text: STRING; a_socket: TCP_STREAM_SOCKET)
local
req: WGI_REQUEST_FROM_TABLE
res: detachable WGI_RESPONSE_STREAM
res: detachable WGI_NINO_RESPONSE_STREAM
do
create req.make (env, create {WGI_NINO_INPUT_STREAM}.make (a_socket), Current)
create res.make (create {WGI_NINO_OUTPUT_STREAM}.make (a_socket))

View File

@@ -77,11 +77,11 @@ feature -- Status report
end_of_input: BOOLEAN
-- Has the end of input stream been reached?
do
Result := not source.ready_for_reading
Result := not source.try_ready_for_reading
end
;note
copyright: "2011-2011, Eiffel Software and others"
copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -0,0 +1,45 @@
note
description: "[
WGI Response implemented using stream buffer
]"
date: "$Date$"
revision: "$Revision$"
class
WGI_NINO_RESPONSE_STREAM
inherit
WGI_RESPONSE_STREAM
redefine
put_header_text
end
create
make
feature -- Header output operation
put_header_text (a_text: READABLE_STRING_8)
do
write (a_text)
-- Nino does not support persistent connection for now
write ("Connection: close")
write (crlf)
-- end of headers
write (crlf)
header_committed := True
end
;note
copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -1,103 +0,0 @@
note
description: "Summary description for {WGI_UPLOADED_FILE_DATA}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WGI_UPLOADED_FILE_DATA
create
make
feature {NONE} -- Initialization
make (n: like name; t: like content_type; s: like size)
do
name := n
content_type := t
size := s
end
feature -- Access
name: STRING
-- original filename
content_type: STRING
-- Content type
size: INTEGER
-- Size of uploaded file
tmp_name: detachable STRING
-- Filename of tmp file
tmp_basename: detachable STRING
-- Basename of tmp file
feature -- Basic operation
move_to (a_destination: STRING): BOOLEAN
-- Move current uploaded file to `a_destination'
require
has_no_error: not has_error
local
f: RAW_FILE
do
if attached tmp_name as n then
create f.make (n)
if f.exists then
f.change_name (a_destination)
Result := True
end
end
end
feature -- Status
has_error: BOOLEAN
-- Has error during uploading
do
Result := error /= 0
end
error: INTEGER
-- Eventual error code
--| no error => 0
feature -- Element change
set_error (e: like error)
-- Set `error' to `e'
do
error := e
end
set_tmp_name (n: like tmp_name)
-- Set `tmp_name' to `n'
do
tmp_name := n
end
set_tmp_basename (n: like tmp_basename)
-- Set `tmp_basename' to `n'
do
tmp_basename := n
end
invariant
valid_tmp_name: not has_error implies attached tmp_name as n and then not n.is_empty
note
copyright: "2011-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

View File

@@ -20,7 +20,7 @@ feature {NONE} -- Implementation
feature -- Input
data: READABLE_STRING_8
data: STRING_8
local
d: like internal_data
do
@@ -34,13 +34,13 @@ feature -- Input
feature {NONE} -- Parser
internal_data: detachable READABLE_STRING_8
internal_data: detachable STRING_8
tmp_hex_chunk_size: STRING_8
last_chunk_size: INTEGER
last_chunk: detachable STRING_8
fetched_data: READABLE_STRING_8
fetched_data: STRING_8
-- Read all the data in a chunked stream.
-- Make the result available in `last_chunked'.
-- Chunked-Body = *chunk
@@ -57,7 +57,7 @@ feature {NONE} -- Parser
-- chunk-data = chunk-size(OCTET)
-- trailer = *(entity-header CRLF)
local
eoc : BOOLEAN
eoc: BOOLEAN
s: STRING_8
do
from
@@ -69,7 +69,7 @@ feature {NONE} -- Parser
if attached last_chunk as l_last_chunk then
s.append (l_last_chunk)
else
eoc := true
eoc := True
end
if last_chunk_size = 0 then
eoc := True