javascript - POST to server with encodeURIComponent containing >< characters causing a 301 redirect -
i'm posting html string apache server receiving function writing string database. there's nothing big or clever , works on every other implementation.
i encodeuricomponent-ing string before post , server returning 301 redirect , diverting request on non-www version of domain. there's nothing in htaccess beyond standard wordpress configuration. in case, text string. have replace function on server exit() remove equation.
i use same mechanism post numerous other data server via same target function without problem.
i've discovered problem sending characters >< - it's sending html these occur lot.
so i'm sending via: encodeuricomponent("<span class='teststring'><span>")
which posts.. action=updatemenu&mstring=%3cspan%20class%3d'teststring'%3e%3cspan%3e
and returns.. post http://www.domainremoved.co.uk/twdc/cms/tellme.php 301 moved permanently 301ms followed by.. http://domainremoved.co.uk/twdc/cms/tellme.php 301 moved permanently 108ms
if remove either > or < >< pattern works fine! reducing above encodeduri string >< results in same error.
i @ complete loss. come across before or have ideas? guess can replace string in question safe has implications user input have encoded/decoded in case. surely shouldn't necessary?
tried switching out >< in post string replace(/%3e%3c/g,"~~") on encodeuricomponent result , it's passed server without redirect/error.
edit 00:00 19th july..
i've noticed >< in post, response header. x-pingback doesn't appear in response header without offending characters.
cache-control no-cache, must-revalidate, max-age=0 connection keep-alive content-length 0 content-type text/html; charset=utf-8 date thu, 18 jul 2013 22:57:07 gmt expires wed, 11 jan 1984 05:00:00 gmt keep-alive timeout=5, max=100 location http://*domain*.co.uk/twdc/cms/tellme.php pragma no-cache server apache x-pingback http://*domain*.co.uk/xmlrpc.php x-powered-by php/5.3.17
i guess wordpress-related. can shed light on this?
to clear current site wordpress-based; replacement not coexisting during build of new one.
i'm still not sure issue wordpress , posting html characters have found if encode data want send json object no objection server.
i presume stops whatever function wordpress uses parsing html in way.. still know explanation though!
Comments
Post a Comment