58 Commits

Author SHA1 Message Date
Gregory P. Smith
f8f30fad4d Backport r62627 + r62744 from trunk to fix issue 2632.
- Issue #2632: Prevent socket.read(bignumber) from over allocating memory
  in the common case when the data is returned from the underlying socket
  in increments much smaller than bignumber.
2008-07-06 04:04:07 +00:00
Andrew M. Kuchling
664553a778 #1389051, #1092502: fix excessively large allocations when using read() on a socket 2008-02-23 19:30:59 +00:00
Martin v. Löwis
a8ddae6149 Bug #978833: Revert r50844, as it broke _socketobject.dup. 2007-03-23 13:27:29 +00:00
Georg Brandl
962e9165aa Patch #1627441: close sockets properly in urllib2.
(backport from rev. 53511)
2007-01-21 10:35:14 +00:00
Martin v. Löwis
9298eff5f9 Bug #978833: Really close underlying socket in _socketobject.close.
Fix httplib.HTTPConnection.getresponse to not close the
socket if it is still needed for the response.
2006-07-26 12:12:56 +00:00
Martin v. Löwis
7596e8342e Release all forwarded functions in .close. Fixes #1513223. 2006-07-01 15:33:37 +00:00
Martin Blais
af2ae72cb2 Fixes in struct and socket from merge reviews.
- Following Guido's comments, renamed

  * pack_to -> pack_into
  * recv_buf -> recv_into
  * recvfrom_buf -> recvfrom_into

- Made fixes to _struct.c according to Neal Norwitz comments on the checkins
  list.

- Converted some ints into the appropriate -- I hope -- ssize_t and size_t.
2006-06-04 13:49:49 +00:00
Martin Blais
2856e5f390 Support for buffer protocol for socket and struct.
* Added socket.recv_buf() and socket.recvfrom_buf() methods, that use the buffer
  protocol (send and sendto already did).

* Added struct.pack_to(), that is the corresponding buffer compatible method to
  unpack_from().

* Fixed minor typos in arraymodule.
2006-05-26 12:03:27 +00:00
Georg Brandl
a50794b620 Patch #1466993: remove wrong comment in socket.py 2006-04-09 14:28:13 +00:00
Tim Peters
0ae07bdb59 Whitespace normalization. 2006-03-22 03:23:21 +00:00
Georg Brandl
bb03ac0dae Correct API design mistake from rev. 43126: make socket attributes readonly properties. 2006-03-21 18:17:25 +00:00
Georg Brandl
bc45a3f821 RFE #567972: Socket objects' family, type and proto properties are
now exposed via new get...() methods.
2006-03-17 19:17:34 +00:00
Brett Cannon
01668a1ab9 Fix test for socket.getfqdn() to also include the name returned by
socket.gethostname() in the check for a valid return.

Also clarified docs (official and docstring) that the value from gethostname()
is returned if gethostbyaddr() doesn't do the job.
2005-03-11 00:04:17 +00:00
Dave Cole
331708b226 Patch #1003700: Add socketpair function to socket module. 2004-08-09 04:51:41 +00:00
Raymond Hettinger
027bb633b6 Add weakref support to sockets and re pattern objects. 2004-05-31 03:09:25 +00:00
Tim Peters
116d83ce71 SF bug 924242: socket._fileobject._getclosed() returns wrong value
The .closed property always returned the wrong result.

Bugfix candidate!
2004-03-28 02:20:45 +00:00
Martin v. Löwis
1867f24416 Always unwrap _socketobj in socket.ssl. Revert httplib.py 1.25.
Fixes #754447.
2003-06-14 13:30:53 +00:00
Guido van Rossum
65f8cedd4a I saw errors from _fileobject.__del__ about missing self._sock. This
can happen if __init__ doesn't complete.  Fix it by adding a
try/except to __del__.
2003-05-29 14:36:57 +00:00
Martin v. Löwis
a94568a753 Patch #734231: Update RiscOS support. In particular, correct
riscospath.extsep, and use os.extsep throughout.
2003-05-10 07:36:56 +00:00
Fred Drake
70d566be10 Extract the errno value to use from the errno module if possible. 2003-04-29 19:50:25 +00:00
Skip Montanaro
c689918c94 Regain throughput lost with the _socketobject wrapper. The
throughput-sensitive methods are grabbed from the underlying _socket.socket
object.  Closes SF patch 729293.
2003-04-29 19:27:26 +00:00
Guido van Rossum
47dfa4a89a Patch by Jp Calderone:
- The socket module now provides the functions inet_pton and inet_ntop
  for converting between string and packed representation of IP addresses.
  See SF patch #658327.

This still needs a bit of work in the doc area, because it is not
available on all platforms (especially not on Windows).
2003-04-25 05:48:32 +00:00
Skip Montanaro
89feabc7f5 The socket module now always uses the _socketobject wrapper class, even on
platforms which have dup(2).  The makefile() method is built directly on top
of the socket without duplicating the file descriptor, allowing timeouts to
work properly.  Includes a new test case (urllibnet) which requires the
network resource.

Closes bug 707074.
2003-03-30 04:54:24 +00:00
Guido van Rossum
dbfb12148d On Windows, make sure SocketType is the same as socket. (SF bug
598097)
2002-08-22 17:31:16 +00:00
Tim Peters
d7e8a0dd37 Delete junk attributes left behind by _socketobject class construction. 2002-08-08 20:07:03 +00:00