summaryrefslogtreecommitdiff
path: root/ext/socket
AgeCommit message (Collapse)Author
2020-10-28Use public allocators for creating new T_OBJECT objectsAaron Patterson
This way the header flags and object internals are set correctly Notes: Merged: https://github.com/ruby/ruby/pull/3719
2020-09-27ext/socket/ipsocket.c: prevent "warning: unused variable 'resolv_timeout'"Yusuke Endoh
2020-09-25Add comments for resolv_timeoutMasaki Matsushita
2020-09-25Add resolve_timeout to TCPSocket [Feature #17134]Masaki Matsushita
2020-08-29Show deprecation warning on Socket.gethostbyname and Socket.gethostbyaddrMasaki Matsushita
2020-08-28Show deprecation warning on TCPSocket.gethostbynameMasaki Matsushita
2020-08-27Adjust indents [ci skip]Nobuyoshi Nakada
2020-08-27sed -i '/rmodule.h/d'卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/3347
2020-08-27Make Socket.getaddrinfo interruptible (#2827)Kir Shatrov
Before, Socket.getaddrinfo was using a blocking getaddrinfo(3) call. That didn't allow to wrap it into Timeout.timeout or interrupt the thread in any way. Combined with the default 10 sec resolv timeout on many Unix systems, this can have a very noticeable effect on production Ruby apps being not resilient to DNS outages and timing out name resolution, and being unable to fail fast even with Timeout.timeout. Since we already have support for getaddrinfo_a(3), the async version of getaddrinfo, we should be able to make Socket.getaddrinfo leverage that when getaddrinfo_a version is available in the system (hence #ifdef HAVE_GETADDRINFO_A). Related tickets: https://bugs.ruby-lang.org/issues/16476 https://bugs.ruby-lang.org/issues/16381 https://bugs.ruby-lang.org/issues/14997 Notes: Merged-By: mmasaki <glass.saga@gmail.com>
2020-08-27sed -i '/r_cast.h/d'卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/3346
2020-08-27sed -i '\,2/extern.h,d'卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/3338
2020-05-14Thread scheduler for light weight concurrency.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3032 Merged-By: ioquatix <samuel@codeotaku.com>
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-04-27Fix a typo [ci skip]Kazuhiro NISHIYAMA
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <shyouhei@ruby-lang.org>
2020-03-31ext/socket/init.c: do not return uninitialized bufferYusuke Endoh
Resize string buffer only if some data is received in BasicSocket#read_nonblock and some methods. Co-Authored-By: Samuel Williams <samuel.williams@oriontransfer.co.nz>
2019-12-31Updated dependencies on internal/warnings.hNobuyoshi Nakada
Needed for `UNALIGNED_MEMBER_ACCESS` using `COMPILER_WARNING_`* macros. Notes: Merged: https://github.com/ruby/ruby/pull/2799
2019-12-26update dependencies卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/2711
2019-12-26decouple internal.h headers卜部昌平
Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies). Notes: Merged: https://github.com/ruby/ruby/pull/2711
2019-11-18Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans
This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-11-18Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans
This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-11-01Clean up implementation of SOCKSSocket, its confusing and undocumentedJustin McNally
Notes: Merged: https://github.com/ruby/ruby/pull/2539
2019-11-01Prefer libsocksd over libsocksJustin McNally
Notes: Merged: https://github.com/ruby/ruby/pull/2538
2019-11-01Support libsocksd socks library for SOCKSSocketJustin McNally
Notes: Merged: https://github.com/ruby/ruby/pull/2538
2019-09-10Support timeout for AddrinfoMasaki Matsushita
Addrinfo.getaddrinfo and .foreach now accepts :timeout in seconds as a keyword argument. If getaddrinfo_a(3) is available, the timeout will be applied for name resolution. Otherwise, it will be ignored. Socket.tcp accepts :resolv_timeout to use this feature. This commit is retry of 6382f5cc91ac9e36776bc854632d9a1237250da7. Test was failed on Solaris machines which don't have "http" in /etc/services. In this commit, use "ssh" instead.
2019-09-09Revert "Support timeout for Addrinfo"Masaki Matsushita
This reverts commit 6382f5cc91ac9e36776bc854632d9a1237250da7. test failed on Solaris.
2019-09-09Support timeout for AddrinfoMasaki Matsushita
Addrinfo.getaddrinfo and .foreach now accepts :timeout in seconds as a keyword argument. If getaddrinfo_a(3) is available, the timeout will be applied for name resolution. Otherwise, it will be ignored. Socket.tcp accepts :resolv_timeout to use this feature.
2019-08-29drop-in type check for rb_define_singleton_method卜部昌平
We can check the function pointer passed to rb_define_singleton_method like how we do so in rb_define_method. Doing so revealed many arity mismatches.
2019-08-27rb_ensure now free from ANYARGS卜部昌平
After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit deletes ANYARGS from rb_ensure, which also revealed many arity / type mismatches.
2019-08-16Hoisted out unixsocket_len, triming NUL chars from sun_pathNobuyoshi Nakada
2019-07-16Constified afamily functionsNobuyoshi Nakada
2019-07-14socket: use frozen string buffer when releasing GVLTanaka Akira
Thanks for the patch by normalperson (Eric Wong) [Bug #14204].
2019-07-14Include ruby/assert.h in ruby/ruby.h so that assertions can be thereNobuyoshi Nakada
2019-06-11* expand tabs.git
2019-06-11ext/socket/ipsocket.c: Use SO_REUSEADDR for local_host/portYusuke Endoh
Sometimes ruby/spec fails when trying to specify local_host and local_port for TCPSocket.open. https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris11s-sunc/ruby-master/log/20190610T192504Z.fail.html.gz
2019-05-23Suppress paranoid warnings for external/3rd-party librariesNobuyoshi Nakada
[Feature #15665]
2019-02-08Removed moving toplevel header since r12501nobu
Moving public headers was 12-years ago, no depend files would expect ruby.h in the top source directory now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-31Fix indents [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-29disable non-blocking pipes and sockets by defaultnormal
There seems to be a compatibility problems with Rails + Rack::Deflater; so we revert this incompatibility. This effectively reverts r65922; but keeps the bugfixes to better support non-blocking sockets and pipes for future use. [Bug #15356] [Bug #14968] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-22socket: disable nonblocking-by-default on win32normal
Perhaps this fixes test failures reported by Greg and k0kubun. However, the failure of certain tests to handle non-blocking I/O seems to indicate pre-existing problems on win32 platforms. Somebody knowledgeable about win32 should be able to fix it. [ruby-core:89973] [ruby-core:89976] [ruby-core:89977] [Bug #14968] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-22ext/socket/init.c (rsock_socket0): non-blocking for non-SOCK_NONBLOCKnormal
We need to make sockets non-blocking for systems without SOCK_CLOEXEC/SOCK_NONBLOCK macros at all. [ruby-core:89965] [Bug #14968] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-22io + socket: make pipes and sockets nonblocking by defaultnormal
All normal Ruby IO methods (IO#read, IO#gets, IO#write, ...) are all capable of appearing to be "blocking" when presented with a file description with the O_NONBLOCK flag set; so there is little risk of incompatibility within Ruby-using programs. The biggest compatibility risk is when spawning external programs. As a result, stdin, stdout, and stderr are now always made blocking before exec-family calls. This change will make an event-oriented MJIT usable if it is waiting on pipes on POSIX_like platforms. It is ALSO necessary to take advantage of (proposed lightweight concurrency (aka "auto-Fiber") or any similar proposal for network concurrency: https://bugs.ruby-lang.org/issues/13618 Named-pipe (FIFO) are NOT yet non-blocking by default since they are rarely-used and may introduce compatibility problems and extra syscall overhead for a common path. Please revert this commit if there are problems and if I am afk since I am afk a lot, lately. [ruby-core:89950] [Bug #14968] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-11Use friendlier terminology in rubysocket.h commentnobu
[Fix GH-2008] From: Juanito Fatas <juanito.fatas@shopify.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-11Revert "Use friendlier terminology in rubysocket.h comment"nobu
This reverts commit dcd41bbbdb021b5e0e74f8a33c2c58cecf595f29. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-11Use friendlier terminology in rubysocket.h commentnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-08ext/socket/init.c (wait_connectable): bail out early on some errorsnormal
This becomes necesary if sockets become non-blocking by default <https://bugs.ruby-lang.org/issues/14968>; but it's always been possible to make sockets non-blocking anyways. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-05fix a typo [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-05fix typonaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-05AIX doesn't set OptionLength for boolean optionsnaruse
https://rubyci.org/logs/rubyci.s3.amazonaws.com/aix71_ppc/ruby-trunk/log/20180904T103302Z.fail.html.gz https://www.ibm.com/support/knowledgecenter/ja/ssw_aix_72/com.ibm.aix.commtrf2/getsockopt.htm git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e