Addition to "http" library, separated constants into
- HTTP_MIME_TYPES - HTTP_HEADER_NAMES - HTTP_REQUEST_METHODS - HTTP_STATUS_CODE (already exists) Do not set the "Status" header when using WGI_RESPONSE_BUFFER.write_header (...) Cosmetic
This commit is contained in:
@@ -6,31 +6,30 @@ note
|
||||
class
|
||||
HTTP_REQUEST_METHOD_CONSTANTS
|
||||
|
||||
inherit
|
||||
HTTP_REQUEST_METHODS
|
||||
|
||||
feature -- Id
|
||||
|
||||
method_get: INTEGER = 0x1
|
||||
head: INTEGER = 0x1
|
||||
|
||||
method_post: INTEGER = 0x2
|
||||
get: INTEGER = 0x2
|
||||
|
||||
method_put: INTEGER = 0x4
|
||||
trace: INTEGER = 0x4
|
||||
|
||||
method_delete: INTEGER = 0x8
|
||||
options: INTEGER = 0x8
|
||||
|
||||
method_head: INTEGER = 0x10
|
||||
post: INTEGER = 0x10
|
||||
|
||||
put: INTEGER = 0x20
|
||||
|
||||
delete: INTEGER = 0x40
|
||||
|
||||
connect: INTEGER = 0x80
|
||||
|
||||
feature -- Name
|
||||
|
||||
method_get_name: STRING = "GET"
|
||||
|
||||
method_post_name: STRING = "POST"
|
||||
|
||||
method_put_name: STRING = "PUT"
|
||||
|
||||
method_delete_name: STRING = "DELETE"
|
||||
|
||||
method_head_name: STRING = "HEAD"
|
||||
|
||||
method_empty_name: STRING = ""
|
||||
method_empty: STRING = ""
|
||||
|
||||
feature -- Query
|
||||
|
||||
@@ -39,35 +38,45 @@ feature -- Query
|
||||
s: STRING
|
||||
do
|
||||
s := a_id.as_lower
|
||||
if s.same_string (method_get_name) then
|
||||
Result := method_get
|
||||
elseif s.same_string (method_post_name) then
|
||||
Result := method_post
|
||||
elseif s.same_string (method_put_name) then
|
||||
Result := method_put
|
||||
elseif s.same_string (method_delete_name) then
|
||||
Result := method_delete
|
||||
elseif s.same_string (method_head_name) then
|
||||
Result := method_head
|
||||
if s.same_string (method_get) then
|
||||
Result := get
|
||||
elseif s.same_string (method_post) then
|
||||
Result := post
|
||||
elseif s.same_string (method_put) then
|
||||
Result := put
|
||||
elseif s.same_string (method_delete) then
|
||||
Result := delete
|
||||
elseif s.same_string (method_head) then
|
||||
Result := head
|
||||
elseif s.same_string (method_trace) then
|
||||
Result := trace
|
||||
elseif s.same_string (method_options) then
|
||||
Result := options
|
||||
elseif s.same_string (method_connect) then
|
||||
Result := connect
|
||||
end
|
||||
end
|
||||
|
||||
method_name (a_id: INTEGER): STRING
|
||||
do
|
||||
inspect a_id
|
||||
when method_get then Result := method_get_name
|
||||
when method_post then Result := method_post_name
|
||||
when method_put then Result := method_put_name
|
||||
when method_delete then Result := method_delete_name
|
||||
when method_head then Result := method_head_name
|
||||
else Result := method_empty_name
|
||||
when head then Result := method_head
|
||||
when get then Result := method_get
|
||||
when trace then Result := method_trace
|
||||
when options then Result := method_options
|
||||
when post then Result := method_post
|
||||
when put then Result := method_put
|
||||
when delete then Result := method_delete
|
||||
when connect then Result := method_connect
|
||||
else
|
||||
Result := method_empty
|
||||
end
|
||||
ensure
|
||||
result_is_upper_case: Result /= Void and then Result.as_upper ~ Result
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
|
||||
copyright: "2011-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
@@ -76,4 +85,5 @@ note
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user