introduce urlencode decode and sql escape public apis
authorAndy Green <andy@warmcat.com>
Wed, 8 Jun 2016 02:07:02 +0000 (10:07 +0800)
committerAndy Green <andy@warmcat.com>
Tue, 14 Jun 2016 04:04:38 +0000 (12:04 +0800)
commitc55fd27d75234b387ff63188d510813189e35f3f
tree655bbd90b3fda250840154821c6124bea4ad1695
parent70c60d81ab404c5f8e2a60a4c2ef771060dff9c1
introduce urlencode decode and sql escape public apis

This adds

 - simple lws_urlencode()
 - simple lws_urldecode()
 - simple lws_sql_purify

Those expect the data to all be there and process it up until
the first '\0'.

There is also a larger opaque apis for handling POST_BODY urldecode.  To
enable these, you need to give cmake -DLWS_WITH_STATEFUL_URLDECODE=1 (or
arrange any larger feature that relies on it sets that in CMakeLists.txt)

 - stateful urldecode with parameter array

These have create / process / destroy semantics on a struct that maintains
decode state.

Stateful urldecode is capable of dealing with large POST data in multiple
POST_BODY callbacks cleanly, eg, file transfer by POST.

Stateful urldecode with parameter array wraps the above with a canned
callback that stores the urldecoded data and indexes them in a pointer
array matching an array of parameter names.

You may also pass it an optional callback when creating it, that will recieve
uploaded file content.

The test html is updated to support both urlencoded and multipart forms,
with some javascript to do clientside validation of an arbitrary 100KB
file size limit (there is no file size limit in the apis).

Signed-off-by: Andy Green <andy@warmcat.com>
CMakeLists.txt
lib/libwebsockets.c
lib/libwebsockets.h
lib/server.c
libwebsockets-api-doc.html
lws_config.h.in
plugins/protocol_post_demo.c
test-server/test-server-http.c
test-server/test-server.h
test-server/test.html