How does js initiate a http request for Method=CONNECT

1. the http protocol supports the following methods

clipboard.png

2.XMLHttpRequestconnectmethod


clipboard.png

3. Question: how to initiate a http request for method=connect in languages such as JavaScript or php?

Mar.13,2021

personal feeling may be that connect is a two-way transmission method, while ajax this kind of asynchronous request cannot achieve two-way data transfer ( can only transfer data when initiating a request )

if you want to do something similar, I think you can consider using web scoket .


Thank you for the invitation. You also know that XMLHttpRequest belongs to Web API provided by the runtime environment, and does not support CONNECT , TRACK , TRACE . So if you are asking the browser how to send it, it will not be sent. If you are asking JavaScript how to send it, you can send it from the server, such as nodejs .


the CONNECT method is for the proxy. For example, if you set the HTTPS proxy, the one sent to the proxy server is the CONNECT method

.
Menu