Conversation
AMP requests with payloads larger than 6kb doesn't even reach the broker side
There was a problem hiding this comment.
Pull request overview
This PR adds logic to skip the AMP transport when handling HTTP requests with payloads larger than 6KB, addressing an issue where such large requests were failing to reach the broker.
Key Changes:
- Introduces a 6KB content length limit constant (
ampMaxContentLength = 6000) - Adds Content-Length header checking logic before launching transport goroutines
- Skips the AMP transport when request size exceeds the limit
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
race_transport.go
Outdated
| name string | ||
| } | ||
|
|
||
| const ampMaxContentLength = 6000 |
There was a problem hiding this comment.
I really think this should be part of a new interface for all transports.
I.e. something like a KindlingTransport interface that would have something like:
MaxLength() int
ConnectedRoundTripper(...) http.RoundTripper
There was a problem hiding this comment.
you mean adding as part of namedRoundTripper function? I'll add a commit that I can revert later if this isn't what you meant.
this commit might be reverted later if this isn't the correct suggestion implementation
|
No I think we should generalize it all like this in type Transport interface {
// NewRoundTripper creates a new http.RoundTripper that is already connected
NewRoundTripper(ctx context.Context, addr string) (http.RoundTripper, error)
MaxLength() int
Name() string
}
func WithTransport(transport Transport) Option {
return newOption(func(k *kindling) {
log.Info("Setting custom transport")
if transport == nil {
log.Error("Transport instance is nil")
return
}
k.transports = append(k.transports, transport)
})
} |
|
I just started coding this for the example -- should have a PR soon! |
|
OK yeah here's that refactor: #26 |
…amp-transport-on-large-request
AMP requests with payloads larger than 6kb doesn't even reach the broker side
Resolve getlantern/engineering#2871