summaryrefslogtreecommitdiff
path: root/ext/socket
AgeCommit message (Collapse)Author
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
2018-07-24UNREACHABLE_RETURNnobu
* include/ruby/ruby.h (UNREACHABLE_RETURN): UNREACHABLE at the end of non-void functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-25comma at the end of enum is a C99ismshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-24UNIXSocket#recv_io: trigger GC when out of FDsnormal
Make this behavior is consistent with our other FD-allocating methods. EMFILE and ENFILE are not documented nor can I trigger them when using UNIXSocket#recv_io. However, ENOMEM is documented, and I've triggered EMSGSIZE on FreeBSD and truncated messages when an EMFILE condition is hit on my system. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-30io.c: workaround for EPROTOTYPEnobu
* io.c (internal_write_func, internal_writev_func): retry at unexpected EPROTOTYPE on macOS, to get rid of a kernel bug. [ruby-core:86690] [Bug #14713] * ext/socket/init.c (rsock_{sendto,send,write}_blocking): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28unixsocket.c: abstract namespacenobu
* ext/socket/unixsocket.c (unixsock_path_value): fix r62991 for Linux abstract namespace. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28unixsocket.c: check NUL bytesnobu
* ext/socket/unixsocket.c (rsock_init_unixsock): check NUL bytes. https://hackerone.com/reports/302997 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-02search winsock libraries explicitlynobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-27Refactor ERB version checking for keyword argumentsk0kubun
Improving code like r62590. See r62529 for details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22erb.rb: deprecate safe_level of ERB.newk0kubun
Also, as it's in the middle of the list of 4 arguments, 3rd and 4th arguments (trim_mode, eoutvar) are changed to keyword arguments. Old ways to specify arguments are deprecated and warned now. bin/erb: deprecate -S option. We'll remove all of deprecated ones at Ruby 2.7+. enc/make_encmake.rb: stopped using deprecated interface ext/etc/mkconstants.rb: ditto ext/socket/mkconstants.rb: ditto sample/ripper/ruby2html.rb: ditto spec/ruby/library/erb/defmethod/def_erb_method_spec.rb: ditto spec/ruby/library/erb/new_spec.rb: ditto test/erb/test_erb.rb: ditto test/erb/test_erb_command.rb: ditto tool/generic_erb.rb: ditto tool/ruby_vm/helpers/dumper.rb: ditto tool/transcode-tblgen.rb: ditto lib/rdoc/erbio.rb: ditto lib/rdoc/generator/darkfish.rb: ditto [Feature #14256] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-17socket.rb: protected connect_internalnobu
* ext/socket/lib/socket.rb (Addrinfo#connect_internal): make protected for Addrinfo#connect_to, instead of private and send. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-23init.c: encode socket error messagenobu
* ext/socket/init.c (rsock_raise_socket_error): on Windows, encode error messages from wide characters to the default encodings. [ruby-core:84972] [Bug #14384] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-23getaddrinfo.c: ai_errlistnobu
* ext/socket/getaddrinfo.c (ai_errlist): used only if gai_strerror is missing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-15raddrinfo.c: fix parse_numeric_portnobu
* ext/socket/raddrinfo.c (parse_numeric_port): necessary regardless of GETADDRINFO_EMU. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-22ifaddr.c: get_ifaddrsnobu
* ext/socket/ifaddr.c (get_ifaddrs): extract ifaddrs from Socket::Ifaddr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-04ifaddr.c: fix memsizenobu
* ext/socket/ifaddr.c (ifaddr_memsize): do not count the whole rb_ifaddr_t array for each elements. the header size is included in the first element for the time being. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-03ifaddr.c: unused membernobu
* ext/socket/ifaddr.c (struct rb_ifaddr_tag): removed set but unused member root. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e