Skip to content

Commit

Permalink
net.http: change default http.Server listening address to :9009, to a…
Browse files Browse the repository at this point in the history
…void conflicts with tools, that start their own http servers on 8080 like bytehound (#21570)
  • Loading branch information
spytheman committed May 25, 2024
1 parent 25be362 commit a1ad658
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions vlib/net/http/server.v
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ mut:
handle(Request) Response
}

pub const default_server_port = 9009

pub struct Server {
mut:
state ServerStatus = .closed
pub mut:
addr string = ':8080' // change to ':8080' when port is removed
port int = 8080 @[deprecated: 'use addr']
addr string = ':${http.default_server_port}'
port int = http.default_server_port @[deprecated: 'use addr']
handler Handler = DebugHandler{}
read_timeout time.Duration = 30 * time.second
write_timeout time.Duration = 30 * time.second
Expand All @@ -53,7 +55,7 @@ pub fn (mut s Server) listen_and_serve() {

// remove when s.port is removed
addr := s.addr.split(':')
if addr.len > 1 && s.port != 8080 {
if addr.len > 1 && s.port != http.default_server_port {
s.addr = '${addr[0]}:${s.port}'
}

Expand Down

0 comments on commit a1ad658

Please sign in to comment.