summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Update the module doc comment.Guido van Rossum2002-09-031-1/+3
|
* SF bug #592645 fix memory leak in socket.getaddrinfoNeal Norwitz2002-08-091-0/+2
|
* The other half of the patches added to SF patch 555085 by A IGuido van Rossum2002-08-081-0/+2
| | | | | | MacIntyre. At least on OS/2, a subsequent connect() on a nonblocking socket returns errno==EISCONN to indicate success. This seems harmless on Unix.
* Clean up some docstrings. Some docstrings didn't show their returnGuido van Rossum2002-08-081-10/+11
| | | | | | value; others were inconsistent in what to name the argument or return value; a few module-global functions had "socket." in front of their name, against convention.
* internal_connect(): Windows. When sock_timeout > 0 and connect() yieldsTim Peters2002-08-061-6/+14
| | | | | | | WSAEWOULDBLOCK, the second connect() attempt appears to yield WSAEISCONN on Win98 but WSAEINVAL on Win2K. So accept either as meaning "yawn, fine". This allows test_socket to succeed on my Win2K box (which it already did on my Win98SE box).
* Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototypeMark Hammond2002-08-021-1/+1
| | | | | | for Py_Main(). Thanks to Kalle Svensson and Skip Montanaro for the patches.
* Pass length of result structure into setipaddr. Fixes bug #565747.Martin v. Löwis2002-07-281-8/+12
| | | | Committed to 2.2 branch.
* Put checks for error returns in the right place.Jeremy Hylton2002-07-251-2/+8
|
* Extended socket.htonl and ntohl to accept longs.Jeremy Hylton2002-07-251-15/+53
| | | | | | | Fixes SF bug #568322. The code should raise an OverflowError if the long is > 32 bits, even on platforms where sizeof(long) > 4.
* Replace DL_IMPORT with PyMODINIT_FUNC and remove "/export:init..." linkMark Hammond2002-07-231-1/+1
| | | | | command line for Windows builds. This should allow MSVC to import and build the Python MSVC6 project files without error.
* Bail out early from internal_select() when socket file descriptorGuido van Rossum2002-07-191-0/+5
| | | | closed. Prevents core dump.
* A Python float is a C double; redeclare defaulttimeout as such; stopsTim Peters2002-07-181-1/+1
| | | | compiler wngs on Windows.
* Silence warning about getdefaulttimeout in PyMethodDef.Guido van Rossum2002-07-181-1/+1
|
* Add default timeout functionality. This adds setdefaulttimeout() andGuido van Rossum2002-07-181-1/+65
| | | | | getdefaulttimeout() functions to the socket and _socket modules, and appropriate tests.
* staticforward bites the dust.Jeremy Hylton2002-07-171-1/+1
| | | | | | | | | | | | | | | The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation.
* Mac OS X Jaguar (developer preview) seems to have a working getaddrinfo().Jack Jansen2002-07-021-0/+5
|
* Patch #568124: Add doc string macros.Martin v. Löwis2002-06-131-82/+82
|
* Fix non-blocking connect() for Windows. Refactored the codeGuido van Rossum2002-06-131-27/+40
| | | | | | | | | | | that retries the connect() call in timeout mode so it can be shared between connect() and connect_ex(), and needs only a single #ifdef. The test for this was doing funky stuff I don't approve of, so I removed it in favor of a simpler test. This allowed me to implement a simpler, "purer" form of the timeout retry code. Hopefully that's enough (if you want to be fancy, use non-blocking mode and decode the errors yourself, like before).
* Major overhaul of timeout sockets:Guido van Rossum2002-06-131-219/+58
| | | | | | | | | | | | | | | | | | | | - setblocking(0) and settimeout(0) are now equivalent, and ditto for setblocking(1) and settimeout(None). - Don't raise an exception from internal_select(); let the final call report the error (this means you will get an EAGAIN error instead of an ETIMEDOUT error -- I don't care). - Move the select to inside the Py_{BEGIN,END}_ALLOW_THREADS brackets, so other theads can run (this was a bug in the original code). - Redid the retry logic in connect() and connect_ex() to avoid masking errors. This probably doesn't work for Windows yet; I'll fix that next. It may also fail on other platforms, depending on what retrying a connect does; I need help with this. - Get rid of the retry logic in accept(). I don't think it was needed at all. But I may be wrong.
* work around name clash with OS/2 TCPIP routine sock_init()Andrew MacIntyre2002-06-131-2/+2
|
* Move the conex_finally label up, so that the errno value is alwaysGuido van Rossum2002-06-071-1/+1
| | | | returned.
* I decided to change the interaction between setblocking() andGuido van Rossum2002-06-071-5/+2
| | | | | | | | | | settimeout(). Already, settimeout() canceled non-blocking mode; now, setblocking() also cancels the timeout. This is easier to document. (XXX should settimeout(0) be an alias for setblocking(0)? They seem to have roughly the same effect. Also, I'm not sure that the code in connect() and accept() is correct in all cases. We'll sort this out soon enough.)
* Major cleanup. Renamed static methods to avoid Py prefix. Other miscGuido van Rossum2002-06-071-296/+290
| | | | cleanup as well, e.g. renamed NTinit to os_init.
* Whitespace normalization, folding long lines, uniform commentGuido van Rossum2002-06-071-224/+229
| | | | delimiters. Also repaired some docstrings and comments.
* Correct several blunders in the timeout code, mostly my own fault (forGuido van Rossum2002-06-071-14/+12
| | | | | | | | | | | | | | | | | | | | | not testing it -- apparently test_timeout.py doesn't test anything useful): In internal_select(): - The tv_usec part of the timeout for select() was calculated wrong. - The first argument to select() was one too low. - The sense of the direction argument to internal_select() was inverted. In PySocketSock_settimeout(): - The calls to internal_setblocking() were swapped. Also, repaired some comments and fixed the test for the return value of internal_select() in sendall -- this was in the original patch.
* SF patch 555085 (timeout socket implementation) by Michael Gilfix.Guido van Rossum2002-06-061-54/+420
| | | | | | | | | | | | | I've made considerable changes to Michael's code, specifically to use the select() system call directly and to store the timeout as a C double instead of a Python object; internally, -1.0 (or anything negative) represents the None from the API. I'm not 100% sure that all corner cases are covered correctly, so please keep an eye on this. Next I'm going to try it Windows before Tim complains. No way is this a bugfix candidate. :-)
* The insint() function is not used. Nuke it.Guido van Rossum2002-06-061-15/+0
|
* The tp_new implementation should initialize the errorhandler field,Guido van Rossum2002-06-061-1/+3
| | | | | | | | otherwise this code could segfault: from socket import socket s = socket.__new__(socket) s.recv(100)
* Repair widespread misuse of _PyString_Resize. Since it's clear peopleTim Peters2002-04-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate.
* PyObject_Del can now be used as a function designator.Neil Schemenauer2002-04-121-1/+1
|
* Got rid of ifdefs for long-obsolete GUSI versions.Jack Jansen2002-04-111-15/+0
|
* Use the PyModule_Add*() APIs instead of manipulating the module dictFred Drake2002-04-011-201/+217
| | | | directly.
* Remove last occurrance of PyArg_GetInt. It is deprecated,Neal Norwitz2002-03-251-1/+1
|
* Due to interaction between the MSL C library and the GUSI I/O library I can ↵Jack Jansen2002-03-251-0/+5
| | | | | | | | get reads from sockets to work consistently either for unbuffered binary files or for buffered binary files, but not for both:-( The workaround is to force socket.makefile() to disable buffering for binary files. Fixes bug 534625. 2.2.1 candidate.
* OS/2 EMX port changes (Modules part of patch #450267):Andrew MacIntyre2002-03-031-6/+11
| | | | | | | Modules/ socketmodule.c EMX handles sockets like Posix, rather than use native APIs
* Patch #520062: Support IPv6 with VC.NET.Martin v. Löwis2002-03-011-0/+3
|
* Moved the declaration of PySocketSock_Type from socketmodule.h toTim Peters2002-02-171-0/+5
| | | | | | | | | | | | socketmodule.c. No code outside of the .c file references it, so it doesn't belong the .h file (at least not yet ...), and declaring it an imported symbol in the .h file can't be made to work on Windows (it's a cross-DLL symbol then) without substantial code rewriting. Also repaired the comment that goes along with the decl, to stop referring to names and functions that haven't existed for 7 years <wink>. socketmodule.c compiles cleanly on Windows again. The test_socket dies at once, though (later).
* Remove extraneous variable 'total', as reported by James Rucker.Martin v. Löwis2002-02-161-2/+1
|
* Also fix the comment.Marc-André Lemburg2002-02-161-1/+1
|
* Fix the name of the header file.Marc-André Lemburg2002-02-161-1/+1
|
* Break SSL support out of _socket module and place it into a newMarc-André Lemburg2002-02-161-554/+93
| | | | | | | | | | | | | | | | | | helper module _ssl. The support for the RAND_* APIs in _ssl is now only enabled for OpenSSL 0.9.5 and up since they were added in that release. Note that socketmodule.* should really be renamed to _socket.* -- unfortunately, this seems to lose the CVS history of the file. Please review and test... I was only able to test the header file chaos in socketmodule.c/h on Linux. The test run through fine and compiles don't give errors or warnings. WARNING: This patch does *not* include changes to the various non-Unix build process files.
* Patch #477750: Use METH_ constants in Modules.Martin v. Löwis2002-01-171-2/+2
|
* Include <unistd.h> in Python.h. Fixes #500924.Martin v. Löwis2002-01-121-4/+0
|
* Add TCP socket options from glibc 2.2.4. Fixes #495680.Martin v. Löwis2001-12-221-0/+31
| | | | 2.2.1 bugfix candidate.
* Remove INET6 define. Use ENABLE_IPV6 instead.Martin v. Löwis2001-12-021-11/+11
|
* More sprintf -> PyOS_snprintf.Tim Peters2001-11-281-1/+2
|
* sprintf -> PyOS_snprintf in some "obviously safe" cases.Tim Peters2001-11-281-4/+7
| | | | | Also changed <>-style #includes to ""-style in some places where the former didn't make sense.
* Fix docstring typoAndrew M. Kuchling2001-11-281-1/+1
|
* Test for negative buffer sizes. Fixes #482871.Martin v. Löwis2001-11-191-0/+5
|
* Fixes to compile cPickle.c & socketmodule.c on cygwin and possiblyMichael W. Hudson2001-11-091-3/+6
| | | | | other platforms that have funny ideas about whether addresses of functions in dlls are compile-time constants.