Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c4df7845
Kaydet (Commit)
c4df7845
authored
Ara 03, 2010
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #10272: The ssl module now raises socket.timeout instead of a generic
SSLError on socket timeouts.
üst
500be24a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
9 deletions
+15
-9
test_ssl.py
Lib/test/test_ssl.py
+2
-2
NEWS
Misc/NEWS
+3
-0
_ssl.c
Modules/_ssl.c
+7
-7
socketmodule.c
Modules/socketmodule.c
+2
-0
socketmodule.h
Modules/socketmodule.h
+1
-0
No files found.
Lib/test/test_ssl.py
Dosyayı görüntüle @
c4df7845
...
@@ -1499,7 +1499,7 @@ else:
...
@@ -1499,7 +1499,7 @@ else:
c
.
settimeout
(
0.2
)
c
.
settimeout
(
0.2
)
c
.
connect
((
host
,
port
))
c
.
connect
((
host
,
port
))
# Will attempt handshake and time out
# Will attempt handshake and time out
self
.
assertRaisesRegex
(
s
sl
.
SSLError
,
"timed out"
,
self
.
assertRaisesRegex
(
s
ocket
.
timeout
,
"timed out"
,
ssl
.
wrap_socket
,
c
)
ssl
.
wrap_socket
,
c
)
finally
:
finally
:
c
.
close
()
c
.
close
()
...
@@ -1508,7 +1508,7 @@ else:
...
@@ -1508,7 +1508,7 @@ else:
c
=
ssl
.
wrap_socket
(
c
)
c
=
ssl
.
wrap_socket
(
c
)
c
.
settimeout
(
0.2
)
c
.
settimeout
(
0.2
)
# Will attempt handshake and time out
# Will attempt handshake and time out
self
.
assertRaisesRegex
(
s
sl
.
SSLError
,
"timed out"
,
self
.
assertRaisesRegex
(
s
ocket
.
timeout
,
"timed out"
,
c
.
connect
,
(
host
,
port
))
c
.
connect
,
(
host
,
port
))
finally
:
finally
:
c
.
close
()
c
.
close
()
...
...
Misc/NEWS
Dosyayı görüntüle @
c4df7845
...
@@ -35,6 +35,9 @@ Core and Builtins
...
@@ -35,6 +35,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #10272: The ssl module now raises socket.timeout instead of a generic
SSLError on socket timeouts.
- Issue #10528: Allow translators to reorder placeholders in localizable
- Issue #10528: Allow translators to reorder placeholders in localizable
messages from argparse.
messages from argparse.
...
...
Modules/_ssl.c
Dosyayı görüntüle @
c4df7845
...
@@ -370,7 +370,7 @@ static PyObject *PySSL_SSLdo_handshake(PySSLSocket *self)
...
@@ -370,7 +370,7 @@ static PyObject *PySSL_SSLdo_handshake(PySSLSocket *self)
sockstate
=
SOCKET_OPERATION_OK
;
sockstate
=
SOCKET_OPERATION_OK
;
}
}
if
(
sockstate
==
SOCKET_HAS_TIMED_OUT
)
{
if
(
sockstate
==
SOCKET_HAS_TIMED_OUT
)
{
PyErr_SetString
(
PyS
SLErrorObject
,
PyErr_SetString
(
PyS
ocketModule
.
timeout_error
,
ERRSTR
(
"The handshake operation timed out"
));
ERRSTR
(
"The handshake operation timed out"
));
goto
error
;
goto
error
;
}
else
if
(
sockstate
==
SOCKET_HAS_BEEN_CLOSED
)
{
}
else
if
(
sockstate
==
SOCKET_HAS_BEEN_CLOSED
)
{
...
@@ -1075,7 +1075,7 @@ static PyObject *PySSL_SSLwrite(PySSLSocket *self, PyObject *args)
...
@@ -1075,7 +1075,7 @@ static PyObject *PySSL_SSLwrite(PySSLSocket *self, PyObject *args)
sockstate
=
check_socket_and_wait_for_timeout
(
sock
,
1
);
sockstate
=
check_socket_and_wait_for_timeout
(
sock
,
1
);
if
(
sockstate
==
SOCKET_HAS_TIMED_OUT
)
{
if
(
sockstate
==
SOCKET_HAS_TIMED_OUT
)
{
PyErr_SetString
(
PyS
SLErrorObject
,
PyErr_SetString
(
PyS
ocketModule
.
timeout_error
,
"The write operation timed out"
);
"The write operation timed out"
);
goto
error
;
goto
error
;
}
else
if
(
sockstate
==
SOCKET_HAS_BEEN_CLOSED
)
{
}
else
if
(
sockstate
==
SOCKET_HAS_BEEN_CLOSED
)
{
...
@@ -1104,7 +1104,7 @@ static PyObject *PySSL_SSLwrite(PySSLSocket *self, PyObject *args)
...
@@ -1104,7 +1104,7 @@ static PyObject *PySSL_SSLwrite(PySSLSocket *self, PyObject *args)
sockstate
=
SOCKET_OPERATION_OK
;
sockstate
=
SOCKET_OPERATION_OK
;
}
}
if
(
sockstate
==
SOCKET_HAS_TIMED_OUT
)
{
if
(
sockstate
==
SOCKET_HAS_TIMED_OUT
)
{
PyErr_SetString
(
PyS
SLErrorObject
,
PyErr_SetString
(
PyS
ocketModule
.
timeout_error
,
"The write operation timed out"
);
"The write operation timed out"
);
goto
error
;
goto
error
;
}
else
if
(
sockstate
==
SOCKET_HAS_BEEN_CLOSED
)
{
}
else
if
(
sockstate
==
SOCKET_HAS_BEEN_CLOSED
)
{
...
@@ -1211,7 +1211,7 @@ static PyObject *PySSL_SSLread(PySSLSocket *self, PyObject *args)
...
@@ -1211,7 +1211,7 @@ static PyObject *PySSL_SSLread(PySSLSocket *self, PyObject *args)
if
(
!
count
)
{
if
(
!
count
)
{
sockstate
=
check_socket_and_wait_for_timeout
(
sock
,
0
);
sockstate
=
check_socket_and_wait_for_timeout
(
sock
,
0
);
if
(
sockstate
==
SOCKET_HAS_TIMED_OUT
)
{
if
(
sockstate
==
SOCKET_HAS_TIMED_OUT
)
{
PyErr_SetString
(
PyS
SLErrorObject
,
PyErr_SetString
(
PyS
ocketModule
.
timeout_error
,
"The read operation timed out"
);
"The read operation timed out"
);
goto
error
;
goto
error
;
}
else
if
(
sockstate
==
SOCKET_TOO_LARGE_FOR_SELECT
)
{
}
else
if
(
sockstate
==
SOCKET_TOO_LARGE_FOR_SELECT
)
{
...
@@ -1245,7 +1245,7 @@ static PyObject *PySSL_SSLread(PySSLSocket *self, PyObject *args)
...
@@ -1245,7 +1245,7 @@ static PyObject *PySSL_SSLread(PySSLSocket *self, PyObject *args)
sockstate
=
SOCKET_OPERATION_OK
;
sockstate
=
SOCKET_OPERATION_OK
;
}
}
if
(
sockstate
==
SOCKET_HAS_TIMED_OUT
)
{
if
(
sockstate
==
SOCKET_HAS_TIMED_OUT
)
{
PyErr_SetString
(
PyS
SLErrorObject
,
PyErr_SetString
(
PyS
ocketModule
.
timeout_error
,
"The read operation timed out"
);
"The read operation timed out"
);
goto
error
;
goto
error
;
}
else
if
(
sockstate
==
SOCKET_IS_NONBLOCKING
)
{
}
else
if
(
sockstate
==
SOCKET_IS_NONBLOCKING
)
{
...
@@ -1340,10 +1340,10 @@ static PyObject *PySSL_SSLshutdown(PySSLSocket *self)
...
@@ -1340,10 +1340,10 @@ static PyObject *PySSL_SSLshutdown(PySSLSocket *self)
break
;
break
;
if
(
sockstate
==
SOCKET_HAS_TIMED_OUT
)
{
if
(
sockstate
==
SOCKET_HAS_TIMED_OUT
)
{
if
(
ssl_err
==
SSL_ERROR_WANT_READ
)
if
(
ssl_err
==
SSL_ERROR_WANT_READ
)
PyErr_SetString
(
PyS
SLErrorObject
,
PyErr_SetString
(
PyS
ocketModule
.
timeout_error
,
"The read operation timed out"
);
"The read operation timed out"
);
else
else
PyErr_SetString
(
PyS
SLErrorObject
,
PyErr_SetString
(
PyS
ocketModule
.
timeout_error
,
"The write operation timed out"
);
"The write operation timed out"
);
goto
error
;
goto
error
;
}
}
...
...
Modules/socketmodule.c
Dosyayı görüntüle @
c4df7845
...
@@ -4358,6 +4358,7 @@ static
...
@@ -4358,6 +4358,7 @@ static
PySocketModule_APIObject
PySocketModuleAPI
=
PySocketModule_APIObject
PySocketModuleAPI
=
{
{
&
sock_type
,
&
sock_type
,
NULL
,
NULL
NULL
};
};
...
@@ -4425,6 +4426,7 @@ PyInit__socket(void)
...
@@ -4425,6 +4426,7 @@ PyInit__socket(void)
socket_error
,
NULL
);
socket_error
,
NULL
);
if
(
socket_timeout
==
NULL
)
if
(
socket_timeout
==
NULL
)
return
NULL
;
return
NULL
;
PySocketModuleAPI
.
timeout_error
=
socket_timeout
;
Py_INCREF
(
socket_timeout
);
Py_INCREF
(
socket_timeout
);
PyModule_AddObject
(
m
,
"timeout"
,
socket_timeout
);
PyModule_AddObject
(
m
,
"timeout"
,
socket_timeout
);
Py_INCREF
((
PyObject
*
)
&
sock_type
);
Py_INCREF
((
PyObject
*
)
&
sock_type
);
...
...
Modules/socketmodule.h
Dosyayı görüntüle @
c4df7845
...
@@ -196,6 +196,7 @@ typedef struct {
...
@@ -196,6 +196,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
PyTypeObject
*
Sock_Type
;
PyTypeObject
*
Sock_Type
;
PyObject
*
error
;
PyObject
*
error
;
PyObject
*
timeout_error
;
}
PySocketModule_APIObject
;
}
PySocketModule_APIObject
;
#define PySocketModule_ImportModuleAndAPI() PyCapsule_Import(PySocket_CAPSULE_NAME, 1)
#define PySocketModule_ImportModuleAndAPI() PyCapsule_Import(PySocket_CAPSULE_NAME, 1)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment