Skip to content

Commit

Permalink
Allow setting arbitrary headers for frame socket
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jan 31, 2024
1 parent f25bc97 commit d73cde0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions socket/framesocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ type FrameSocket struct {
log waLog.Logger
lock sync.Mutex

URL string
Origin string
URL string
HTTPHeaders http.Header

Frames chan []byte
OnDisconnect func(remote bool)
Expand All @@ -52,8 +52,8 @@ func NewFrameSocket(log waLog.Logger, proxy Proxy) *FrameSocket {
Header: WAConnHeader,
Frames: make(chan []byte),

URL: URL,
Origin: Origin,
URL: URL,
HTTPHeaders: http.Header{"Origin": {Origin}},

Proxy: proxy,
}
Expand Down Expand Up @@ -108,9 +108,8 @@ func (fs *FrameSocket) Connect() error {
Proxy: fs.Proxy,
}

headers := http.Header{"Origin": []string{fs.Origin}}
fs.log.Debugf("Dialing %s", fs.URL)
conn, _, err := dialer.Dial(fs.URL, headers)
conn, _, err := dialer.Dial(fs.URL, fs.HTTPHeaders)
if err != nil {
cancel()
return fmt.Errorf("couldn't dial whatsapp web websocket: %w", err)
Expand Down

0 comments on commit d73cde0

Please sign in to comment.