[asterisk-commits] dlee: branch dlee/ASTERISK-22743-post-body r402378 - /team/dlee/ASTERISK-2274...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Nov 1 12:45:40 CDT 2013
Author: dlee
Date: Fri Nov 1 12:45:38 2013
New Revision: 402378
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402378
Log:
application/x-www-form-urlencoded processing
Modified:
team/dlee/ASTERISK-22743-post-body/res/res_ari.c
Modified: team/dlee/ASTERISK-22743-post-body/res/res_ari.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22743-post-body/res/res_ari.c?view=diff&rev=402378&r1=402377&r2=402378
==============================================================================
--- team/dlee/ASTERISK-22743-post-body/res/res_ari.c (original)
+++ team/dlee/ASTERISK-22743-post-body/res/res_ari.c Fri Nov 1 12:45:38 2013
@@ -844,6 +844,7 @@
RAII_VAR(struct ast_ari_conf_user *, user, NULL, ao2_cleanup);
struct ast_ari_response response = {};
int ret = 0;
+ RAII_VAR(struct ast_variable *, post_vars, NULL, ast_variables_destroy);
if (!response_headers || !response_body) {
return -1;
@@ -860,6 +861,23 @@
}
process_cors_request(headers, &response);
+
+ /* Process form data from a POST. It could be mixed with query
+ * parameters, which seems a bit odd. But it's allowed, so that's okay
+ * with us.
+ */
+ post_vars = ast_http_get_post_vars(ser, headers);
+ if (get_params == NULL) {
+ get_params = post_vars;
+ } else if (get_params && post_vars) {
+ /* Has both post_vars and get_params */
+ struct ast_variable *last_var = post_vars;
+ while (last_var->next) {
+ last_var = last_var->next;
+ }
+ last_var->next = ast_variables_dup(get_params);
+ get_params = post_vars;
+ }
user = authenticate_user(get_params, headers);
if (!user) {
More information about the asterisk-commits
mailing list