Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for LocalAddrContextKey (0.16 sec)

  1. src/net/http/server.go

    	// type *Server.
    	ServerContextKey = &contextKey{"http-server"}
    
    	// LocalAddrContextKey is a context key. It can be used in
    	// HTTP handlers with Context.Value to access the local
    	// address the connection arrived on.
    	// The associated value will be of type net.Addr.
    	LocalAddrContextKey = &contextKey{"local-addr"}
    )
    
    // A conn represents the server side of an HTTP connection.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 07 17:57:01 UTC 2024
    - 123.4K bytes
    - Viewed (0)
  2. src/net/http/serve_test.go

    }
    func testServerContext_LocalAddrContextKey(t *testing.T, mode testMode) {
    	ch := make(chan any, 1)
    	cst := newClientServerTest(t, mode, HandlerFunc(func(w ResponseWriter, r *Request) {
    		ch <- r.Context().Value(LocalAddrContextKey)
    	}))
    	if _, err := cst.c.Head(cst.ts.URL); err != nil {
    		t.Fatal(err)
    	}
    
    	host := cst.ts.Listener.Addr().String()
    	got := <-ch
    	if addr, ok := got.(net.Addr); !ok {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 07 17:57:01 UTC 2024
    - 202K bytes
    - Viewed (0)
Back to top