summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2018-05-01rexml: Suppress warningskou
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-30Use `&.` instead of modifier ifkazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28rexml: disable XPath 1.0 compatible "#{ELEMENT_NAME}" processing by defaultkou
It breaks backward compatibility than I thought. So it's disabled by default. It means that REXML's XPath processor isn't compatible with XPath 1.0. But it will be acceptable for users. We can enable it by specifying "strict: true" to REXML::XPathParser.new explicitly. * lib/rexml/xpath.rb, lib/rexml/xpath_parser.rb: Accept "strict: true" option. * test/rexml/test_contrib.rb, test/rexml/xpath/test_base.rb: Use not XPath 1.0 compatible behavior. * test/rexml/test_jaxen.rb: Use XPath 1.0 compatible behavior. * test/rss/test_1.0.rb, test/rss/test_dublincore.rb, spec/ruby/library/rexml/element/namespace_spec.rb, spec/ruby/library/rexml/element/namespaces_spec.rb, spec/ruby/library/rexml/element/prefixes_spec.rb: Enable again. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-25[DOC] Fix capitallizing [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-25common.rb: unused constantnobu
* lib/uri/common.rb (URI::HTML5ASCIIINCOMPAT): remove the constant which has been unused since r40460, and wrong since r49069 due to the operator precedence. [ruby-core:86678] [Bug #14711] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-23[DOC] URI::Generic#port returns Integer [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-22net/imap: set SO_KEEPALIVE on TCP socketsnormal
Otherwise connections (commonly on IDLE, but it could be any command) may never receive notifications of link errors. [ruby-core:86628] [Feature #14703] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-22rexml: Fix XPath bug of //#{ELEMENT_NAME}[#{POSITION}]kou
The position should be counted for each nodeset but the previous implementation counts position for union-ed nodeset. For example, "/a/*/*[1]" should be matched to "<c1/>" and "<c2/>" with the following XML. <a> <b> <c1/> </b> <b> <c2/> </b> </a> But the previous implementation just returns only "<c1/>". * lib/rexml/element.rb (REXML::Attributes#each_attribute): Support Enumerator for no block use. * lib/rexml/element.rb (REXML::Attributes#each): Support Enumerator for no block use. * lib/rexml/functions.rb (REXML::Functions.string): Support NaN again. * lib/rexml/xpath_parser.rb: Re-implement "Step" evaluator. It should evaluate "AxisSpecifier", "NodeTest" and "Predicate" in one step to respect position for each nodeset. * test/rexml/test_jaxen.rb: Enable more tests. Remained tests should be also enabled but it'll not be near future. * test/rexml/xpath/test_base.rb: Fix expected value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-22rexml: Fix XPath bug of /#{ELEMENT_NAME}kou
It doesn't mean that all elements which name "ELEMENT_NAME" with any namespace URI including null namespace URI. It means that all elements which name "ELEMENT_NAME" with null namespace URI. https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-NodeTest > if the QName does not have a prefix, then the namespace URI is null > (this is the same way attribute names are expanded). We need to use "*[local-name()='#{ELEMENT_NAME}']" for all elements which name "ELEMENT_NAME" with any namespace URI including null namespace URI in XPath 1.0. But it's inconvenient. So this change includes "*:#{LOCAL_NAME}" syntax support that is introduced since XPath 2.0. * lib/rexml/parsers/xpathparser.rb: Support "*:#{LOCAL_NAME}" syntax that is introduced since XPath 2.0. * lib/rexml/xpath_parser.rb: * Fix namespace URI processing for "#{ELEMENT_NAME}". Now, "#{ELEMENT_NAME}" doesn't accept elements with null namespace URI. * Add "*:#{LOCAL_NAME}" support. * test/rexml/test_contrib.rb, test/rexml/test_core.rb, test/rexml/xpath/test_base.rb: Follow this change. * test/rexml/test_jaxen.rb: Fix namespace processing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21Improve docs for URI librarystomar
* lib/uri/generic.rb: [DOC] fix invalid example code to make it syntax highlighted; drop unnecessary `puts', `p'; adapt to current inspect format without Object id; do not display unnecessary return values in examples; fix or prevent unintended description lists; fix broken RDoc; fix grammar and typos. * lib/uri.rb: ditto. * lib/uri/common.rb: ditto. * lib/uri/file.rb: ditto. * lib/uri/ftp.rb: ditto. * lib/uri/http.rb: ditto. * lib/uri/ldap.rb: ditto. * lib/uri/mailto.rb: ditto. * lib/uri/rfc2396_parser.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21rexml: Fix XPath concat() implementationkou
* lib/rexml/functions.rb (REXML::Functions.concat): Implement. * test/rexml/test_jaxen.rb: Enable one more test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21rexml: Fix XPath string() implementationkou
* lib/rexml/functions.rb( REXML::Functions.string): * Support context node. * Fix implementation for document node to remove out of root nodes. * Support processing instruction node. * Improve implementation for integer to omit decimals. * test/rexml/test_jaxen.rb: Enable processing instruction test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19rexml: Fix a XPath bug that white spaces aren't ignoredkou
lib/rexml/parsers/xpathparser.rb: Ignore white spaces in relative location path. test/rexml/xpath/test_base.rb: Add more test patterns and use more debug friendly assertion style. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17lib/uri/generic.rb: fix error in docs for URI::Generic#opaquestomar
* lib/uri/generic.rb: [DOC] fix description of URI::Generic#opaque, and add an example. According to RFC2396, opaque path components do not use the slash "/" character, as opposed to hierarchical path components. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17lib/uri/ldap.rb: fix errors in docs for URI::LDAPstomar
* lib/uri/ldap.rb: [DOC] fix errors in example code for URI::LDAP.build and URI::LDAP.new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17lib/uri/file.rb: fix errors in docs for URI::File.buildstomar
* lib/uri/file.rb: [DOC] fix description and example for URI::File.build; for file URIs the path component must be absolute, escaping of absolute paths is only done for URI::FTP. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17lib/uri/file.rb: improve docs for URI::Filestomar
* lib/uri/file.rb: [DOC] fix invalid example code for URI::File.build to make it syntax highlighted; drop unnecessary `puts'; fix unintended description list; fix typos. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-16[DOC] Fix links of cve [ci skip]k0kubun
`http://www.cve.mitre.org/` seem to move `http://cve.mitre.org/`. I can't access `http://www.cve.mitre.org/`. [Fix GH-1857] From: willnet <netwillnet@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-14lib/fileutils.rb: [DOC] fix typos and grammarstomar
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-14irb.rb: restore the last errornobu
* lib/irb.rb (eval_input): restore the last error `$!`, as the previous result. [Feature #14684] * lib/irb/context.rb (evaluate): add `exception` keyword argument to set the last error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-14irb/{context,workspace}.rb: use local_variable_setnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-14irb/context.rb: using input-methodnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-13irb.rb: backtrace ordernobu
* lib/irb.rb (handle_exception): show backtrace from the topmost if stdout is not a tty. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-13irb.rb: hoist out handle_exceptionnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-09rexml: Fix a XPath bug of -kou
[Bug #14600] * lib/rexml/parsers/xpathparser.rb: Fix a bug that "N-M" requires a space before "-". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-05lib/rubygems/test_case.rb: take over @gem_prelude_indexmame
Gem::TestCase normalizes each path in $LOAD_PATH, which deleted the flag of @gem_prelude_index. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04rexml: Fix a XPath bug of /child::node()kou
[Bug #14600] * lib/rexml/xpath_parser.rb: Fix a bug that "/child::node()" returns XML declaration and text nodes out of root element. * test/rexml/test_jaxen.rb: Enable more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04rexml: Add codes for debugging XPath logickou
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04rexml: Fix a XPath bug of function()/pathkou
[Bug #14600] * lib/rexml/functions.rb: Fix a bug that "function()/path" always returns nothing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04rexml: Fix a XPath bug of @attribute/parentkou
[Bug #14600] * lib/rexml/functions.rb: Fix a bug that "@attribute/parent" doesn't return element of its attribute. * test/rexml/test_jaxen.rb: Enable more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04rexml: Fix a XPath bug of $variablekou
[Bug #14600] * lib/rexml/functions.rb: Fix a bug that "$variable" returns node instead of ndoe set. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03rexml: Fix a XPath bug of name(node-set)kou
[Bug #14600] * lib/rexml/functions.rb: Fix a bug that "name(node-set)" returns element instead of element name. * test/rexml/test_jaxen.rb: Enable more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03repatch r62966 and r62969.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03Revert r62966 and r62969naruse
It breaks mswin's test-all git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-02Improve mkmf error messagenobu
* lib/mkmf.rb: Improve the error message when ruby.h is missing, to suggest installing separate packages. [Feature #14656] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-02Keep feature names loaded in the blocknobu
* lib/rubygems/test_case.rb (Gem::TestCase#save_loaded_features): keep feature names for rubygem libraries loaded in the block. c.f. rubygems/rubygems#2261 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-02Fix typo on URI.hierarchical? [ci skip]nobu
* lib/uri/generic.rb (hierarchical?): [DOC] Fix typo in the description. [Fix GH-1851] From: Harry Llewelyn <advocation@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-01Start re-enabling Jaxen testskou
[Bug #14600] Reported by MSP-Greg. Thanks!!! * lib/rexml/xpath_parser.rb: Fix a bug that "following_siblings::*[N]" doesn't work. * test/rexml/test_jaxen.rb: Enable only axis test for now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28get rid of test error/failure on Windows introduced at r62955usa
* lib/webrick/httpresponse.rb (send_body_io): use seek if NotImplementedError is raised in IO.copy_stream with offset. * lib/webrick/httpservlet/filehandler.rb (multipart_body): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28Use Regexp#match? in time.rb for conditionalsnobu
[Fix GH-1852] From: Bart <bartdewater@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28Ignore file separator from tmpfile/tmpdir name.hsbt
From: SHIBATA Hiroshi <hsbt@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28webrick: prevent response splitting and header injectionnormal
Original patch by tenderlove (with minor style adjustments). * lib/webrick/httpresponse.rb (send_header): call check_header (check_header): raise on embedded CRLF in header value * test/webrick/test_httpresponse.rb (test_prevent_response_splitting_headers): new test * (test_prevent_response_splitting_cookie_headers): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28webrick/httpproxy: stream request and response bodiesnormal
Reading entire request or response bodies into memory can lead to trivial denial-of-service attacks. Introduce Fibers in both cases to allow streaming. WEBrick::HTTPRequest gains a new body_reader method to prepare itself as a source for IO.copy_stream. This allows the WEBrick::HTTPRequest object to be used as the Net::HTTPGenericRequest#body_stream= arg for Net::HTTP. For HTTP proxy response bodies, we also use a Fiber to to make the HTTP request and read the response body. * lib/webrick/httprequest.rb (body_reader): new method (readpartial): ditto * lib/webrick/httpproxy.rb (perform_proxy_request): use Fiber to stream response body (do_GET, do_HEAD): adjust call (do_POST): adjust call and supply body_reader * test/webrick/test_httprequest.rb (test_chunked): test for IO.copy_stream compatibility * test/webrick/test_httpproxy.rb (test_big_bodies): new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28webrick/httpauth/digestauth: stream req.bodynormal
WARNING! WARNING! WARNING! LIKELY BROKEN CHANGE Pass a proc to WEBrick::HTTPRequest#body to avoid reading a potentially large request body into memory during authentication. WARNING! this will break apps completely which want to do something with the body besides calculating the MD5 digest of it. Also, keep in mind that probably nobody uses "auth-int". Servers such as Apache, lighttpd, nginx don't seem to support it; nor does curl when using POST/PUT bodies; and we didn't have tests for it until now... * lib/webrick/httpauth/digestauth.rb (_authenticate): stream req.body git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28webrick/httprequest: use InputBufferSize for chunked requestsnormal
While WEBrick::HTTPRequest#body provides a Proc interface for streaming large request bodies, clients must not force the server to use an excessively large chunk size. * lib/webrick/httprequest.rb (read_chunk_size): limit each read and block.call to :InputBufferSize in config. * test/webrick/test_httpserver.rb (test_big_chunks): new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28webrick/httprequest: raise correct exceptionnormal
"BadRequest" alone does not resolve correctly, it is in the HTTPStatus namespace. * lib/webrick/httprequest.rb (read_chunked): use correct exception * test/webrick/test_httpserver.rb (test_eof_in_chunk): new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28webrick/httpservlet/cgihandler: reduce memory usenormal
WEBrick::HTTPRequest#body can be passed a block to process the body in chunks. Use this feature to avoid building a giant string in memory. * lib/webrick/httpservlet/cgihandler.rb (do_GET): avoid reading entire request body into memory (do_POST is aliased to do_GET, so it handles bodies) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28webrick/httprequest: limit request headers sizenormal
We use the same 112 KB limit started (AFAIK) by Mongrel, Thin, and Puma to prevent malicious users from using up all the memory with a single request. This also limits the damage done by excessive ranges in multipart Range: requests. Due to the way we rely on IO#gets and the desire to keep the code simple, the actual maximum header may be 4093 bytes larger than 112 KB, but we're splitting hairs at that point. * lib/webrick/httprequest.rb: define MAX_HEADER_LENGTH (read_header): raise when headers exceed max length git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28webrick: use IO.copy_stream for multipart responsenormal
Use the new Proc response body feature to generate a multipart range response dynamically. We use a flat array to minimize object overhead as much as possible; as many ranges may fit into an HTTP request header. * lib/webrick/httpservlet/filehandler.rb (multipart_body): new method (make_partial_content): use multipart_body git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28webrick/httpresponse: make ChunkedWrapper copy_stream-compatiblenormal
The .write method needs to return the number of bytes written to avoid confusing IO.copy_stream. * lib/webrick/httpresponse.rb (ChunkedWrapper#write): return bytes written (ChunkedWrapper#<<): return self git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e