Skip to content

Commit

Permalink
Merge pull request #478 from zmap/fix/failing-ci-tests
Browse files Browse the repository at this point in the history
fix: failing ci tests
  • Loading branch information
phillip-stephens authored Jan 10, 2025
2 parents 3b4db6f + a40f7db commit 1aec142
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
integration-test:
name: Integration Test
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Check out source
uses: actions/checkout@v4
Expand Down
16 changes: 15 additions & 1 deletion modules/http/http_readlimit_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package http

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

"github.com/zmap/zcrypto/tls"
"github.com/zmap/zgrab2"
"github.com/zmap/zgrab2/lib/http"
"golang.org/x/sys/unix"
)

// BEGIN Taken from handshake_server_test.go -- certs for TLS server
Expand Down Expand Up @@ -81,7 +84,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 = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1)
}); err != nil {
return err
}
return opErr
},
}
listener, err := lc.Listen(context.Background(), "tcp", endpoint)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 1aec142

Please sign in to comment.