Is the SSL Direct Request Text CONNECT or GET? (Python + Socket + SSL)

Asked

Viewed 67 times

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 much GET are distinct HTTP methods/verbs. This has nothing to do with Python itself. I’m not used to the verb CONNECT in HTTP, but the traditional verb for "catch" information is the GET. To post is the POST, to update is the PUT and to correct is the PATCH.

  • Related: https://answall.com/q/300329/64969 The accepted answer even speaks of the method CONNECT. Good reading

  • 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?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.