diff options
author | Joey Hess <joey@kitenet.net> | 2010-06-23 16:32:20 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-06-23 16:35:51 -0400 |
commit | 4292802ee5f93f7ec7644c5d0a30f7ffeb95e566 (patch) | |
tree | 603a4a6f366f411b2ef1909825d400db6ad65bc7 /IkiWiki/Plugin/comments.pm | |
parent | b4a43406f61b7ff9ab77d242edf4d59369ac8596 (diff) | |
download | ikiwiki-4292802ee5f93f7ec7644c5d0a30f7ffeb95e566.tar ikiwiki-4292802ee5f93f7ec7644c5d0a30f7ffeb95e566.tar.gz |
stop using REMOTE_ADDR
Everywhere that REMOTE_ADDR was used, a session object is available, so
instead use its remote_addr method.
In IkiWiki::Receive, stop setting a dummy REMOTE_ADDR.
Note that it's possible for a session cookie to be obtained using one IP
address, and then used from another IP. In this case, the first IP will now
be used. I think that should be ok.
Diffstat (limited to 'IkiWiki/Plugin/comments.pm')
-rw-r--r-- | IkiWiki/Plugin/comments.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index d1558001a..4770209c9 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -402,8 +402,8 @@ sub editcomment ($$) { $username =~ s/"/"/g; $content .= " username=\"$username\"\n"; } - elsif (defined $ENV{REMOTE_ADDR}) { - my $ip = $ENV{REMOTE_ADDR}; + elsif (defined $session->remote_addr()) { + my $ip = $session->remote_addr(); if ($ip =~ m/^([.0-9]+)$/) { $content .= " ip=\"$1\"\n"; } @@ -514,7 +514,8 @@ sub editcomment ($$) { IkiWiki::rcs_add($file); IkiWiki::disable_commit_hook(); $conflict = IkiWiki::rcs_commit_staged($message, - $session->param('name'), $ENV{REMOTE_ADDR}); + $session->param('name'), + $session->remote_addr()); IkiWiki::enable_commit_hook(); IkiWiki::rcs_update(); } @@ -603,7 +604,8 @@ sub commentmoderation ($$) { my $message = gettext("Comment moderation"); IkiWiki::disable_commit_hook(); $conflict=IkiWiki::rcs_commit_staged($message, - $session->param('name'), $ENV{REMOTE_ADDR}); + $session->param('name'), + $session->remote_addr()); IkiWiki::enable_commit_hook(); IkiWiki::rcs_update(); } |