Я хочу отправлять запросы только через модуль сокета. Моя цель - получить ответ с кодом статуса. В любом случае, когда я отправляю запрос через порт 443, он ничего не отвечает
import socket
host = ("www.google.com",80)
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(host)
message = '''GET / HTTP/1.1
Host: www.google.com
Connection: keep-alive
'''
s.send(message.encode())
modifiedMessage = s.recv(2048).decode("ISO-8859-1");
print(modifiedMessage)
s.close()
Вывод:
HTTP/1.1 200 OK
Date: Sun, 08 Mar 2020 14:35:58 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
Server: gws
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
Set-Cookie: 1P_JAR=2020-03-08-14; expires=Tue, 07-Apr-2020 14:35:58 GMT; path=/; domain=.google.com; Secure
Set-Cookie: NID=199=E_sNmu747pC1yNz0-2mc4SbQvL65ABXaSlu2DjgZr8S6U56ie5IMHC6BYOOIbVL9oJ2ydA7mbm0DQhLFNwm7Xw1Q7Z7ABtE8Y6Pd0gMy3Py0-DSMxnzVMtgmkBJAojusMBIGvVMsH_QidWUrqjHrTby2vnyY_7Fx2_pvaCEZ90w; expires=Mon, 07-Sep-2020 14:35:58 GMT; path=/; domain=.google.com; HttpOnly
Accept-Ranges: none
Vary: Accept-Encoding
Transfer-Encoding: chunked
6974
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="de"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/logos/doodles/2020/international-womens-day-2020-6753651837108310.2-l.png" itemprop="image"><meta content="Internationaler Frauentag " property="twitter:title"><meta content="Zur Feier des Internationalen Frauentags #GoogleDoodle #IWD2020" property="twitter:description"><meta content="Zur Feier des Internationalen Frauentags #GoogleDoodle #IWD2020" property="og:description"><meta content="summary_large_image" property="twitter:card"><meta content="@GoogleDoodles" property="twitter:site"><meta content="https://www.google.com/logos/doodles/2020/international-womens-day-2020-6753651837108310-2xa.gif" property="twitter:image"><meta content="https://www.google.com/logos/doodles/2020/international-womens-day-2020-6753651837108310-2xa.gif" property="og:image"><meta content="818" property="og:image:width"><meta content="460" property="og:image:height"><meta content="https://www.google.com/logos/doodles/2020/international-womens-day-2020-6753651837108310-2xa.gif" property="og:url"><meta content="video.other" property="og:type"><title>Google</title><script nonce="1T1228FRBGn0F7FbqOxhPA==">(function(){window.google={kEI:'zgJlXuORMs
В принципе все работает нормально, но когда я меняю порт с 80 на 443, я просто получить пустой ответ