Skip to content

proposal: http/server.go: log from logger of server field #65026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Spuxy opened this issue Jan 8, 2024 · 2 comments
Closed

proposal: http/server.go: log from logger of server field #65026

Spuxy opened this issue Jan 8, 2024 · 2 comments

Comments

@Spuxy
Copy link

Spuxy commented Jan 8, 2024

Proposal Details

Background

Available to log, that client has sent too big header.

Proposal

access *log.Logger from value server of type *Server, to be able for developer to get info when some client could not http handshake

go/src/net/http/server.go

Lines 1973 to 1982 in b702e04

case err == errTooLarge:
// Their HTTP client may or may not be
// able to read this if we're
// responding to them and hanging up
// while they're still writing their
// request. Undefined behavior.
const publicErr = "431 Request Header Fields Too Large"
fmt.Fprintf(c.rwc, "HTTP/1.1 "+publicErr+errorHeaders+publicErr)
c.closeWriteAndWait()
return

API changes

Minimal ? The *log.Logger is already implemented when its not passed into server, then its default logger or user can pass his user-defined struct

Benefits

Better metrics and information about connections to go app

@Spuxy Spuxy added the Proposal label Jan 8, 2024
@gopherbot gopherbot added this to the Proposal milestone Jan 8, 2024
@AlexanderYastrebov
Copy link
Contributor

Looks like duplicate of #56028

@Spuxy
Copy link
Author

Spuxy commented Jan 11, 2024

U are right, im closing this

@Spuxy Spuxy closed this as completed Jan 11, 2024
@golang golang locked and limited conversation to collaborators Jan 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants