Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
developStorm committed Jan 10, 2025
1 parent 7810d24 commit 12000bd
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion modules/http/http_readlimit_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package http

import (
"context"
"crypto/rsa"
"encoding/hex"
"fmt"
"io"
"math/big"
"net"
"strings"
"syscall"
"testing"
"time"

Expand Down Expand Up @@ -81,7 +83,18 @@ func _write(writer io.Writer, data []byte) error {
// XXXX....
func (cfg *readLimitTestConfig) runFakeHTTPServer(t *testing.T) {
endpoint := fmt.Sprintf("127.0.0.1:%d", cfg.port)
listener, err := net.Listen("tcp", endpoint)
lc := net.ListenConfig{
Control: func(network, address string, c syscall.RawConn) error {
var opErr error
if err := c.Control(func(fd uintptr) {
opErr = syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_REUSEPORT, 1)
}); err != nil {
return err
}
return opErr
},
}
listener, err := lc.Listen(context.Background(), "tcp", endpoint)
t.Logf("Listening on %s, err=%v", endpoint, err)
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 12000bd

Please sign in to comment.