mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
net.http: add remote-addr header (#18208)
This commit is contained in:
parent
38a155ac81
commit
e4c769d072
@ -100,13 +100,17 @@ fn (mut s Server) parse_and_respond(mut conn net.TcpConn) {
|
||||
reader.free()
|
||||
}
|
||||
}
|
||||
req := parse_request(mut reader) or {
|
||||
mut req := parse_request(mut reader) or {
|
||||
$if debug {
|
||||
// only show in debug mode to prevent abuse
|
||||
eprintln('error parsing request: ${err}')
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
remote_ip := conn.peer_ip() or { '' }
|
||||
req.header.add_custom('Remote-Addr', remote_ip) or {}
|
||||
|
||||
mut resp := s.handler.handle(req)
|
||||
if resp.version() == .unknown {
|
||||
resp.set_version(req.version)
|
||||
|
Loading…
Reference in New Issue
Block a user