summaryrefslogtreecommitdiff
path: root/Modules/socketmodule.c
AgeCommit message (Collapse)AuthorLines
2001-12-23backport of 1.196: socket.recv(-1) fixup.Anthony Baxter-0/+5
2001-11-01wrap SSL_read and SSL_write in Py_{BEGIN,END}_ALLOW_THREADS.Anthony Baxter-0/+4
other half of backport of guido's 1.188
2001-11-01partial backport of guido's 1.188.Anthony Baxter-2/+40
Add sendall() method, which loops until all data is written or an 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().) the 'partial' is because 1.188 also added a couple of Py_*_ALLOW_THREADS wrappers around SSL_read and SSL_write, and I want to check those separately. This is adding a new method to the socket object, which would normally be a bad thing to do in a bugfix release - however, in this case, it allows fixes for a nasty problem that would otherwise have a filthy filthy fix to Get It Right. Still to-do is to patch the std library modules to use sendall() where appropriate, rather than send().
2001-11-01backport of MvL's 1.180Anthony Baxter-1/+1
Test for __sun instead of __sun__, since SUNWspro only defines the latter; gcc defines both. ...must get sparc box at home out of cupboard for testing this stuff...
2001-11-01backport tim's 1.191:Anthony Baxter-1/+6
PySocketSock_connect_ex(): On Windows, return the correct Windows exit code. The patch is from Jeremy, and allows test_asynchat to run again.
2001-11-01backport (partially) jeremy's 1.178Anthony Baxter-1/+1
Use PySocket_Err() instead of PyErr_SetFromErrno(). The former does the right thing on Windows, the latter does not. The 'partial' is because the code's changed quite a lot and it's not clear that the two that are still there of the form return PyErr_SetFromErrno(SSLErrorObject); can be replaced with PySocket_Err() - it looks like they need the new PySSL_SetError, which is a tad large to be comfortable with just checking in without reading it further.
2001-10-19Fix leak in SSLread in nonblocking mode -- from SF bug #472798.Guido van Rossum-0/+1
(Not a merge from the code on the trunk -- the trunk has evolved perhaps too much.)
2001-05-09Three uses of makesockaddr() used sockaddr buffers that had not be cleared;Fred Drake-0/+3
this could cause invalid paths to be returned for AF_UNIX sockets on some platforms (including FreeBSD 4.2-RELEASE), appearantly because there is no assurance that the address will be nul-terminated when filled in by the kernel. This closes SF bug #416573.
2001-04-16Reverting Moshe's EGD patch *and* Martin's patch to make it work withGuido van Rossum-34/+0
OpenSSL versions beore 0.9.5. This just is too experimental to be worth it, especially since the user would have to do some severe hacking of the Modules/Setup file to even enable the EGD code, and without the EGD code it would always spit out a warning on some systems -- even when socket.ssl() is not used. Fixing that properly is not my job; the EGD patch is clearly not so important that it should hold up the 2.1 release.
2001-04-13I am TENTATIVELY checking in Martin von Loewis's patch for the SSLGuido van Rossum-0/+7
problem reported by Neil Schemenauer on python-dev on 4/12/01, wth subject "Problem with SSL and socketmodule on Debian Potato?". It's tentative because Moshe objected, but Martin rebutted, and Moshe seems unavailable for comments. (Note that with OpenSSL 0.9.6a, I get a lot of compilation warnings for socketmodule.c -- I'm assuming I can safely ignore these until 2.1 is released.)
2001-03-18Committing patch 405101Moshe Zadka-0/+27
2001-03-02RISCOS changes by dschwertberger.Guido van Rossum-104/+175
2001-02-07Remove the optional integer argument to SSL_write; now it will always sendAndrew M. Kuchling-5/+2
the entire string passed to it
2001-02-06Patch #103636: Allow writing strings containing null bytes to an SSL socketAndrew M. Kuchling-1/+1
2001-02-02fix a couple last-minute bugs in the raw socket supportJeremy Hylton-24/+24
2001-02-02SF patch 101137 from Grant EdwardsJeremy Hylton-3/+93
Adds support for raw packets (AF_PACKET) under Linux. I haven't tested this code thoroughly; it compiles and the basic calls all work without crashing. Not sure what to actually do with raw sockets though. Not sure what other platforms this might be useful for.
2001-02-01An ssl-wrapped socket now returns '' on EOF, just like a regularJeremy Hylton-7/+4
socket -- as suggested by Clarence Gardner. Fix httplib to comply with the new ssl-socket interface.
2001-01-22SF Patch #103185, by jlt63: Some more standard modules cleanup for CygwinGuido van Rossum-1/+4
2001-01-18Use openssl/*.h to include the OpenSSL header filesAndrew M. Kuchling-6/+6
2000-12-18Adapted from a patch by Barry Scott, SF patch #102875 and SF bugGuido van Rossum-3/+4
#125981: closing sockets was not thread-safe.
2000-12-01Patch by Michael Hudson to clarify the error message fromGuido van Rossum-1/+7
getsockaddrarg when the address is not a tuple.
2000-10-06Norman Vine <nhv@users.sourceforge.net>:Fred Drake-1/+1
tcp.h is not available on CygWin, so do not try to include it there. This closes SourceForge patch #101802.
2000-08-16Remove a lot of the confusing conditional compilation from the beginningFred Drake-47/+4
of the init_socket() function. This module is now *always* _socket.
2000-08-03Remobe beopen/cnri/cwi copyrights, according to CNRI instructions.Guido van Rossum-10/+0
This doesn't change the copyright status for these files -- just the markings! Doing it on the main branch for these three files for which the HEAD revision was pushed back into 1.6.
2000-08-03Use METH_VARARGS instead of numeric constant 1 in method def. tablesAndrew M. Kuchling-34/+49
2000-07-31merge Include/my*.h into Include/pyport.hPeter Schneider-Kamp-1/+0
marked my*.h as obsolete
2000-07-25Use 'void' directly instead of the ANY #define, now that all code is ANSI C.Thomas Wouters-4/+4
Leave the actual #define in for API compatibility.
2000-07-24Remove unused variable and what looks like an ancient relic of an oldThomas Wouters-7/+0
version of SSLeay (now known as OpenSSL.)
2000-07-24Create a new section of pyport.h to hold all external function declarationsThomas Wouters-11/+2
for systems that are missing those declarations from system include files. Start by moving a pointy-haired ones from their previous locations to the new section. (The gethostname() one, for instance, breaks on several systems, because some define it as (char *, size_t) and some as (char *, int).) I purposely decided not to include the summary of used #defines like Tim did in the first section of pyport.h. In my opinion, the number of #defines likedly to be used by this section would make such an overview unwieldy. I would suggest documenting the non-obvious ones, though.
2000-07-24Patch #100926 - Better error messages for socket exceptions on Windows. ↵Mark Hammond-2/+78
[Slight style differences from posted patch]
2000-07-22Even more ANSIfication: fix as many function pointers and declarations asThomas Wouters-1/+1
possible.
2000-07-21Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',Thomas Wouters-8/+6
and a couple of functions that were missed in the previous batches. Not terribly tested, but very carefully scrutinized, three times. All these were found by the little findkrc.py that I posted to python-dev, which means there might be more lurking. Cases such as this: long func(a, b) long a; long b; /* flagword */ { and other cases where the last ; in the argument list isn't followed by a newline and an opening curly bracket. Regexps to catch all are welcome, of course ;)
2000-07-11Errare humanum est.Peter Schneider-Kamp-1/+1
Changed parameter in getsockaddrlen from unsigned to socklen_t.
2000-07-11fixed a warning in getsockaddrlenPeter Schneider-Kamp-1/+1
2000-07-09- ANSI-ificationFredrik Lundh-94/+47
(patch #100770 by Peter Schneider-Kamp)
2000-07-09Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters-1/+1
2000-07-07Removed a prototype which is not used in socketmodule.cMarc-André Lemburg-1/+0
Patch by T. Wouters.
2000-07-01Restore strict checking of socket address values; addresses passed toFred Drake-15/+21
the bind(), connect(), and connect_ex() methods must be a single parameter. Originally part of 1.98, reverted in 1.100.
2000-06-30Change copyright notice - 2nd try.Guido van Rossum-6/+0
2000-06-30Change copyright notice.Guido van Rossum-21/+6
2000-06-30Trent Mick <trentm@activestate.com>:Fred Drake-13/+46
This patch fixes possible overflows in the socket module for 64-bit platforms (mainly Win64). The changes are: - abstract the socket type to SOCKET_T (this is SOCKET on Windows, int on Un*x), this is necessary because sizeof(SOCKET) > sizeof(int) on Win64 - use INVALID_SOCKET on Win32/64 for an error return value for accept() - ensure no overflow of the socket variable for: (1) a PyObject return value (use PyLong_FromLongLong if necessary); and (2) printf formatting in repr(). Closes SourceForge patch #100516.
2000-05-16Donn Cave <donn@oz.net>:Fred Drake-0/+2
BeOS (up to 5.0) lacks <netinet/tcp.h>.
2000-05-03Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum-9/+9
For more comments, read the patches@python.org archives. For documentation read the comments in mymalloc.h and objimpl.h. (This is not exactly what Vladimir posted to the patches list; I've made a few changes, and Vladimir sent me a fix in private email for a problem that only occurs in debug mode. I'm also holding back on his change to main.c, which seems unnecessary to me.)
2000-04-25Fix typo in last patch -- the symbol's name is MSG_DONWAIT, notGuido van Rossum-1/+1
MSG_DONTWAIT. Reported by Fredrik Lundh.
2000-04-25Patch by Charles G Waldman:Guido van Rossum-1/+4
1) Adds MSG_DONTWAIT if defined (I needed this) 2) Spells "coreectly" correctly ;-)
2000-04-24Jack Jansen: The GUSI 2.0 I/O library used on the Mac uses theGuido van Rossum-9/+15
socklen_t (unsigned int) for most size parameters. Apparently this is part of the UNIX 98 standard. [GvR: the changes to configure.in etc. that I just checked in make sure that socklen_t is defined everywhere, so I deleted the little part of Jack's mod to define socklen_t if not in GUSI2. I suppose I will have to add it to the Windows config.h in a minute.]
2000-04-21Use an explicit macro SOCKETCLOSE which expands to closesocket (onGuido van Rossum-10/+14
Windows), soclose (on OS2), or to close (everywhere else). Hopefully this fixes a new compilation error that I suddenly get on Windows because the macro definition for close -> closesocket apparently was done before including io.h, which contains a prototype for close. (No idea why this wasn't an error before.)
2000-04-10In dealloc(), only close the socket if fd != -1.Guido van Rossum-1/+2
2000-04-04Add warning that multi-arg connect() etc. are deprecated.Guido van Rossum-1/+1
2000-04-04Put back multi-arg capability on connect/connect_ex/bind, forGuido van Rossum-21/+15
backwards compatibility, and to avoid a revolution.