diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-11-28 19:16:47 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-11-28 19:16:47 +0100 |
commit | c39b6e4277357c9da1dfd5e3e8c41b5b3427e0ce (patch) | |
tree | 21a713fb0974242dc0cf7023eac1dfda7865419c /web/src/js/components/utils.jsx.js | |
parent | 7ca1ac0f3b7856c0ae44bfbf3b27ae4a424a1cc2 (diff) | |
download | mitmproxy-c39b6e4277357c9da1dfd5e3e8c41b5b3427e0ce.tar.gz mitmproxy-c39b6e4277357c9da1dfd5e3e8c41b5b3427e0ce.tar.bz2 mitmproxy-c39b6e4277357c9da1dfd5e3e8c41b5b3427e0ce.zip |
web: various fixes, add clear button
Diffstat (limited to 'web/src/js/components/utils.jsx.js')
-rw-r--r-- | web/src/js/components/utils.jsx.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/web/src/js/components/utils.jsx.js b/web/src/js/components/utils.jsx.js index b1d9a006..12775adc 100644 --- a/web/src/js/components/utils.jsx.js +++ b/web/src/js/components/utils.jsx.js @@ -95,4 +95,21 @@ var Splitter = React.createClass({ </div> ); } +}); + +function getCookie(name) { + var r = document.cookie.match("\\b" + name + "=([^;]*)\\b"); + return r ? r[1] : undefined; +} +var xsrf = $.param({_xsrf: getCookie("_xsrf")}); + +//Tornado XSRF Protection. +$.ajaxPrefilter(function(options){ + if(options.type === "post" && options.url[0] === "/"){ + if(options.data){ + options.data += ("&" + xsrf); + } else { + options.data = xsrf; + } + } });
\ No newline at end of file |