0
# -*- coding: utf-8 -*-
import socket, ssl, threading, select
def conecta(c, a):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('123.456.789.123', 444))
s = ssl.wrap_socket(s, ssl.PROTOCOL_SSLv23)
c.recv(8192) # Descarto Requisição Real.
s.send(b"GET / HTTP/1.1\r\n\r\n") # Requisição GET.
s.send(b"CONNECT host:port HTTP/1.1\r\n\r\n") # Requisição CONNECT.
Which to use?
In case, both
CONNECT
how muchGET
are distinct HTTP methods/verbs. This has nothing to do with Python itself. I’m not used to the verbCONNECT
in HTTP, but the traditional verb for "catch" information is theGET
. To post is thePOST
, to update is thePUT
and to correct is thePATCH
.– Jefferson Quesado
Related: https://answall.com/q/300329/64969 The accepted answer even speaks of the method
CONNECT
. Good reading– Jefferson Quesado
I am programming in Python, which is why I added it to the tags. I usually use CONNECT when I am giving it to you with http proxy. When I am giving you with direct connection, I let you send the actual request of the client. But and in the case of SSL?
– user110265