Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6252083f
Commit
6252083f
authored
Aug 04, 2007
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change read() on SSL socket to return bytes.
parent
97043c3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
Modules/_ssl.c
Modules/_ssl.c
+7
-4
No files found.
Modules/_ssl.c
View file @
6252083f
...
@@ -496,7 +496,7 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
...
@@ -496,7 +496,7 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
if
(
!
PyArg_ParseTuple
(
args
,
"|i:read"
,
&
len
))
if
(
!
PyArg_ParseTuple
(
args
,
"|i:read"
,
&
len
))
return
NULL
;
return
NULL
;
if
(
!
(
buf
=
Py
String
_FromStringAndSize
((
char
*
)
0
,
len
)))
if
(
!
(
buf
=
Py
Bytes
_FromStringAndSize
((
char
*
)
0
,
len
)))
return
NULL
;
return
NULL
;
/* first check if there are bytes ready to be read */
/* first check if there are bytes ready to be read */
...
@@ -518,7 +518,7 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
...
@@ -518,7 +518,7 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
do
{
do
{
err
=
0
;
err
=
0
;
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
count
=
SSL_read
(
self
->
ssl
,
Py
String_AsString
(
buf
),
len
);
count
=
SSL_read
(
self
->
ssl
,
Py
Bytes_AS_STRING
(
buf
),
len
);
err
=
SSL_get_error
(
self
->
ssl
,
count
);
err
=
SSL_get_error
(
self
->
ssl
,
count
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
if
(
PyErr_CheckSignals
())
{
if
(
PyErr_CheckSignals
())
{
...
@@ -545,12 +545,15 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
...
@@ -545,12 +545,15 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
return
PySSL_SetError
(
self
,
count
);
return
PySSL_SetError
(
self
,
count
);
}
}
if
(
count
!=
len
)
if
(
count
!=
len
)
_PyString_Resize
(
&
buf
,
count
);
if
(
PyBytes_Resize
(
buf
,
count
)
<
0
)
{
Py_DECREF
(
buf
);
return
NULL
;
}
return
buf
;
return
buf
;
}
}
PyDoc_STRVAR
(
PySSL_SSLread_doc
,
PyDoc_STRVAR
(
PySSL_SSLread_doc
,
"read([len]) ->
string
\n
\
"read([len]) ->
bytes
\n
\
\n
\
\n
\
Read up to len bytes from the SSL socket."
);
Read up to len bytes from the SSL socket."
);
...
...
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