-
Notifications
You must be signed in to change notification settings - Fork 132
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
feat: allow ReadTimeout for http.Server to be configured #194
Comments
As noted in the Configuration section of the README, the maximum request duration can be configured via the I am unlikely to change this configuration for the public instance of go-httpbin available at https://httpgingo.org. |
In case it's helpful, the configuration for that public https://httpbingo.org instance can be seen here: h := httpbin.New(
httpbin.WithMaxBodySize(maxBodySize),
httpbin.WithMaxDuration(maxDuration),
httpbin.WithHostname(hostname),
httpbin.WithAllowedRedirectDomains(allowedRedirectDomains),
httpbin.WithExcludeHeaders(strings.Join(excludedHeaders, ",")),
)
var handler http.Handler
handler = h.Handler()
handler = spamFilter(handler)
handler = hlog.AccessHandler(requestLogger)(handler)
handler = hlog.NewHandler(logger)(handler)
srv := &http.Server{
Addr: fmt.Sprintf("0.0.0.0:%s", os.Getenv("PORT")),
Handler: handler,
ReadTimeout: 2 * time.Second,
ReadHeaderTimeout: 1 * time.Second,
MaxHeaderBytes: 1024 * 4, // 4kb
} |
Httpbin is excellent, and I'm using my own deployment. the ReadTimeout of the http.Server is hard-coded, requiring modification of the source code, recompilation, and rebuilding of the image. I think it would be more user-friendly if these parameters were configurable. Now it's like this.
|
Ah, okay, thank you for clarifying, I closed this too quickly! I’d be happy to accept a change to make those parameters configurable via CLI arguments and environment variables, if you or anyone else wants to work on that. |
(I updated the issue description above to be a bit more specific, in case it's helpful for anyone who might want to tackle this feature request!) |
It should be possible for users to override these settings when deploying the public mccutchn/go-httpbin Docker image without having to build and deploy their own customized image:
go-httpbin/httpbin/cmd/cmd.go
Lines 30 to 33 in ce8d747
Those settings are then used here:
go-httpbin/httpbin/cmd/cmd.go
Lines 96 to 102 in ce8d747
Original issue description
When uploading files, it usually takes a long time. The default 5s time is not enough. Adjust to configurable items for greater flexibility.The text was updated successfully, but these errors were encountered: