From 98e6d25b42650a912b498965b614f234b5b133f9 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Thu, 17 Sep 2020 15:38:39 +0800 Subject: [PATCH] vweb: make ip() to return peer_ip work (#6399) --- vlib/vweb/vweb.v | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index d745807459..dfd4fa665c 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -567,10 +567,10 @@ pub fn (ctx &Context) ip() string { if ip.contains(',') { ip = ip.all_before(',') } + if ip == '' { + ip = ctx.conn.peer_ip() or { '' } + } return ip - // TODO make return ctx.conn.peer_ip() or { '' } work - //res := ctx.conn.peer_ip() or { '' } - //return res } pub fn (mut ctx Context) error(s string) {