Merge branch 'master' of https://github.com/EiffelWebFramework/EWF
This commit is contained in:
@@ -70,6 +70,14 @@ review the [guidelines for contributing](CONTRIBUTING.md).
|
|||||||
* [Feature requests](CONTRIBUTING.md#features)
|
* [Feature requests](CONTRIBUTING.md#features)
|
||||||
* [Pull requests](CONTRIBUTING.md#pull-requests)
|
* [Pull requests](CONTRIBUTING.md#pull-requests)
|
||||||
|
|
||||||
|
## Community
|
||||||
|
|
||||||
|
Keep track of development and community news.
|
||||||
|
|
||||||
|
* Follow [@EiffelWeb](https://twitter.com/EiffelWeb) on Twitter
|
||||||
|
* Follow our [page](https://plus.google.com/u/0/110650349519032194479) and [community](https://plus.google.com/communities/110457383244374256721) on Google+
|
||||||
|
* Have a question that's not a feature request or bug report? [Ask on the mailing list](http://groups.google.com/group/eiffel-web-framework)
|
||||||
|
|
||||||
|
|
||||||
For more information please have a look at the related wiki:
|
For more information please have a look at the related wiki:
|
||||||
* https://github.com/EiffelWebFramework/EWF/wiki
|
* https://github.com/EiffelWebFramework/EWF/wiki
|
||||||
|
|||||||
@@ -10,16 +10,7 @@
|
|||||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="provisional">
|
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="provisional">
|
||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="curl" location="$ISE_LIBRARY\library\cURL\cURL-safe.ecf">
|
<library name="curl" location="$ISE_LIBRARY\library\cURL\cURL-safe.ecf"/>
|
||||||
<condition>
|
|
||||||
<version type="compiler" min="7.1.8.8674"/>
|
|
||||||
</condition>
|
|
||||||
</library>
|
|
||||||
<library name="curl_local" location="..\..\..\contrib\ise_library\cURL-safe.ecf">
|
|
||||||
<condition>
|
|
||||||
<version type="compiler" max="7.1.8.8673"/>
|
|
||||||
</condition>
|
|
||||||
</library>
|
|
||||||
<library name="encoder" location="..\..\text\encoder\encoder-safe.ecf"/>
|
<library name="encoder" location="..\..\text\encoder\encoder-safe.ecf"/>
|
||||||
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
|
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
|
||||||
<cluster name="src" location=".\src\" recursive="true"/>
|
<cluster name="src" location=".\src\" recursive="true"/>
|
||||||
|
|||||||
@@ -11,16 +11,7 @@
|
|||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
|
<library name="base" location="$ISE_LIBRARY/library/base/base.ecf"/>
|
||||||
<library name="net" location="$ISE_LIBRARY\library\net\net.ecf"/>
|
<library name="net" location="$ISE_LIBRARY\library\net\net.ecf"/>
|
||||||
<library name="curl" location="$ISE_LIBRARY\library\cURL\cURL.ecf">
|
<library name="curl" location="$ISE_LIBRARY\library\cURL\cURL.ecf"/>
|
||||||
<condition>
|
|
||||||
<version type="compiler" min="7.1.8.8674"/>
|
|
||||||
</condition>
|
|
||||||
</library>
|
|
||||||
<library name="curl_local" location="..\..\..\contrib\ise_library\cURL.ecf">
|
|
||||||
<condition>
|
|
||||||
<version type="compiler" max="7.1.8.8673"/>
|
|
||||||
</condition>
|
|
||||||
</library>
|
|
||||||
<library name="encoder" location="../../text/encoder/encoder.ecf"/>
|
<library name="encoder" location="../../text/encoder/encoder.ecf"/>
|
||||||
<cluster name="src" location=".\src\" recursive="true"/>
|
<cluster name="src" location=".\src\" recursive="true"/>
|
||||||
</target>
|
</target>
|
||||||
|
|||||||
@@ -76,11 +76,15 @@ feature -- Basic operation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Custom
|
||||||
|
|
||||||
custom (a_method: READABLE_STRING_8; a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_RESPONSE
|
custom (a_method: READABLE_STRING_8; a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_RESPONSE
|
||||||
-- Response for `a_method' request based on Current, `a_path' and `ctx'.
|
-- Response for `a_method' request based on Current, `a_path' and `ctx'.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Helper
|
||||||
|
|
||||||
get (a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_RESPONSE
|
get (a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_RESPONSE
|
||||||
-- Response for GET request based on Current, `a_path' and `ctx'.
|
-- Response for GET request based on Current, `a_path' and `ctx'.
|
||||||
deferred
|
deferred
|
||||||
@@ -103,6 +107,18 @@ feature -- Basic operation
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
|
patch (a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||||
|
-- Response for PATCH request based on Current, `a_path' and `ctx'
|
||||||
|
-- with input `data'
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
patch_file (a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; fn: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||||
|
-- Response for PATCH request based on Current, `a_path' and `ctx'
|
||||||
|
-- with uploaded data file `fn'
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
put (a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
put (a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||||
-- Response for PUT request based on Current, `a_path' and `ctx'
|
-- Response for PUT request based on Current, `a_path' and `ctx'
|
||||||
-- with input `data'
|
-- with input `data'
|
||||||
@@ -281,7 +297,7 @@ feature -- Element change
|
|||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, 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
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ feature -- Execution
|
|||||||
check
|
check
|
||||||
post_or_put_request_method: request_method.is_case_insensitive_equal ("POST")
|
post_or_put_request_method: request_method.is_case_insensitive_equal ("POST")
|
||||||
or request_method.is_case_insensitive_equal ("PUT")
|
or request_method.is_case_insensitive_equal ("PUT")
|
||||||
|
or request_method.is_case_insensitive_equal ("PATCH")
|
||||||
end
|
end
|
||||||
|
|
||||||
curl_easy.setopt_string (curl_handle, {CURL_OPT_CONSTANTS}.curlopt_postfields, l_upload_data)
|
curl_easy.setopt_string (curl_handle, {CURL_OPT_CONSTANTS}.curlopt_postfields, l_upload_data)
|
||||||
@@ -170,6 +171,7 @@ feature -- Execution
|
|||||||
check
|
check
|
||||||
post_or_put_request_method: request_method.is_case_insensitive_equal ("POST")
|
post_or_put_request_method: request_method.is_case_insensitive_equal ("POST")
|
||||||
or request_method.is_case_insensitive_equal ("PUT")
|
or request_method.is_case_insensitive_equal ("PUT")
|
||||||
|
or request_method.is_case_insensitive_equal ("PATCH")
|
||||||
end
|
end
|
||||||
|
|
||||||
create l_upload_file.make_with_name (l_upload_filename)
|
create l_upload_file.make_with_name (l_upload_filename)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ feature -- Status report
|
|||||||
Result := curl.is_dynamic_library_exists
|
Result := curl.is_dynamic_library_exists
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Basic operation
|
feature -- Custom
|
||||||
|
|
||||||
custom (a_method: READABLE_STRING_8; a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_RESPONSE
|
custom (a_method: READABLE_STRING_8; a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_RESPONSE
|
||||||
local
|
local
|
||||||
@@ -41,6 +41,18 @@ feature -- Basic operation
|
|||||||
Result := req.execute
|
Result := req.execute
|
||||||
end
|
end
|
||||||
|
|
||||||
|
custom_with_upload_data (a_method: READABLE_STRING_8; a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||||
|
do
|
||||||
|
Result := impl_custom (a_method, a_path, a_ctx, data, Void)
|
||||||
|
end
|
||||||
|
|
||||||
|
custom_with_upload_file (a_method: READABLE_STRING_8; a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; fn: READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||||
|
do
|
||||||
|
Result := impl_custom (a_method, a_path, a_ctx, Void, fn)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Helper
|
||||||
|
|
||||||
get (a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_RESPONSE
|
get (a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_RESPONSE
|
||||||
do
|
do
|
||||||
Result := custom ("GET", a_path, ctx)
|
Result := custom ("GET", a_path, ctx)
|
||||||
@@ -53,63 +65,32 @@ feature -- Basic operation
|
|||||||
|
|
||||||
post (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
post (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||||
do
|
do
|
||||||
Result := impl_post (a_path, a_ctx, data, Void)
|
Result := impl_custom ("POST", a_path, a_ctx, data, Void)
|
||||||
end
|
end
|
||||||
|
|
||||||
post_file (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; fn: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
post_file (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; fn: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||||
do
|
do
|
||||||
Result := impl_post (a_path, a_ctx, Void, fn)
|
Result := impl_custom ("POST", a_path, a_ctx, Void, fn)
|
||||||
|
end
|
||||||
|
|
||||||
|
patch (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||||
|
do
|
||||||
|
Result := impl_custom ("PATCH", a_path, a_ctx, data, Void)
|
||||||
|
end
|
||||||
|
|
||||||
|
patch_file (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; fn: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||||
|
do
|
||||||
|
Result := impl_custom ("PATCH", a_path, a_ctx, Void, fn)
|
||||||
end
|
end
|
||||||
|
|
||||||
put (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
put (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||||
local
|
|
||||||
ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT
|
|
||||||
f: detachable RAW_FILE
|
|
||||||
l_data: detachable READABLE_STRING_8
|
|
||||||
do
|
do
|
||||||
--| Quick and dirty hack using real file, for PUT uploaded data
|
Result := impl_custom ("PUT", a_path, a_ctx, data, Void)
|
||||||
--| FIXME [2012-05-23]: better use libcurl for that purpose
|
|
||||||
ctx := a_ctx
|
|
||||||
if data /= Void then
|
|
||||||
if ctx = Void then
|
|
||||||
create ctx.make
|
|
||||||
end
|
|
||||||
ctx.set_upload_data (data)
|
|
||||||
end
|
|
||||||
if ctx /= Void then
|
|
||||||
l_data := ctx.upload_data
|
|
||||||
end
|
|
||||||
if l_data /= Void then
|
|
||||||
create f.make_open_write (create {FILE_NAME}.make_temporary_name)
|
|
||||||
f.put_string (l_data)
|
|
||||||
f.close
|
|
||||||
check ctx /= Void then
|
|
||||||
ctx.set_upload_data (Void)
|
|
||||||
ctx.set_upload_filename (f.path.name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Result := custom ("PUT", a_path, ctx)
|
|
||||||
if f /= Void then
|
|
||||||
f.delete
|
|
||||||
end
|
|
||||||
if l_data /= Void and a_ctx /= Void then
|
|
||||||
a_ctx.set_upload_filename (Void)
|
|
||||||
a_ctx.set_upload_data (l_data)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
put_file (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; fn: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
put_file (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; fn: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||||
local
|
|
||||||
ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT
|
|
||||||
do
|
do
|
||||||
ctx := a_ctx
|
Result := impl_custom ("PUT", a_path, a_ctx, Void, fn)
|
||||||
if fn /= Void then
|
|
||||||
if ctx = Void then
|
|
||||||
create ctx.make
|
|
||||||
end
|
|
||||||
ctx.set_upload_filename (fn)
|
|
||||||
end
|
|
||||||
Result := custom ("PUT", a_path, ctx)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
delete (a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_RESPONSE
|
delete (a_path: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_RESPONSE
|
||||||
@@ -119,10 +100,12 @@ feature -- Basic operation
|
|||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
impl_post (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8; fn: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
impl_custom (a_method: READABLE_STRING_8; a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8; fn: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||||
local
|
local
|
||||||
req: HTTP_CLIENT_REQUEST
|
req: HTTP_CLIENT_REQUEST
|
||||||
ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT
|
ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT
|
||||||
|
f: detachable RAW_FILE
|
||||||
|
l_data: detachable READABLE_STRING_8
|
||||||
do
|
do
|
||||||
ctx := a_ctx
|
ctx := a_ctx
|
||||||
if data /= Void then
|
if data /= Void then
|
||||||
@@ -137,8 +120,35 @@ feature {NONE} -- Implementation
|
|||||||
end
|
end
|
||||||
ctx.set_upload_filename (fn)
|
ctx.set_upload_filename (fn)
|
||||||
end
|
end
|
||||||
create {LIBCURL_HTTP_CLIENT_REQUEST} req.make (base_url + a_path, "POST", Current, ctx)
|
if ctx /= Void then
|
||||||
|
l_data := ctx.upload_data
|
||||||
|
if l_data /= Void and a_method.is_case_insensitive_equal_general ("PUT") then
|
||||||
|
--| Quick and dirty hack using real file, for PUT uploaded data
|
||||||
|
--| FIXME [2012-05-23]: better use libcurl for that purpose
|
||||||
|
|
||||||
|
if ctx.has_upload_filename then
|
||||||
|
check put_conflict_file_and_data: False end
|
||||||
|
end
|
||||||
|
create f.make_open_write (create {FILE_NAME}.make_temporary_name)
|
||||||
|
f.put_string (l_data)
|
||||||
|
f.close
|
||||||
|
check ctx /= Void then
|
||||||
|
ctx.set_upload_data (Void)
|
||||||
|
ctx.set_upload_filename (f.path.name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
create {LIBCURL_HTTP_CLIENT_REQUEST} req.make (base_url + a_path, a_method, Current, ctx)
|
||||||
Result := req.execute
|
Result := req.execute
|
||||||
|
|
||||||
|
if f /= Void then
|
||||||
|
f.delete
|
||||||
|
end
|
||||||
|
if l_data /= Void and a_ctx /= Void then
|
||||||
|
a_ctx.set_upload_filename (Void)
|
||||||
|
a_ctx.set_upload_data (l_data)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {LIBCURL_HTTP_CLIENT_REQUEST} -- Curl implementation
|
feature {LIBCURL_HTTP_CLIENT_REQUEST} -- Curl implementation
|
||||||
|
|||||||
@@ -1443,8 +1443,12 @@ feature {NONE} -- Query parameters: implementation
|
|||||||
if j > 0 then
|
if j > 0 then
|
||||||
l_name := s.substring (1, j - 1)
|
l_name := s.substring (1, j - 1)
|
||||||
l_value := s.substring (j + 1, s.count)
|
l_value := s.substring (j + 1, s.count)
|
||||||
add_value_to_table (l_name, l_value, Result)
|
else
|
||||||
|
-- I.e variable without value
|
||||||
|
l_name := s
|
||||||
|
l_value := empty_string_8
|
||||||
end
|
end
|
||||||
|
add_value_to_table (l_name, l_value, Result)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2059,7 +2063,7 @@ invariant
|
|||||||
wgi_request.content_type /= Void implies content_type /= Void
|
wgi_request.content_type /= Void implies content_type /= Void
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, 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
|
||||||
|
|||||||
@@ -464,8 +464,12 @@ feature {NONE} -- Implementation
|
|||||||
if j > 0 then
|
if j > 0 then
|
||||||
l_name := s.substring (1, j - 1)
|
l_name := s.substring (1, j - 1)
|
||||||
l_value := s.substring (j + 1, s.count)
|
l_value := s.substring (j + 1, s.count)
|
||||||
res.force (l_value, l_name)
|
else
|
||||||
|
-- variable without value
|
||||||
|
l_name := s
|
||||||
|
create {IMMUTABLE_STRING_8} l_value.make_empty
|
||||||
end
|
end
|
||||||
|
res.force (l_value, l_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user