The ConnectCallback is provided with a SocketsHttpConnectionContext that includes the InitialRequestMessage.
By the time the callback runs, the initial request may have already been completed and returned to the user, or it is being sent by a different connection. That is, a different thread may be accessing the headers while the callback is running.
As a result, any access of InitialRequestMessage's headers is problematic.
Related: #61798, #65379
The
ConnectCallbackis provided with aSocketsHttpConnectionContextthat includes theInitialRequestMessage.By the time the callback runs, the initial request may have already been completed and returned to the user, or it is being sent by a different connection. That is, a different thread may be accessing the headers while the callback is running.
As a result, any access of
InitialRequestMessage's headers is problematic.Related: #61798, #65379