Improved query and form data encoding (based on a very early version of the general URI percent-encoding rules).

- now correct encoding of space by '%20' in path segment, and '+' in query parameters.
Unify and fixed query parameters handling for libcurl and net implementation.
Fixed file uploading (various issue in libcurl, and net implementation).
Fixed form multipart encoding by using correctly the boundary.
Updated autotest cases.
Code cleaning.
This commit is contained in:
Jocelyn Fiat
2017-05-17 12:16:35 +02:00
parent 485a3812d9
commit 69b5ce637e
15 changed files with 932 additions and 122 deletions

View File

@@ -0,0 +1,47 @@
note
description: "Summary description for {X_WWW_FORM_URL_ENCODER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
X_WWW_FORM_URL_ENCODER
inherit
URL_ENCODER
redefine
append_percent_encoded_ascii_character_code_to
end
feature {NONE} -- Implementation: character encoding
append_percent_encoded_ascii_character_code_to (a_code: NATURAL_32; a_result: STRING_GENERAL)
-- <Precursor>
-- Note: space is encoded with '+' for x-www-form-urlencoding.
do
inspect a_code
when
32 -- 32 ' '
then
a_result.append_code (43) -- 43 '+'
when
33, 39, -- ! '
40, 41, 42 -- ( ) *
then
a_result.append_code (a_code) -- Keep slash
else
Precursor (a_code, a_result)
end
end
note
copyright: "Copyright (c) 2011-2017, 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