Node* tag,
request_rec* r);
-extern char * chxj_form_action_to_hidden_tag(apr_pool_t *pool, const char *str, int xmlFlag, int post_flag);
+extern char * chxj_form_action_to_hidden_tag(request_rec *r, apr_pool_t *pool, const char *str, int xmlFlag, int post_flag);
#endif
/*
* vim:ts=2 et
char *q;
q = strchr(attr_value, '?');
if (q) {
- new_hidden_tag = chxj_form_action_to_hidden_tag(doc->pool, attr_value, 0, post_flag);
- *q = 0;
+ new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_value, 0, post_flag);
+ if (new_hidden_tag) {
+ *q = 0;
+ }
}
W10_L(" action=\"");
W10_V(attr_value);
char *q;
q = strchr(attr_action, '?');
if (q) {
- new_hidden_tag = chxj_form_action_to_hidden_tag(doc->pool, attr_action, 0, post_flag);
- *q = 0;
+ new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 0, post_flag);
+ if (new_hidden_tag) {
+ *q = 0;
+ }
}
W_L(" action=\"");
W_V(attr_action);
char *q;
q = strchr(attr_action, '?');
if (q) {
- new_hidden_tag = chxj_form_action_to_hidden_tag(doc->pool, attr_action, 0, post_flag);
- *q = 0;
+ new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 0, post_flag);
+ if (new_hidden_tag) {
+ *q = 0;
+ }
}
W_L(" action=\"");
W_V(attr_action);
char *q;
q = strchr(attr_action, '?');
if (q) {
- new_hidden_tag = chxj_form_action_to_hidden_tag(doc->pool, attr_action, 0, post_flag);
- *q = 0;
+ new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 0, post_flag);
+ if (new_hidden_tag) {
+ *q = 0;
+ }
}
W_L(" action=\"");
W_V(attr_action);
*/
#include "chxj_tag_util.h"
#include "chxj_url_encode.h"
+#include "chxj_str_util.h"
/**
* The value of the VALUE attribute that the object tag node maintains is
char *
-chxj_form_action_to_hidden_tag(apr_pool_t *pool, const char *str, int xmlFlag, int post)
+chxj_form_action_to_hidden_tag(request_rec *r, apr_pool_t *pool, const char *str, int xmlFlag, int post)
{
char *s = apr_pstrdup(pool, str);
+ if (!s) return NULL;
+ if (chxj_starts_with(s, "http://") || chxj_starts_with(s, "https://")) {
+ apr_uri_t url;
+ apr_uri_parse(pool, s, &url);
+ if (url.hostname && strcasecmp(url.hostname, r->hostname) != 0) {
+ return NULL;
+ }
+ }
s = strchr(s, '?');
- if (!s) return (char *)str;
+ if (!s) return NULL;
s++;
char *result = NULL;
char *q;
q = strchr(attr_action, '?');
if (q) {
- new_hidden_tag = chxj_form_action_to_hidden_tag(doc->pool, attr_action, 1, post_flag);
- *q = 0;
+ new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 1, post_flag);
+ if (new_hidden_tag) {
+ *q = 0;
+ }
}
W_L(" action=\"");
W_V(attr_action);