summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Fix memory leaks detecting in bug report #478003.Martin v. Löwis2001-11-071-1/+5
|
* SF patch 473749 compile under OS/2 VA C++, from Michael Muller.Tim Peters2001-11-051-1/+4
| | | | Changes enabling Python to compile under OS/2 Visual Age C++.
* Correct getnameinfo refcounting and tuple parsing. Fixes #476648.Martin v. Löwis2001-11-021-6/+4
|
* PySocketSock_connect_ex(): On Windows, return the correct Windows exitTim Peters2001-10-301-1/+6
| | | | | code. The patch is from Jeremy, and allows test_asynchat to run again. Bugfix candidate.
* Oops. In the tp_name field, the name should be "_socket.socket", notGuido van Rossum2001-10-281-2/+2
| | | | | | "socket.socket" -- on Windows, "socket.socket" is the wrapper class. Also added the module name to the SSL type (which is not a new-style class -- I don't want to mess with it yet).
* Made SocketType and socket the same thing: a subclassable type whoseGuido van Rossum2001-10-271-119/+167
| | | | | | | | | | | | | | | | | | | | | constructor acts just like socket() before. All three arguments have a sensible default now; socket() is equivalent to socket(AF_INET, SOCK_STREAM). One minor issue: the socket() function and the SocketType had different doc strings; socket.__doc__ gave the signature, SocketType.__doc__ gave the methods. I've merged these for now, but maybe the list of methods is no longer necessary since it can easily be recovered through socket.__dict__.keys(). The problem with keeping it is that the total doc string is a bit long (34 lines -- it scrolls of a standard tty screen). Another general issue with the socket module is that it's a big mess. There's pages and pages of random platform #ifdefs, and the naming conventions are totally wrong: it uses Py prefixes and CapWords for static functions. That's a cleanup for another day... (Also I think the big starting comment that summarizes the API can go -- it's a repeat of the docstring.)
* Add sendall() method, which loops until all data is written or anGuido van Rossum2001-10-261-2/+44
| | | | | | | error occurs, and doesn't return a count. (This is my second patch from SF patch #474307, with small change to the docstring for send().) 2.1.2 "bugfix" candidate.
* After discussion with itojun, it was clarified that Tru64 is in error,Martin v. Löwis2001-10-251-1/+3
| | | | and that the work-around should be restricted to that system.
* SF patch #474590 -- RISC OS supportGuido van Rossum2001-10-241-15/+10
|
* Fix typo. Thanks to Jack Jansen for spotting it.Martin v. Löwis2001-10-241-1/+1
|
* Include netdb.h to detect getaddrinfo. Work around problem with getaddrinfoMartin v. Löwis2001-10-241-0/+6
| | | | not properly processing numeric IPv4 addresses. Fixes V5.1 part of #472675.
* (Hopefully) fix SF bug #472675: CVS socketmodule now doesn't compileGuido van Rossum2001-10-191-1/+1
| | | | | This appears to be a case of a missing \n\ in a multiline string literal.
* Expose three OpenSSL API calls for dealing with the PRNG.Jeremy Hylton2001-10-181-0/+67
| | | | | | | | | | | | | | | | | Quoth the OpenSSL RAND_add man page: OpenSSL makes sure that the PRNG state is unique for each thread. On systems that provide /dev/urandom, the randomness device is used to seed the PRNG transparently. However, on all other systems, the application is responsible for seeding the PRNG by calling RAND_add(), RAND_egd(3) or RAND_load_file(3). I decided to expose RAND_add() because it's general and RAND_egd() because it's a useful special case. RAND_load_file() didn't seem to offer much over RAND_add(), so I skipped it. Also supplied RAND_status() which returns true if the PRNG is seeded and false if not.
* Fix a bunch of warnings reported by Skip.Guido van Rossum2001-10-151-8/+8
| | | | | | | To whoever who changed a bunch of (PyCFunction) casts to (PyNoArgsFunction) in PyMethodDef initializers: don't do that. The cast is to shut the compiler up. The compiler wants the function pointer initializer to be a PyCFunction.
* Test for __sun instead of __sun__, since SUNWspro only defines the latter;Martin v. Löwis2001-10-131-1/+1
| | | | gcc defines both.
* PySocket_getaddrinfo(): fix two refcount bugs, both having to do withGuido van Rossum2001-10-121-3/+6
| | | | | | | | | | | a misunderstanding of the refcont behavior of the 'O' format code in PyArg_ParseTuple() and Py_BuildValue(), respectively. - pobj is only a borrowed reference, so should *not* be DECREF'ed at the end. This was the cause of SF bug #470635. - The Py_BuildValue() call would leak the object produced by makesockaddr(). (I found this by eyeballing the code.)
* Use PySocket_Err() instead of PyErr_SetFromErrno().Jeremy Hylton2001-10-111-3/+2
| | | | The former does the right thing on Windows, the latter does not.
* Commit parts of SF patch #462759Jeremy Hylton2001-10-111-68/+68
| | | | | | | | | | | | | | | Use #define X509_NAME_MAXLEN for server/issuer length on an SSL object. Update doc strings for socket.ssl() and ssl methods read() and write(). PySSL_SSLwrite(): Check return value and raise exception on error. Use int for len instead of size_t. (All the function the size_t obj was passed to our from expected an int!) PySSL_SSLread(): Check return value of PyArg_ParseTuple()! More robust checks of return values from SSL_read().
* Convert socket methods to use METH_O and METH_NOARGS where possible.Jeremy Hylton2001-10-111-50/+39
|
* Add a bunch of SSL error constantsJeremy Hylton2001-10-111-0/+12
|
* Lots of code reorganization with a few small API changes.Jeremy Hylton2001-10-101-45/+113
| | | | | | | | | | | | | | | | | | | | | | Change all the local names that start with SSL to start with PySSL. The OpenSSL library defines lots of calls that start with "SSL_". The calls for Python's SSL objects also started with "SSL_". This choice made it really confusing to figure out which calls were to the library and which calls were local to the file. Add PySSL_SetError() that sets an exception based on the information from SSL_get_error(). This function will eventually replace all the calls that set it with an error message that is based on the name of the call that failed rather than the reason it failed. (Example: If SSL_connect() failed it used to report "SSL_connect error" now it will offer a specific message about why SSL_connect failed.) XXX It might be helpful to augment the error message generated below with the name of the SSL function that generated the error. I expect it's obvious most of the time. Remove several unnecessary INCREFs in the module's constructor call. PyDict_SetItem() and friends do the INCREF for you.
* Do simple error checking before doing any SSL calls.Jeremy Hylton2001-10-101-5/+5
|
* USe PyObject_SetString() instead of PyObject_SetObject() in newSSLObject().Jeremy Hylton2001-10-101-14/+9
|
* In newSSLObject(), initialize the various members of an SSLObject to NULL.Jeremy Hylton2001-10-101-2/+8
| | | | | | | In SSL_dealloc(), free/dealloc them only if they're non-NULL. Fixes some obvious core dumps, but not sure yet if there are more semantics to the SSL calls that would affect the dealloc.
* A bit of reformatting to match the standard styleJeremy Hylton2001-10-101-7/+7
|
* Fix two memory leaks in socket.ssl().Jeremy Hylton2001-10-101-39/+29
| | | | | | | | | | | | | | | | | | | | | | | | XXX [1] These changes aren't tested very thoroughly, because regrtest doesn't do any SSL tests. I've done some trivial tests on my own, but don't really know how to use the key and cert files. In one case, an SSL-level error causes Python to dump core. I'll get the fixed in the next round of changes. XXX [2] The checkin removes the x_attr member of the SSLObject struct. I'm not sure if this is kosher for backwards compatibility at the binary level. Perhaps its safer to keep the member but keep it assigned to NULL. And the leaks? newSSLObject() called PyDict_New(), stored the result in x_attr without checking it, and later stored NULL in x_attr without doing anything to the dict. So the dict always leaks. There is no further reference to x_attr, so I just removed it completely. The error cases in newSSLObject() passed the return value of PyString_FromString() directly to PyErr_SetObject(). PyErr_SetObject() expects a borrowed reference, so the string leaked.
* SF bug [#456252] Python should never stomp on [u]intptr_t.Tim Peters2001-08-291-1/+1
| | | | | | | | | | | pyport.h: typedef a new Py_intptr_t type. DELICATE ASSUMPTION: That HAVE_UINTPTR_T implies intptr_t is available as well as uintptr_t. If that turns out not to be true, things must get uglier (C99 wants both, so I think it's an assumption we're *likely* to get away with). thread_nt.h, PyThread_start_new_thread: MS _beginthread is documented as returning unsigned long; no idea why uintptr_t was being used. Others: Always use Py_[u]intptr_t, never [u]intptr_t directly.
* SSL_dealloc(): Apply the change suggested in SF bug #425370 whichBarry Warsaw2001-08-201-1/+1
| | | | | changes the order of the free calls to be the reverse of the alloc calls. Closes that bug.
* It will always be a string, because it is created just before this call.Jeremy Hylton2001-08-201-1/+1
|
* Fix portability problems with glibc 2.0, as reported in #449157.Martin v. Löwis2001-08-151-0/+4
|
* Bump size of sprintf buffer. Suggested by Alex Coventry.Martin v. Löwis2001-08-121-1/+1
|
* Autotest for netpacket/packet.h, as it is not available on all Linux versions.Martin v. Löwis2001-08-101-6/+6
| | | | Depend AF_PACKET on HAVE_NETPACKET_PACKET_H. Fixes #449157