rhodes 3.2.0.beta.4 → 3.2.0.beta.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/Manifest.txt +517 -23
- data/Rakefile +52 -7
- data/doc/build.txt +7 -1
- data/doc/device-caps.txt +1 -1
- data/doc/install.txt +12 -0
- data/doc/jqt-jqm-transition.txt +121 -0
- data/doc/release.txt +6 -1
- data/doc/ui.txt +4 -2
- data/installer/icon.ico +0 -0
- data/lib/extensions/barcode/ext/barcode/shared/src/zbar.c +7 -0
- data/lib/extensions/barcode/ext/barcode/shared/zbar/rho_bridge.c +3 -3
- data/lib/extensions/barcode/ext/barcode/shared/zbar/zbar/README.TXT +74 -3
- data/lib/extensions/fcntl/ext/Rakefile +57 -38
- data/lib/extensions/fcntl/ext/build.bat +1 -0
- data/lib/extensions/fcntl/ext/fcntl.vcproj +323 -0
- data/lib/extensions/fileutils/fileutils.rb +57 -33
- data/lib/extensions/net-http/net/ftp.rb +40 -36
- data/lib/extensions/net-http/net/http.rb +98 -38
- data/lib/extensions/net-http/net/https.rb +3 -13
- data/lib/extensions/net-http/net/protocol.rb +20 -4
- data/lib/extensions/rexml/rexml/document.rb +11 -9
- data/lib/extensions/rexml/rexml/element.rb +1 -1
- data/lib/extensions/rexml/rexml/entity.rb +1 -1
- data/lib/extensions/rexml/rexml/formatters/default.rb +3 -1
- data/lib/extensions/rexml/rexml/formatters/pretty.rb +1 -1
- data/lib/extensions/rexml/rexml/light/node.rb +1 -2
- data/lib/extensions/rexml/rexml/parent.rb +1 -0
- data/lib/extensions/rexml/rexml/parsers/xpathparser.rb +2 -1
- data/lib/extensions/rexml/rexml/quickpath.rb +4 -1
- data/lib/extensions/rexml/rexml/rexml.rb +1 -1
- data/lib/extensions/rexml/rexml/source.rb +25 -14
- data/lib/extensions/rexml/rexml/text.rb +20 -21
- data/lib/extensions/rexml/rexml/xmldecl.rb +2 -2
- data/lib/extensions/rexml/rexml/xmltokens.rb +2 -2
- data/lib/extensions/rexml/rexml/xpath_parser.rb +2 -1
- data/lib/extensions/set/set.rb +100 -25
- data/lib/extensions/uri/uri/common.rb +134 -4
- data/lib/extensions/uri/uri/ftp.rb +14 -3
- data/lib/extensions/uri/uri/generic.rb +53 -44
- data/lib/extensions/uri/uri/http.rb +1 -1
- data/lib/extensions/uri/uri/https.rb +1 -1
- data/lib/extensions/uri/uri/ldap.rb +1 -1
- data/lib/extensions/uri/uri/mailto.rb +9 -9
- data/lib/framework/rho/rhoviewhelpers.rb +3 -2
- data/lib/framework/rholang/localization_simplified.rb +5 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Logger.java +14 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCaptureCallback.java +0 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +12 -5
- data/platform/android/build/android.rake +7 -7
- data/platform/iphone/Classes/AppManager/AppManager.m +19 -7
- data/platform/iphone/rbuild/iphone.rake +1 -1
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtNetwork.framework/Versions/4/QtNetwork +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtWebKit.framework/Versions/4/QtWebKit +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/phonon.framework/Versions/4/phonon +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Info.plist +1 -1
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/MacOS/RhoSimulator +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/accessible/libqtaccessiblewidgets.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/bearer/libqgenericbearer.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqcncodecs.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqjpcodecs.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqkrcodecs.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqtwcodecs.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/graphicssystems/libqtracegraphicssystem.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqgif.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqico.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqjpeg.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqmng.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqtiff.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/phonon_backend/libphonon_qt7.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/qmltooling/libqmldbg_tcp.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Resources/rho.icns +0 -0
- data/platform/osx/build/osx.rake +25 -3
- data/platform/shared/common/AutoPointer.h +1 -1
- data/platform/shared/common/RhoStd.h +10 -10
- data/platform/shared/common/RhodesAppBase.cpp +3 -0
- data/platform/shared/logging/RhoLogConf.cpp +1 -1
- data/platform/shared/qt/rhodes/QtMainWindow.cpp +7 -0
- data/platform/shared/qt/rhodes/RhoSimulator.h +3 -1
- data/platform/shared/qt/rhodes/main.cpp +3 -0
- data/platform/shared/qt/rhodes/resources/rho.icns +0 -0
- data/platform/shared/qt/rhodes/resources/rho.ico +0 -0
- data/platform/shared/qt/rhodes/resources/rho.png +0 -0
- data/platform/shared/qt/rhodes/resources/simulator.qrc +5 -0
- data/platform/shared/qt/rhodes/rhodes.pro +2 -0
- data/platform/shared/ruby/ext/rho/rhosupport.c +21 -2
- data/platform/shared/ruby/ext/socket_192/addrinfo.h +191 -0
- data/platform/shared/ruby/ext/socket_192/ancdata.c +1800 -0
- data/platform/shared/ruby/ext/socket_192/basicsocket.c +771 -0
- data/platform/shared/ruby/ext/socket_192/constants.c +145 -0
- data/platform/shared/ruby/ext/socket_192/depend +25 -0
- data/platform/shared/ruby/ext/socket_192/extconf.rb +365 -0
- data/platform/shared/ruby/ext/socket_192/getaddrinfo.c +674 -0
- data/platform/shared/ruby/ext/socket_192/getnameinfo.c +260 -0
- data/platform/shared/ruby/ext/socket_192/init.c +575 -0
- data/platform/shared/ruby/ext/socket_192/ipsocket.c +308 -0
- data/platform/shared/ruby/ext/socket_192/lib/socket.rb +755 -0
- data/platform/shared/ruby/ext/socket_192/mkconstants.rb +696 -0
- data/platform/shared/ruby/ext/socket_192/option.c +692 -0
- data/platform/shared/ruby/ext/socket_192/raddrinfo.c +2211 -0
- data/platform/shared/ruby/ext/socket_192/rubysocket.h +306 -0
- data/platform/shared/ruby/ext/socket_192/socket.c +1870 -0
- data/platform/shared/ruby/ext/socket_192/sockport.h +84 -0
- data/platform/shared/ruby/ext/socket_192/sockssocket.c +58 -0
- data/platform/shared/ruby/ext/socket_192/tcpserver.c +145 -0
- data/platform/shared/ruby/ext/socket_192/tcpsocket.c +69 -0
- data/platform/shared/ruby/ext/socket_192/udpsocket.c +264 -0
- data/platform/shared/ruby/ext/socket_192/unixserver.c +154 -0
- data/platform/shared/ruby/ext/socket_192/unixsocket.c +514 -0
- data/platform/shared/ruby/ext/stringio/stringio.c +158 -61
- data/platform/shared/ruby/ext/strscan/strscan.c +18 -31
- data/platform/shared/ruby/iphone/ruby/config.h +2 -1
- data/platform/shared/ruby/linux/ruby/config.h +2 -1
- data/platform/shared/ruby/symbian/ruby/config.h +2 -1
- data/platform/shared/ruby/win32/ruby/config.h +1 -0
- data/platform/shared/ruby/win32/ruby/constdefs.c +5866 -0
- data/platform/shared/ruby/win32/ruby/constdefs.h +1788 -0
- data/platform/shared/ruby/wince/ruby/config.h +1 -0
- data/platform/shared/ruby/wince/ruby/constdefs.c +5866 -0
- data/platform/shared/ruby/wince/ruby/constdefs.h +1788 -0
- data/platform/symbian/build/symbian.rake +8 -0
- data/platform/symbian/rhodes/rhodes.pro +3 -3
- data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
- data/platform/wm/build/wm.rake +1 -1
- data/platform/wm/rhodes/Rhodes.cpp +3 -0
- data/platform/wm/rhodes/rhodes.vcproj +612 -6
- data/platform/wm/rhodes/rhosim.rc +394 -0
- data/platform/wm/rhodes/simulator/MainWindowQt.cpp +2 -2
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +8 -2
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +5 -1
- data/platform/wp7/build/wp.rake +1 -1
- data/rakefile.rb +52 -7
- data/res/generators/templates/application/app/layout.erb +4 -4
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0b3.css → jquery.mobile-1.0rc1.css} +507 -457
- data/res/generators/templates/application/public/jqmobile/{jquery.mobile-1.0b3.js → jquery.mobile-1.0rc1.js} +565 -458
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0rc1.min.css +12 -0
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0rc1.min.js +170 -0
- data/res/generators/templates/application/public/jquery/{jquery-1.6.3.js → jquery-1.6.4.js} +10 -8
- data/res/generators/templates/application/public/jquery/jquery-1.6.4.min.js +4 -0
- data/res/generators/templates/application/public/js/jqmobile-patch.js +47 -1
- data/res/icons/rho.icns +0 -0
- data/res/icons/rho.ico +0 -0
- data/res/icons/rho.png +0 -0
- data/res/icons/rho.psd +0 -0
- data/res/icons/rhodes.icns +0 -0
- data/res/icons/rhodes.ico +0 -0
- data/res/icons/rhodes.png +0 -0
- data/res/icons/rhodes.psd +0 -0
- data/res/icons/rhosim.icns +0 -0
- data/res/icons/rhosim.ico +0 -0
- data/res/icons/rhosim.png +0 -0
- data/res/icons/rhosim.psd +0 -0
- data/rhodes.gemspec +1 -1
- data/spec/framework_spec/app/spec/core/file/expand_path_spec.rb +4 -4
- data/spec/framework_spec/app/spec/library/net/FTPError_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/FTPPermError_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/net/FTPProtoError_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/net/FTPReplyError_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/net/FTPTempError_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/net/ftp/abort_spec.rb +62 -0
- data/spec/framework_spec/app/spec/library/net/ftp/acct_spec.rb +58 -0
- data/spec/framework_spec/app/spec/library/net/ftp/binary_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/net/ftp/chdir_spec.rb +101 -0
- data/spec/framework_spec/app/spec/library/net/ftp/close_spec.rb +28 -0
- data/spec/framework_spec/app/spec/library/net/ftp/closed_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/net/ftp/connect_spec.rb +49 -0
- data/spec/framework_spec/app/spec/library/net/ftp/debug_mode_spec.rb +23 -0
- data/spec/framework_spec/app/spec/library/net/ftp/delete_spec.rb +59 -0
- data/spec/framework_spec/app/spec/library/net/ftp/dir_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/ftp/fixtures/putbinaryfile +3 -0
- data/spec/framework_spec/app/spec/library/net/ftp/fixtures/puttextfile +3 -0
- data/spec/framework_spec/app/spec/library/net/ftp/fixtures/server.rb +258 -0
- data/spec/framework_spec/app/spec/library/net/ftp/get_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/net/ftp/getbinaryfile_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/ftp/getdir_spec.rb +7 -0
- data/spec/framework_spec/app/spec/library/net/ftp/gettextfile_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/ftp/help_spec.rb +66 -0
- data/spec/framework_spec/app/spec/library/net/ftp/initialize_spec.rb +87 -0
- data/spec/framework_spec/app/spec/library/net/ftp/last_response_code_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/ftp/last_response_spec.rb +25 -0
- data/spec/framework_spec/app/spec/library/net/ftp/lastresp_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/ftp/list_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/ftp/login_spec.rb +216 -0
- data/spec/framework_spec/app/spec/library/net/ftp/ls_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/ftp/mdtm_spec.rb +38 -0
- data/spec/framework_spec/app/spec/library/net/ftp/mkdir_spec.rb +61 -0
- data/spec/framework_spec/app/spec/library/net/ftp/mtime_spec.rb +50 -0
- data/spec/framework_spec/app/spec/library/net/ftp/nlst_spec.rb +122 -0
- data/spec/framework_spec/app/spec/library/net/ftp/noop_spec.rb +38 -0
- data/spec/framework_spec/app/spec/library/net/ftp/open_spec.rb +55 -0
- data/spec/framework_spec/app/spec/library/net/ftp/passive_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/net/ftp/put_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/net/ftp/putbinaryfile_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/ftp/puttextfile_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/ftp/pwd_spec.rb +53 -0
- data/spec/framework_spec/app/spec/library/net/ftp/quit_spec.rb +33 -0
- data/spec/framework_spec/app/spec/library/net/ftp/rename_spec.rb +94 -0
- data/spec/framework_spec/app/spec/library/net/ftp/resume_spec.rb +23 -0
- data/spec/framework_spec/app/spec/library/net/ftp/retrbinary_spec.rb +31 -0
- data/spec/framework_spec/app/spec/library/net/ftp/retrlines_spec.rb +35 -0
- data/spec/framework_spec/app/spec/library/net/ftp/return_code_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/net/ftp/rmdir_spec.rb +58 -0
- data/spec/framework_spec/app/spec/library/net/ftp/sendcmd_spec.rb +54 -0
- data/spec/framework_spec/app/spec/library/net/ftp/set_socket_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/ftp/shared/getbinaryfile.rb +180 -0
- data/spec/framework_spec/app/spec/library/net/ftp/shared/gettextfile.rb +130 -0
- data/spec/framework_spec/app/spec/library/net/ftp/shared/last_response_code.rb +25 -0
- data/spec/framework_spec/app/spec/library/net/ftp/shared/list.rb +134 -0
- data/spec/framework_spec/app/spec/library/net/ftp/shared/putbinaryfile.rb +233 -0
- data/spec/framework_spec/app/spec/library/net/ftp/shared/puttextfile.rb +150 -0
- data/spec/framework_spec/app/spec/library/net/ftp/shared/pwd.rb +3 -0
- data/spec/framework_spec/app/spec/library/net/ftp/site_spec.rb +53 -0
- data/spec/framework_spec/app/spec/library/net/ftp/size_spec.rb +48 -0
- data/spec/framework_spec/app/spec/library/net/ftp/status_spec.rb +63 -0
- data/spec/framework_spec/app/spec/library/net/ftp/storbinary_spec.rb +49 -0
- data/spec/framework_spec/app/spec/library/net/ftp/storlines_spec.rb +44 -0
- data/spec/framework_spec/app/spec/library/net/ftp/system_spec.rb +48 -0
- data/spec/framework_spec/app/spec/library/net/ftp/voidcmd_spec.rb +54 -0
- data/spec/framework_spec/app/spec/library/net/ftp/welcome_spec.rb +25 -0
- data/spec/framework_spec/app/spec/library/net/http/HTTPBadResponse_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/HTTPError_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/net/http/HTTPFatalError_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/net/http/HTTPHeaderSyntaxError_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/HTTPRetriableError_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/net/http/HTTPServerException_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/net/http/http/Proxy_spec.rb +35 -0
- data/spec/framework_spec/app/spec/library/net/http/http/active_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/address_spec.rb +9 -0
- data/spec/framework_spec/app/spec/library/net/http/http/close_on_empty_response_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/net/http/http/copy_spec.rb +23 -0
- data/spec/framework_spec/app/spec/library/net/http/http/default_port_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/delete_spec.rb +23 -0
- data/spec/framework_spec/app/spec/library/net/http/http/finish_spec.rb +31 -0
- data/spec/framework_spec/app/spec/library/net/http/http/fixtures/http_server.rb +97 -0
- data/spec/framework_spec/app/spec/library/net/http/http/get2_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/get_print_spec.rb +29 -0
- data/spec/framework_spec/app/spec/library/net/http/http/get_response_spec.rb +29 -0
- data/spec/framework_spec/app/spec/library/net/http/http/get_spec.rb +52 -0
- data/spec/framework_spec/app/spec/library/net/http/http/head2_spec.rb +9 -0
- data/spec/framework_spec/app/spec/library/net/http/http/head_spec.rb +27 -0
- data/spec/framework_spec/app/spec/library/net/http/http/http_default_port_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/https_default_port_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/initialize_spec.rb +46 -0
- data/spec/framework_spec/app/spec/library/net/http/http/inspect_spec.rb +26 -0
- data/spec/framework_spec/app/spec/library/net/http/http/is_version_1_1_spec.rb +7 -0
- data/spec/framework_spec/app/spec/library/net/http/http/is_version_1_2_spec.rb +7 -0
- data/spec/framework_spec/app/spec/library/net/http/http/lock_spec.rb +23 -0
- data/spec/framework_spec/app/spec/library/net/http/http/mkcol_spec.rb +23 -0
- data/spec/framework_spec/app/spec/library/net/http/http/move_spec.rb +27 -0
- data/spec/framework_spec/app/spec/library/net/http/http/new_spec.rb +86 -0
- data/spec/framework_spec/app/spec/library/net/http/http/newobj_spec.rb +48 -0
- data/spec/framework_spec/app/spec/library/net/http/http/open_timeout_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/net/http/http/options_spec.rb +27 -0
- data/spec/framework_spec/app/spec/library/net/http/http/port_spec.rb +9 -0
- data/spec/framework_spec/app/spec/library/net/http/http/post2_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/post_form_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/net/http/http/post_spec.rb +40 -0
- data/spec/framework_spec/app/spec/library/net/http/http/propfind_spec.rb +26 -0
- data/spec/framework_spec/app/spec/library/net/http/http/proppatch_spec.rb +26 -0
- data/spec/framework_spec/app/spec/library/net/http/http/proxy_address_spec.rb +31 -0
- data/spec/framework_spec/app/spec/library/net/http/http/proxy_class_spec.rb +9 -0
- data/spec/framework_spec/app/spec/library/net/http/http/proxy_pass_spec.rb +39 -0
- data/spec/framework_spec/app/spec/library/net/http/http/proxy_port_spec.rb +39 -0
- data/spec/framework_spec/app/spec/library/net/http/http/proxy_user_spec.rb +39 -0
- data/spec/framework_spec/app/spec/library/net/http/http/put2_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/put_spec.rb +26 -0
- data/spec/framework_spec/app/spec/library/net/http/http/read_timeout_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/net/http/http/request_get_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/request_head_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/request_post_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/request_put_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/request_spec.rb +111 -0
- data/spec/framework_spec/app/spec/library/net/http/http/request_types_spec.rb +254 -0
- data/spec/framework_spec/app/spec/library/net/http/http/send_request_spec.rb +120 -0
- data/spec/framework_spec/app/spec/library/net/http/http/set_debug_output_spec.rb +35 -0
- data/spec/framework_spec/app/spec/library/net/http/http/shared/request_get.rb +45 -0
- data/spec/framework_spec/app/spec/library/net/http/http/shared/request_head.rb +45 -0
- data/spec/framework_spec/app/spec/library/net/http/http/shared/request_post.rb +45 -0
- data/spec/framework_spec/app/spec/library/net/http/http/shared/request_put.rb +45 -0
- data/spec/framework_spec/app/spec/library/net/http/http/shared/started.rb +28 -0
- data/spec/framework_spec/app/spec/library/net/http/http/shared/version_1_1.rb +19 -0
- data/spec/framework_spec/app/spec/library/net/http/http/shared/version_1_2.rb +6 -0
- data/spec/framework_spec/app/spec/library/net/http/http/socket_type_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/start_spec.rb +103 -0
- data/spec/framework_spec/app/spec/library/net/http/http/started_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/http/trace_spec.rb +26 -0
- data/spec/framework_spec/app/spec/library/net/http/http/unlock_spec.rb +26 -0
- data/spec/framework_spec/app/spec/library/net/http/http/use_ssl_spec.rb +9 -0
- data/spec/framework_spec/app/spec/library/net/http/http/version_1_1_spec.rb +22 -0
- data/spec/framework_spec/app/spec/library/net/http/http/version_1_2_spec.rb +20 -0
- data/spec/framework_spec/app/spec/library/net/http/httpexceptions/fixtures/classes.rb +5 -0
- data/spec/framework_spec/app/spec/library/net/http/httpexceptions/initialize_spec.rb +17 -0
- data/spec/framework_spec/app/spec/library/net/http/httpexceptions/response_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/net/http/httpgenericrequest/body_exist_spec.rb +27 -0
- data/spec/framework_spec/app/spec/library/net/http/httpgenericrequest/body_spec.rb +30 -0
- data/spec/framework_spec/app/spec/library/net/http/httpgenericrequest/body_stream_spec.rb +32 -0
- data/spec/framework_spec/app/spec/library/net/http/httpgenericrequest/exec_spec.rb +122 -0
- data/spec/framework_spec/app/spec/library/net/http/httpgenericrequest/inspect_spec.rb +25 -0
- data/spec/framework_spec/app/spec/library/net/http/httpgenericrequest/method_spec.rb +15 -0
- data/spec/framework_spec/app/spec/library/net/http/httpgenericrequest/path_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/net/http/httpgenericrequest/request_body_permitted_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/net/http/httpgenericrequest/response_body_permitted_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/net/http/httpgenericrequest/set_body_internal_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/add_field_spec.rb +31 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/basic_auth_spec.rb +14 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/canonical_each_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/chunked_spec.rb +22 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/content_length_spec.rb +54 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/content_range_spec.rb +34 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/content_type_spec.rb +26 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/delete_spec.rb +30 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/each_capitalized_name_spec.rb +45 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/each_capitalized_spec.rb +9 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/each_header_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/each_key_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/each_name_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/each_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/each_value_spec.rb +46 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/element_reference_spec.rb +39 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/element_set_spec.rb +41 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/fetch_spec.rb +69 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/fixtures/classes.rb +11 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/form_data_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/get_fields_spec.rb +39 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/initialize_http_header_spec.rb +29 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/key_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/length_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/main_type_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/proxy_basic_auth_spec.rb +14 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/range_length_spec.rb +32 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/range_spec.rb +48 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/set_content_type_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/set_form_data_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/set_range_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_capitalized.rb +42 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_header.rb +42 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb +39 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/shared/set_content_type.rb +18 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/shared/set_form_data.rb +27 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/shared/set_range.rb +89 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/shared/size.rb +18 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/size_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/sub_type_spec.rb +32 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/to_hash_spec.rb +25 -0
- data/spec/framework_spec/app/spec/library/net/http/httpheader/type_params_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/net/http/httprequest/initialize_spec.rb +45 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/body_permitted_spec.rb +13 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/body_spec.rb +7 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/code_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/code_type_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/entity_spec.rb +7 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/error_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/error_type_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/exception_type_spec.rb +13 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/header_spec.rb +9 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/http_version_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/initialize_spec.rb +11 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/inspect_spec.rb +15 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/message_spec.rb +9 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/msg_spec.rb +9 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/read_body_spec.rb +86 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/read_header_spec.rb +9 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/read_new_spec.rb +22 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/reading_body_spec.rb +58 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/response_spec.rb +9 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/shared/body.rb +18 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/to_ary_spec.rb +26 -0
- data/spec/framework_spec/app/spec/library/net/http/httpresponse/value_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/clone_spec.rb +11 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/element_spec.rb +23 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/equal_value_spec.rb +18 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/hash_spec.rb +13 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/initialize_spec.rb +29 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/inspect_spec.rb +20 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/namespace_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/node_type_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/prefix_spec.rb +18 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/remove_spec.rb +20 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/to_s_spec.rb +14 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/to_string_spec.rb +15 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/value_spec.rb +15 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/write_spec.rb +23 -0
- data/spec/framework_spec/app/spec/library/rexml/attribute/xpath_spec.rb +20 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/add_spec.rb +7 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/append_spec.rb +7 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/delete_all_spec.rb +31 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/delete_spec.rb +27 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/each_attribute_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/each_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/element_reference_spec.rb +19 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/element_set_spec.rb +26 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/get_attribute_ns_spec.rb +14 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/get_attribute_spec.rb +29 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/initialize_spec.rb +19 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/length_spec.rb +7 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/namespaces_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/prefixes_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/shared/add.rb +17 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/shared/length.rb +13 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/size_spec.rb +7 -0
- data/spec/framework_spec/app/spec/library/rexml/attributes/to_a_spec.rb +20 -0
- data/spec/framework_spec/app/spec/library/rexml/cdata/clone_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/rexml/cdata/initialize_spec.rb +25 -0
- data/spec/framework_spec/app/spec/library/rexml/cdata/shared/to_s.rb +11 -0
- data/spec/framework_spec/app/spec/library/rexml/cdata/to_s_spec.rb +7 -0
- data/spec/framework_spec/app/spec/library/rexml/cdata/value_spec.rb +7 -0
- data/spec/framework_spec/app/spec/library/rexml/document/add_element_spec.rb +31 -0
- data/spec/framework_spec/app/spec/library/rexml/document/add_spec.rb +61 -0
- data/spec/framework_spec/app/spec/library/rexml/document/clone_spec.rb +20 -0
- data/spec/framework_spec/app/spec/library/rexml/document/doctype_spec.rb +15 -0
- data/spec/framework_spec/app/spec/library/rexml/document/encoding_spec.rb +22 -0
- data/spec/framework_spec/app/spec/library/rexml/document/expanded_name_spec.rb +16 -0
- data/spec/framework_spec/app/spec/library/rexml/document/new_spec.rb +38 -0
- data/spec/framework_spec/app/spec/library/rexml/document/node_type_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/rexml/document/root_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/rexml/document/stand_alone_spec.rb +19 -0
- data/spec/framework_spec/app/spec/library/rexml/document/version_spec.rb +14 -0
- data/spec/framework_spec/app/spec/library/rexml/document/write_spec.rb +39 -0
- data/spec/framework_spec/app/spec/library/rexml/document/xml_decl_spec.rb +15 -0
- data/spec/framework_spec/app/spec/library/rexml/element/add_attribute_spec.rb +41 -0
- data/spec/framework_spec/app/spec/library/rexml/element/add_attributes_spec.rb +22 -0
- data/spec/framework_spec/app/spec/library/rexml/element/add_element_spec.rb +39 -0
- data/spec/framework_spec/app/spec/library/rexml/element/add_namespace_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/rexml/element/add_text_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/rexml/element/attribute_spec.rb +17 -0
- data/spec/framework_spec/app/spec/library/rexml/element/attributes_spec.rb +19 -0
- data/spec/framework_spec/app/spec/library/rexml/element/cdatas_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/rexml/element/clone_spec.rb +29 -0
- data/spec/framework_spec/app/spec/library/rexml/element/comments_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/rexml/element/delete_attribute_spec.rb +39 -0
- data/spec/framework_spec/app/spec/library/rexml/element/delete_element_spec.rb +51 -0
- data/spec/framework_spec/app/spec/library/rexml/element/delete_namespace_spec.rb +25 -0
- data/spec/framework_spec/app/spec/library/rexml/element/document_spec.rb +18 -0
- data/spec/framework_spec/app/spec/library/rexml/element/each_element_with_attribute_spec.rb +35 -0
- data/spec/framework_spec/app/spec/library/rexml/element/each_element_with_text_spec.rb +31 -0
- data/spec/framework_spec/app/spec/library/rexml/element/get_text_spec.rb +18 -0
- data/spec/framework_spec/app/spec/library/rexml/element/has_attributes_spec.rb +17 -0
- data/spec/framework_spec/app/spec/library/rexml/element/has_elements_spec.rb +18 -0
- data/spec/framework_spec/app/spec/library/rexml/element/has_text_spec.rb +16 -0
- data/spec/framework_spec/app/spec/library/rexml/element/inspect_spec.rb +27 -0
- data/spec/framework_spec/app/spec/library/rexml/element/instructions_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/rexml/element/namespace_spec.rb +27 -0
- data/spec/framework_spec/app/spec/library/rexml/element/namespaces_spec.rb +32 -0
- data/spec/framework_spec/app/spec/library/rexml/element/new_spec.rb +35 -0
- data/spec/framework_spec/app/spec/library/rexml/element/next_element_spec.rb +19 -0
- data/spec/framework_spec/app/spec/library/rexml/element/node_type_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/rexml/element/prefixes_spec.rb +23 -0
- data/spec/framework_spec/app/spec/library/rexml/element/previous_element_spec.rb +20 -0
- data/spec/framework_spec/app/spec/library/rexml/element/raw_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/rexml/element/root_spec.rb +28 -0
- data/spec/framework_spec/app/spec/library/rexml/element/text_spec.rb +46 -0
- data/spec/framework_spec/app/spec/library/rexml/element/texts_spec.rb +16 -0
- data/spec/framework_spec/app/spec/library/rexml/element/whitespace_spec.rb +23 -0
- data/spec/framework_spec/app/spec/library/rexml/node/each_recursive_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/rexml/node/find_first_recursive_spec.rb +25 -0
- data/spec/framework_spec/app/spec/library/rexml/node/index_in_parent_spec.rb +15 -0
- data/spec/framework_spec/app/spec/library/rexml/node/next_sibling_node_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/rexml/node/parent_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/rexml/node/previous_sibling_node_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/rexml/shared/each_element.rb +36 -0
- data/spec/framework_spec/app/spec/library/rexml/shared/elements_to_a.rb +36 -0
- data/spec/framework_spec/app/spec/library/rexml/text/append_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/rexml/text/clone_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/rexml/text/comparison_spec.rb +25 -0
- data/spec/framework_spec/app/spec/library/rexml/text/empty_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/rexml/text/indent_text_spec.rb +24 -0
- data/spec/framework_spec/app/spec/library/rexml/text/inspect_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/rexml/text/new_spec.rb +49 -0
- data/spec/framework_spec/app/spec/library/rexml/text/node_type_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/rexml/text/normalize_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/rexml/text/read_with_substitution_spec.rb +13 -0
- data/spec/framework_spec/app/spec/library/rexml/text/to_s_spec.rb +18 -0
- data/spec/framework_spec/app/spec/library/rexml/text/unnormalize_spec.rb +8 -0
- data/spec/framework_spec/app/spec/library/rexml/text/value_spec.rb +37 -0
- data/spec/framework_spec/app/spec/library/rexml/text/wrap_spec.rb +21 -0
- data/spec/framework_spec/app/spec/library/rexml/text/write_with_substitution_spec.rb +33 -0
- data/spec/framework_spec/app/spec/library/set/exclusion_spec.rb +2 -2
- data/spec/framework_spec/app/spec/library/set/merge_spec.rb +2 -2
- data/spec/framework_spec/app/spec/library/set/shared/difference.rb +2 -2
- data/spec/framework_spec/app/spec/library/set/shared/intersection.rb +2 -2
- data/spec/framework_spec/app/spec/library/set/shared/union.rb +2 -2
- data/spec/framework_spec/app/spec/library/set/sortedset/exclusion_spec.rb +2 -2
- data/spec/framework_spec/app/spec/library/set/sortedset/merge_spec.rb +2 -2
- data/spec/framework_spec/app/spec/library/set/sortedset/shared/difference.rb +2 -2
- data/spec/framework_spec/app/spec/library/set/sortedset/shared/intersection.rb +2 -2
- data/spec/framework_spec/app/spec/library/set/sortedset/shared/union.rb +2 -2
- data/spec/framework_spec/app/spec/library/timeout/timeout_spec.rb +37 -0
- data/spec/framework_spec/app/spec/library/uri/eql_spec.rb +12 -0
- data/spec/framework_spec/app/spec/library/uri/equality_spec.rb +48 -0
- data/spec/framework_spec/app/spec/library/uri/escape/decode_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/escape/encode_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/escape/escape_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/escape/unescape_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/extract_spec.rb +86 -0
- data/spec/framework_spec/app/spec/library/uri/fixtures/classes.rb +11 -0
- data/spec/framework_spec/app/spec/library/uri/fixtures/normalization.rb +54 -0
- data/spec/framework_spec/app/spec/library/uri/ftp/build_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/ftp/merge_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/ftp/new2_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/ftp/path_spec.rb +56 -0
- data/spec/framework_spec/app/spec/library/uri/ftp/set_typecode_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/ftp/to_s_spec.rb +25 -0
- data/spec/framework_spec/app/spec/library/uri/ftp/typecode_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/absolute_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/build2_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/build_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/coerce_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/component_ary_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/component_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/default_port_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/eql_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/equal_value_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/fragment_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/hash_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/hierarchical_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/host_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/inspect_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/merge_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/minus_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/normalize_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/opaque_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/password_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/path_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/plus_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/port_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/query_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/registry_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/relative_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/route_from_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/route_to_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/scheme_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/select_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/set_fragment_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/set_host_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/set_opaque_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/set_password_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/set_path_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/set_port_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/set_query_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/set_registry_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/set_scheme_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/set_user_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/set_userinfo_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/to_s_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/use_registry_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/generic/user_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/generic/userinfo_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/http/build_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/http/request_uri_spec.rb +16 -0
- data/spec/framework_spec/app/spec/library/uri/join_spec.rb +61 -0
- data/spec/framework_spec/app/spec/library/uri/ldap/attributes_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/ldap/build_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/ldap/dn_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/ldap/extensions_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/ldap/filter_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/ldap/hierarchical_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/ldap/scope_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/ldap/set_attributes_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/ldap/set_dn_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/ldap/set_extensions_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/ldap/set_filter_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/ldap/set_scope_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/mailto/build_spec.rb +99 -0
- data/spec/framework_spec/app/spec/library/uri/mailto/headers_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/mailto/set_headers_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/mailto/set_to_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/mailto/to_mailtext_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/mailto/to_rfc822text_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/mailto/to_s_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/mailto/to_spec.rb +10 -0
- data/spec/framework_spec/app/spec/library/uri/merge_spec.rb +22 -0
- data/spec/framework_spec/app/spec/library/uri/normalize_spec.rb +35 -0
- data/spec/framework_spec/app/spec/library/uri/parse_spec.rb +249 -0
- data/spec/framework_spec/app/spec/library/uri/plus_spec.rb +489 -0
- data/spec/framework_spec/app/spec/library/uri/regexp_spec.rb +18 -0
- data/spec/framework_spec/app/spec/library/uri/route_from_spec.rb +25 -0
- data/spec/framework_spec/app/spec/library/uri/route_to_spec.rb +28 -0
- data/spec/framework_spec/app/spec/library/uri/select_spec.rb +31 -0
- data/spec/framework_spec/app/spec/library/uri/set_component_spec.rb +47 -0
- data/spec/framework_spec/app/spec/library/uri/shared/eql.rb +17 -0
- data/spec/framework_spec/app/spec/library/uri/split_spec.rb +6 -0
- data/spec/framework_spec/app/spec/library/uri/uri_spec.rb +31 -0
- data/spec/framework_spec/app/spec/library/uri/util/make_components_hash_spec.rb +6 -0
- data/spec/framework_spec/build.yml +2 -2
- data/spec/framework_spec/extensions/test-libs/test/unit.rb +328 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/assertionfailederror.rb +25 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/assertions.rb +1878 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/attribute.rb +129 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/autorunner.rb +422 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/collector.rb +38 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/collector/descendant.rb +23 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/collector/dir.rb +108 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/collector/load.rb +187 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/collector/objectspace.rb +34 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/collector/xml.rb +250 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/color-scheme.rb +153 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/color.rb +123 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/data.rb +80 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/diff.rb +740 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/error.rb +151 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/exceptionhandler.rb +39 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/failure.rb +136 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/fixture.rb +214 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/notification.rb +133 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/omission.rb +191 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/pending.rb +150 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/priority.rb +182 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/runner/console.rb +59 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/runner/emacs.rb +8 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/runner/tap.rb +8 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/runner/xml.rb +15 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/testcase.rb +601 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/testresult.rb +125 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/testsuite.rb +134 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/testsuitecreator.rb +79 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/ui/console/outputlevel.rb +15 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/ui/console/testrunner.rb +561 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/ui/emacs/testrunner.rb +63 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/ui/tap/testrunner.rb +82 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/ui/testrunner.rb +53 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/ui/testrunnermediator.rb +86 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/ui/testrunnerutilities.rb +41 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/ui/xml/testrunner.rb +224 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/util/backtracefilter.rb +42 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/util/method-owner-finder.rb +28 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/util/observable.rb +90 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/util/output.rb +31 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/util/procwrapper.rb +48 -0
- data/spec/framework_spec/extensions/test-libs/test/unit/version.rb +5 -0
- data/spec/framework_spec/extensions/test-libs/webrick/accesslog.rb +10 -2
- data/spec/framework_spec/extensions/test-libs/webrick/cgi.rb +1 -1
- data/spec/framework_spec/extensions/test-libs/webrick/config.rb +1 -1
- data/spec/framework_spec/extensions/test-libs/webrick/httpauth/digestauth.rb +1 -1
- data/spec/framework_spec/extensions/test-libs/webrick/httpresponse.rb +1 -1
- data/spec/framework_spec/extensions/test-libs/webrick/https.rb +2 -2
- data/spec/framework_spec/extensions/test-libs/webrick/httpservlet/abstract.rb +1 -2
- data/spec/framework_spec/extensions/test-libs/webrick/httpservlet/cgihandler.rb +2 -2
- data/spec/framework_spec/extensions/test-libs/webrick/httpservlet/filehandler.rb +9 -5
- data/spec/framework_spec/extensions/test-libs/webrick/httpstatus.rb +32 -321
- data/spec/framework_spec/extensions/test-libs/webrick/httputils.rb +3 -3
- data/spec/framework_spec/extensions/test-libs/webrick/ssl.rb +3 -2
- data/spec/phone_spec/build.yml +1 -1
- data/version +1 -0
- metadata +521 -27
- data/lib/extensions/net-http/monitor.rb +0 -265
- data/lib/extensions/net-http/thread.rb +0 -367
- data/lib/extensions/net-http/timeout.rb +0 -114
- data/lib/extensions/net-http/uri.rb +0 -29
- data/lib/extensions/net-http/uri/common.rb +0 -727
- data/lib/extensions/net-http/uri/ftp.rb +0 -198
- data/lib/extensions/net-http/uri/generic.rb +0 -1128
- data/lib/extensions/net-http/uri/http.rb +0 -100
- data/lib/extensions/net-http/uri/https.rb +0 -20
- data/lib/extensions/net-http/uri/ldap.rb +0 -190
- data/lib/extensions/net-http/uri/ldaps.rb +0 -12
- data/lib/extensions/net-http/uri/mailto.rb +0 -266
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtDBus.framework/Versions/4/QtDBus +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtXml.framework/Versions/4/QtXml +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/qmltooling/libtcpserver.dylib +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icon-search-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0b3.min.css +0 -8
- data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.0b3.min.js +0 -169
- data/res/generators/templates/application/public/jquery/jquery-1.6.3.min.js +0 -4
- data/spec/framework_spec/extensions/test-libs/thread.rb +0 -391
@@ -1,198 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# = uri/ftp.rb
|
3
|
-
#
|
4
|
-
# Author:: Akira Yamada <akira@ruby-lang.org>
|
5
|
-
# License:: You can redistribute it and/or modify it under the same term as Ruby.
|
6
|
-
# Revision:: $Id: ftp.rb 11708 2007-02-12 23:01:19Z shyouhei $
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'uri/generic'
|
10
|
-
|
11
|
-
module URI
|
12
|
-
|
13
|
-
#
|
14
|
-
# FTP URI syntax is defined by RFC1738 section 3.2.
|
15
|
-
#
|
16
|
-
class FTP < Generic
|
17
|
-
DEFAULT_PORT = 21
|
18
|
-
|
19
|
-
COMPONENT = [
|
20
|
-
:scheme,
|
21
|
-
:userinfo, :host, :port,
|
22
|
-
:path, :typecode
|
23
|
-
].freeze
|
24
|
-
#
|
25
|
-
# Typecode is "a", "i" or "d".
|
26
|
-
#
|
27
|
-
# * "a" indicates a text file (the FTP command was ASCII)
|
28
|
-
# * "i" indicates a binary file (FTP command IMAGE)
|
29
|
-
# * "d" indicates the contents of a directory should be displayed
|
30
|
-
#
|
31
|
-
TYPECODE = ['a', 'i', 'd'].freeze
|
32
|
-
TYPECODE_PREFIX = ';type='.freeze
|
33
|
-
|
34
|
-
def self.new2(user, password, host, port, path,
|
35
|
-
typecode = nil, arg_check = true)
|
36
|
-
typecode = nil if typecode.size == 0
|
37
|
-
if typecode && !TYPECODE.include?(typecode)
|
38
|
-
raise ArgumentError,
|
39
|
-
"bad typecode is specified: #{typecode}"
|
40
|
-
end
|
41
|
-
|
42
|
-
# do escape
|
43
|
-
|
44
|
-
self.new('ftp',
|
45
|
-
[user, password],
|
46
|
-
host, port, nil,
|
47
|
-
typecode ? path + TYPECODE_PREFIX + typecode : path,
|
48
|
-
nil, nil, nil, arg_check)
|
49
|
-
end
|
50
|
-
|
51
|
-
#
|
52
|
-
# == Description
|
53
|
-
#
|
54
|
-
# Creates a new URI::FTP object from components, with syntax checking.
|
55
|
-
#
|
56
|
-
# The components accepted are +userinfo+, +host+, +port+, +path+ and
|
57
|
-
# +typecode+.
|
58
|
-
#
|
59
|
-
# The components should be provided either as an Array, or as a Hash
|
60
|
-
# with keys formed by preceding the component names with a colon.
|
61
|
-
#
|
62
|
-
# If an Array is used, the components must be passed in the order
|
63
|
-
# [userinfo, host, port, path, typecode]
|
64
|
-
#
|
65
|
-
# If the path supplied is absolute, it will be escaped in order to
|
66
|
-
# make it absolute in the URI. Examples:
|
67
|
-
#
|
68
|
-
# require 'uri'
|
69
|
-
#
|
70
|
-
# uri = URI::FTP.build(['user:password', 'ftp.example.com', nil,
|
71
|
-
# '/path/file.> zip', 'i'])
|
72
|
-
# puts uri.to_s -> ftp://user:password@ftp.example.com/%2Fpath/file.zip;type=a
|
73
|
-
#
|
74
|
-
# uri2 = URI::FTP.build({:host => 'ftp.example.com',
|
75
|
-
# :path => 'ruby/src'})
|
76
|
-
# puts uri2.to_s -> ftp://ftp.example.com/ruby/src
|
77
|
-
#
|
78
|
-
def self.build(args)
|
79
|
-
|
80
|
-
# Fix the incoming path to be generic URL syntax
|
81
|
-
# FTP path -> URL path
|
82
|
-
# foo/bar /foo/bar
|
83
|
-
# /foo/bar /%2Ffoo/bar
|
84
|
-
#
|
85
|
-
if args.kind_of?(Array)
|
86
|
-
args[3] = '/' + args[3].sub(/^\//, '%2F')
|
87
|
-
else
|
88
|
-
args[:path] = '/' + args[:path].sub(/^\//, '%2F')
|
89
|
-
end
|
90
|
-
|
91
|
-
tmp = Util::make_components_hash(self, args)
|
92
|
-
|
93
|
-
if tmp[:typecode]
|
94
|
-
if tmp[:typecode].size == 1
|
95
|
-
tmp[:typecode] = TYPECODE_PREFIX + tmp[:typecode]
|
96
|
-
end
|
97
|
-
tmp[:path] << tmp[:typecode]
|
98
|
-
end
|
99
|
-
|
100
|
-
return super(tmp)
|
101
|
-
end
|
102
|
-
|
103
|
-
#
|
104
|
-
# == Description
|
105
|
-
#
|
106
|
-
# Creates a new URI::FTP object from generic URL components with no
|
107
|
-
# syntax checking.
|
108
|
-
#
|
109
|
-
# Unlike build(), this method does not escape the path component as
|
110
|
-
# required by RFC1738; instead it is treated as per RFC2396.
|
111
|
-
#
|
112
|
-
# Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
|
113
|
-
# +opaque+, +query+ and +fragment+, in that order.
|
114
|
-
#
|
115
|
-
def initialize(*arg)
|
116
|
-
super(*arg)
|
117
|
-
@typecode = nil
|
118
|
-
tmp = @path.index(TYPECODE_PREFIX)
|
119
|
-
if tmp
|
120
|
-
typecode = @path[tmp + TYPECODE_PREFIX.size..-1]
|
121
|
-
self.set_path(@path[0..tmp - 1])
|
122
|
-
|
123
|
-
if arg[-1]
|
124
|
-
self.typecode = typecode
|
125
|
-
else
|
126
|
-
self.set_typecode(typecode)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
attr_reader :typecode
|
131
|
-
|
132
|
-
def check_typecode(v)
|
133
|
-
if TYPECODE.include?(v)
|
134
|
-
return true
|
135
|
-
else
|
136
|
-
raise InvalidComponentError,
|
137
|
-
"bad typecode(expected #{TYPECODE.join(', ')}): #{v}"
|
138
|
-
end
|
139
|
-
end
|
140
|
-
private :check_typecode
|
141
|
-
|
142
|
-
def set_typecode(v)
|
143
|
-
@typecode = v
|
144
|
-
end
|
145
|
-
protected :set_typecode
|
146
|
-
|
147
|
-
def typecode=(typecode)
|
148
|
-
check_typecode(typecode)
|
149
|
-
set_typecode(typecode)
|
150
|
-
typecode
|
151
|
-
end
|
152
|
-
|
153
|
-
def merge(oth) # :nodoc:
|
154
|
-
tmp = super(oth)
|
155
|
-
if self != tmp
|
156
|
-
tmp.set_typecode(oth.typecode)
|
157
|
-
end
|
158
|
-
|
159
|
-
return tmp
|
160
|
-
end
|
161
|
-
|
162
|
-
# Returns the path from an FTP URI.
|
163
|
-
#
|
164
|
-
# RFC 1738 specifically states that the path for an FTP URI does not
|
165
|
-
# include the / which separates the URI path from the URI host. Example:
|
166
|
-
#
|
167
|
-
# ftp://ftp.example.com/pub/ruby
|
168
|
-
#
|
169
|
-
# The above URI indicates that the client should connect to
|
170
|
-
# ftp.example.com then cd pub/ruby from the initial login directory.
|
171
|
-
#
|
172
|
-
# If you want to cd to an absolute directory, you must include an
|
173
|
-
# escaped / (%2F) in the path. Example:
|
174
|
-
#
|
175
|
-
# ftp://ftp.example.com/%2Fpub/ruby
|
176
|
-
#
|
177
|
-
# This method will then return "/pub/ruby"
|
178
|
-
#
|
179
|
-
def path
|
180
|
-
return @path.sub(/^\//,'').sub(/^%2F/,'/')
|
181
|
-
end
|
182
|
-
|
183
|
-
def to_s
|
184
|
-
save_path = nil
|
185
|
-
if @typecode
|
186
|
-
save_path = @path
|
187
|
-
@path = @path + TYPECODE_PREFIX + @typecode
|
188
|
-
end
|
189
|
-
str = super
|
190
|
-
if @typecode
|
191
|
-
@path = save_path
|
192
|
-
end
|
193
|
-
|
194
|
-
return str
|
195
|
-
end
|
196
|
-
end
|
197
|
-
@@schemes['FTP'] = FTP
|
198
|
-
end
|
@@ -1,1128 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# = uri/generic.rb
|
3
|
-
#
|
4
|
-
# Author:: Akira Yamada <akira@ruby-lang.org>
|
5
|
-
# License:: You can redistribute it and/or modify it under the same term as Ruby.
|
6
|
-
# Revision:: $Id: generic.rb 20258 2008-11-18 16:46:16Z yugui $
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'uri/common'
|
10
|
-
|
11
|
-
module URI
|
12
|
-
|
13
|
-
#
|
14
|
-
# Base class for all URI classes.
|
15
|
-
# Implements generic URI syntax as per RFC 2396.
|
16
|
-
#
|
17
|
-
class Generic
|
18
|
-
include URI
|
19
|
-
|
20
|
-
DEFAULT_PORT = nil
|
21
|
-
|
22
|
-
#
|
23
|
-
# Returns default port
|
24
|
-
#
|
25
|
-
def self.default_port
|
26
|
-
self::DEFAULT_PORT
|
27
|
-
end
|
28
|
-
|
29
|
-
def default_port
|
30
|
-
self.class.default_port
|
31
|
-
end
|
32
|
-
|
33
|
-
COMPONENT = [
|
34
|
-
:scheme,
|
35
|
-
:userinfo, :host, :port, :registry,
|
36
|
-
:path, :opaque,
|
37
|
-
:query,
|
38
|
-
:fragment
|
39
|
-
].freeze
|
40
|
-
|
41
|
-
#
|
42
|
-
# Components of the URI in the order.
|
43
|
-
#
|
44
|
-
def self.component
|
45
|
-
self::COMPONENT
|
46
|
-
end
|
47
|
-
|
48
|
-
USE_REGISTRY = false
|
49
|
-
|
50
|
-
#
|
51
|
-
# DOC: FIXME!
|
52
|
-
#
|
53
|
-
def self.use_registry
|
54
|
-
self::USE_REGISTRY
|
55
|
-
end
|
56
|
-
|
57
|
-
#
|
58
|
-
# == Synopsis
|
59
|
-
#
|
60
|
-
# See #new
|
61
|
-
#
|
62
|
-
# == Description
|
63
|
-
#
|
64
|
-
# At first, tries to create a new URI::Generic instance using
|
65
|
-
# URI::Generic::build. But, if exception URI::InvalidComponentError is raised,
|
66
|
-
# then it URI::Escape.escape all URI components and tries again.
|
67
|
-
#
|
68
|
-
#
|
69
|
-
def self.build2(args)
|
70
|
-
begin
|
71
|
-
return self.build(args)
|
72
|
-
rescue InvalidComponentError
|
73
|
-
if args.kind_of?(Array)
|
74
|
-
return self.build(args.collect{|x|
|
75
|
-
if x
|
76
|
-
@parser.escape(x)
|
77
|
-
else
|
78
|
-
x
|
79
|
-
end
|
80
|
-
})
|
81
|
-
elsif args.kind_of?(Hash)
|
82
|
-
tmp = {}
|
83
|
-
args.each do |key, value|
|
84
|
-
tmp[key] = if value
|
85
|
-
@parser.escape(value)
|
86
|
-
else
|
87
|
-
value
|
88
|
-
end
|
89
|
-
end
|
90
|
-
return self.build(tmp)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
#
|
96
|
-
# == Synopsis
|
97
|
-
#
|
98
|
-
# See #new
|
99
|
-
#
|
100
|
-
# == Description
|
101
|
-
#
|
102
|
-
# Creates a new URI::Generic instance from components of URI::Generic
|
103
|
-
# with check. Components are: scheme, userinfo, host, port, registry, path,
|
104
|
-
# opaque, query and fragment. You can provide arguments either by an Array or a Hash.
|
105
|
-
# See #new for hash keys to use or for order of array items.
|
106
|
-
#
|
107
|
-
def self.build(args)
|
108
|
-
if args.kind_of?(Array) &&
|
109
|
-
args.size == ::URI::Generic::COMPONENT.size
|
110
|
-
tmp = args
|
111
|
-
elsif args.kind_of?(Hash)
|
112
|
-
tmp = ::URI::Generic::COMPONENT.collect do |c|
|
113
|
-
if args.include?(c)
|
114
|
-
args[c]
|
115
|
-
else
|
116
|
-
nil
|
117
|
-
end
|
118
|
-
end
|
119
|
-
else
|
120
|
-
raise ArgumentError,
|
121
|
-
"expected Array of or Hash of components of #{self.class} (#{self.class.component.join(', ')})"
|
122
|
-
end
|
123
|
-
|
124
|
-
tmp << DEFAULT_PARSER
|
125
|
-
tmp << true
|
126
|
-
return self.new(*tmp)
|
127
|
-
end
|
128
|
-
#
|
129
|
-
# == Args
|
130
|
-
#
|
131
|
-
# +scheme+::
|
132
|
-
# Protocol scheme, i.e. 'http','ftp','mailto' and so on.
|
133
|
-
# +userinfo+::
|
134
|
-
# User name and password, i.e. 'sdmitry:bla'
|
135
|
-
# +host+::
|
136
|
-
# Server host name
|
137
|
-
# +port+::
|
138
|
-
# Server port
|
139
|
-
# +registry+::
|
140
|
-
# DOC: FIXME!
|
141
|
-
# +path+::
|
142
|
-
# Path on server
|
143
|
-
# +opaque+::
|
144
|
-
# DOC: FIXME!
|
145
|
-
# +query+::
|
146
|
-
# Query data
|
147
|
-
# +fragment+::
|
148
|
-
# A part of URI after '#' sign
|
149
|
-
# +parser+::
|
150
|
-
# Parser for internal use [URI::DEFAULT_PARSER by default]
|
151
|
-
# +arg_check+::
|
152
|
-
# Check arguments [false by default]
|
153
|
-
#
|
154
|
-
# == Description
|
155
|
-
#
|
156
|
-
# Creates a new URI::Generic instance from ``generic'' components without check.
|
157
|
-
#
|
158
|
-
def initialize(scheme,
|
159
|
-
userinfo, host, port, registry,
|
160
|
-
path, opaque,
|
161
|
-
query,
|
162
|
-
fragment,
|
163
|
-
parser = DEFAULT_PARSER,
|
164
|
-
arg_check = false)
|
165
|
-
@scheme = nil
|
166
|
-
@user = nil
|
167
|
-
@password = nil
|
168
|
-
@host = nil
|
169
|
-
@port = nil
|
170
|
-
@path = nil
|
171
|
-
@query = nil
|
172
|
-
@opaque = nil
|
173
|
-
@registry = nil
|
174
|
-
@fragment = nil
|
175
|
-
@parser = parser
|
176
|
-
|
177
|
-
if arg_check
|
178
|
-
self.scheme = scheme
|
179
|
-
self.userinfo = userinfo
|
180
|
-
self.host = host
|
181
|
-
self.port = port
|
182
|
-
self.path = path
|
183
|
-
self.query = query
|
184
|
-
self.opaque = opaque
|
185
|
-
self.registry = registry
|
186
|
-
self.fragment = fragment
|
187
|
-
else
|
188
|
-
self.set_scheme(scheme)
|
189
|
-
self.set_userinfo(userinfo)
|
190
|
-
self.set_host(host)
|
191
|
-
self.set_port(port)
|
192
|
-
self.set_path(path)
|
193
|
-
self.set_query(query)
|
194
|
-
self.set_opaque(opaque)
|
195
|
-
self.set_registry(registry)
|
196
|
-
self.set_fragment(fragment)
|
197
|
-
end
|
198
|
-
if @registry && !self.class.use_registry
|
199
|
-
raise InvalidURIError,
|
200
|
-
"the scheme #{@scheme} does not accept registry part: #{@registry} (or bad hostname?)"
|
201
|
-
end
|
202
|
-
|
203
|
-
@scheme.freeze if @scheme
|
204
|
-
self.set_path('') if !@path && !@opaque # (see RFC2396 Section 5.2)
|
205
|
-
self.set_port(self.default_port) if self.default_port && !@port
|
206
|
-
end
|
207
|
-
attr_reader :scheme
|
208
|
-
attr_reader :host
|
209
|
-
attr_reader :port
|
210
|
-
attr_reader :registry
|
211
|
-
attr_reader :path
|
212
|
-
attr_reader :query
|
213
|
-
attr_reader :opaque
|
214
|
-
attr_reader :fragment
|
215
|
-
attr_reader :parser
|
216
|
-
|
217
|
-
# replace self by other URI object
|
218
|
-
def replace!(oth)
|
219
|
-
if self.class != oth.class
|
220
|
-
raise ArgumentError, "expected #{self.class} object"
|
221
|
-
end
|
222
|
-
|
223
|
-
component.each do |c|
|
224
|
-
self.__send__("#{c}=", oth.__send__(c))
|
225
|
-
end
|
226
|
-
end
|
227
|
-
private :replace!
|
228
|
-
|
229
|
-
def component
|
230
|
-
self.class.component
|
231
|
-
end
|
232
|
-
|
233
|
-
def check_scheme(v)
|
234
|
-
if v && @parser.regexp[:SCHEME] !~ v
|
235
|
-
raise InvalidComponentError,
|
236
|
-
"bad component(expected scheme component): #{v}"
|
237
|
-
end
|
238
|
-
|
239
|
-
return true
|
240
|
-
end
|
241
|
-
private :check_scheme
|
242
|
-
|
243
|
-
def set_scheme(v)
|
244
|
-
@scheme = v
|
245
|
-
end
|
246
|
-
protected :set_scheme
|
247
|
-
|
248
|
-
def scheme=(v)
|
249
|
-
check_scheme(v)
|
250
|
-
set_scheme(v)
|
251
|
-
v
|
252
|
-
end
|
253
|
-
|
254
|
-
def check_userinfo(user, password = nil)
|
255
|
-
if !password
|
256
|
-
user, password = split_userinfo(user)
|
257
|
-
end
|
258
|
-
check_user(user)
|
259
|
-
check_password(password, user)
|
260
|
-
|
261
|
-
return true
|
262
|
-
end
|
263
|
-
private :check_userinfo
|
264
|
-
|
265
|
-
def check_user(v)
|
266
|
-
if @registry || @opaque
|
267
|
-
raise InvalidURIError,
|
268
|
-
"can not set user with registry or opaque"
|
269
|
-
end
|
270
|
-
|
271
|
-
return v unless v
|
272
|
-
|
273
|
-
if @parser.regexp[:USERINFO] !~ v
|
274
|
-
raise InvalidComponentError,
|
275
|
-
"bad component(expected userinfo component or user component): #{v}"
|
276
|
-
end
|
277
|
-
|
278
|
-
return true
|
279
|
-
end
|
280
|
-
private :check_user
|
281
|
-
|
282
|
-
def check_password(v, user = @user)
|
283
|
-
if @registry || @opaque
|
284
|
-
raise InvalidURIError,
|
285
|
-
"can not set password with registry or opaque"
|
286
|
-
end
|
287
|
-
return v unless v
|
288
|
-
|
289
|
-
if !user
|
290
|
-
raise InvalidURIError,
|
291
|
-
"password component depends user component"
|
292
|
-
end
|
293
|
-
|
294
|
-
if @parser.regexp[:USERINFO] !~ v
|
295
|
-
raise InvalidComponentError,
|
296
|
-
"bad component(expected user component): #{v}"
|
297
|
-
end
|
298
|
-
|
299
|
-
return true
|
300
|
-
end
|
301
|
-
private :check_password
|
302
|
-
|
303
|
-
#
|
304
|
-
# Sets userinfo, argument is string like 'name:pass'
|
305
|
-
#
|
306
|
-
def userinfo=(userinfo)
|
307
|
-
if userinfo.nil?
|
308
|
-
return nil
|
309
|
-
end
|
310
|
-
check_userinfo(*userinfo)
|
311
|
-
set_userinfo(*userinfo)
|
312
|
-
# returns userinfo
|
313
|
-
end
|
314
|
-
|
315
|
-
def user=(user)
|
316
|
-
check_user(user)
|
317
|
-
set_user(user)
|
318
|
-
# returns user
|
319
|
-
end
|
320
|
-
|
321
|
-
def password=(password)
|
322
|
-
check_password(password)
|
323
|
-
set_password(password)
|
324
|
-
# returns password
|
325
|
-
end
|
326
|
-
|
327
|
-
def set_userinfo(user, password = nil)
|
328
|
-
unless password
|
329
|
-
user, password = split_userinfo(user)
|
330
|
-
end
|
331
|
-
@user = user
|
332
|
-
@password = password if password
|
333
|
-
|
334
|
-
[@user, @password]
|
335
|
-
end
|
336
|
-
protected :set_userinfo
|
337
|
-
|
338
|
-
def set_user(v)
|
339
|
-
set_userinfo(v, @password)
|
340
|
-
v
|
341
|
-
end
|
342
|
-
protected :set_user
|
343
|
-
|
344
|
-
def set_password(v)
|
345
|
-
@password = v
|
346
|
-
# returns v
|
347
|
-
end
|
348
|
-
protected :set_password
|
349
|
-
|
350
|
-
def split_userinfo(ui)
|
351
|
-
return nil, nil unless ui
|
352
|
-
user, password = ui.split(/:/, 2)
|
353
|
-
|
354
|
-
return user, password
|
355
|
-
end
|
356
|
-
private :split_userinfo
|
357
|
-
|
358
|
-
def escape_userpass(v)
|
359
|
-
v = @parser.escape(v, /[@:\/]/o) # RFC 1738 section 3.1 #/
|
360
|
-
end
|
361
|
-
private :escape_userpass
|
362
|
-
|
363
|
-
def userinfo
|
364
|
-
if @user.nil?
|
365
|
-
nil
|
366
|
-
elsif @password.nil?
|
367
|
-
@user
|
368
|
-
else
|
369
|
-
@user + ':' + @password
|
370
|
-
end
|
371
|
-
end
|
372
|
-
|
373
|
-
def user
|
374
|
-
@user
|
375
|
-
end
|
376
|
-
|
377
|
-
def password
|
378
|
-
@password
|
379
|
-
end
|
380
|
-
|
381
|
-
def check_host(v)
|
382
|
-
return v unless v
|
383
|
-
|
384
|
-
if @registry || @opaque
|
385
|
-
raise InvalidURIError,
|
386
|
-
"can not set host with registry or opaque"
|
387
|
-
elsif @parser.regexp[:HOST] !~ v
|
388
|
-
raise InvalidComponentError,
|
389
|
-
"bad component(expected host component): #{v}"
|
390
|
-
end
|
391
|
-
|
392
|
-
return true
|
393
|
-
end
|
394
|
-
private :check_host
|
395
|
-
|
396
|
-
def set_host(v)
|
397
|
-
@host = v
|
398
|
-
end
|
399
|
-
protected :set_host
|
400
|
-
|
401
|
-
def host=(v)
|
402
|
-
check_host(v)
|
403
|
-
set_host(v)
|
404
|
-
v
|
405
|
-
end
|
406
|
-
|
407
|
-
def check_port(v)
|
408
|
-
return v unless v
|
409
|
-
|
410
|
-
if @registry || @opaque
|
411
|
-
raise InvalidURIError,
|
412
|
-
"can not set port with registry or opaque"
|
413
|
-
elsif !v.kind_of?(Fixnum) && @parser.regexp[:PORT] !~ v
|
414
|
-
raise InvalidComponentError,
|
415
|
-
"bad component(expected port component): #{v}"
|
416
|
-
end
|
417
|
-
|
418
|
-
return true
|
419
|
-
end
|
420
|
-
private :check_port
|
421
|
-
|
422
|
-
def set_port(v)
|
423
|
-
unless !v || v.kind_of?(Fixnum)
|
424
|
-
if v.empty?
|
425
|
-
v = nil
|
426
|
-
else
|
427
|
-
v = v.to_i
|
428
|
-
end
|
429
|
-
end
|
430
|
-
@port = v
|
431
|
-
end
|
432
|
-
protected :set_port
|
433
|
-
|
434
|
-
def port=(v)
|
435
|
-
check_port(v)
|
436
|
-
set_port(v)
|
437
|
-
port
|
438
|
-
end
|
439
|
-
|
440
|
-
def check_registry(v)
|
441
|
-
return v unless v
|
442
|
-
|
443
|
-
# raise if both server and registry are not nil, because:
|
444
|
-
# authority = server | reg_name
|
445
|
-
# server = [ [ userinfo "@" ] hostport ]
|
446
|
-
if @host || @port || @user # userinfo = @user + ':' + @password
|
447
|
-
raise InvalidURIError,
|
448
|
-
"can not set registry with host, port, or userinfo"
|
449
|
-
elsif v && @parser.regexp[:REGISTRY] !~ v
|
450
|
-
raise InvalidComponentError,
|
451
|
-
"bad component(expected registry component): #{v}"
|
452
|
-
end
|
453
|
-
|
454
|
-
return true
|
455
|
-
end
|
456
|
-
private :check_registry
|
457
|
-
|
458
|
-
def set_registry(v)
|
459
|
-
@registry = v
|
460
|
-
end
|
461
|
-
protected :set_registry
|
462
|
-
|
463
|
-
def registry=(v)
|
464
|
-
check_registry(v)
|
465
|
-
set_registry(v)
|
466
|
-
v
|
467
|
-
end
|
468
|
-
|
469
|
-
def check_path(v)
|
470
|
-
# raise if both hier and opaque are not nil, because:
|
471
|
-
# absoluteURI = scheme ":" ( hier_part | opaque_part )
|
472
|
-
# hier_part = ( net_path | abs_path ) [ "?" query ]
|
473
|
-
if v && @opaque
|
474
|
-
raise InvalidURIError,
|
475
|
-
"path conflicts with opaque"
|
476
|
-
end
|
477
|
-
|
478
|
-
if @scheme
|
479
|
-
if v && v != '' && @parser.regexp[:ABS_PATH] !~ v
|
480
|
-
raise InvalidComponentError,
|
481
|
-
"bad component(expected absolute path component): #{v}"
|
482
|
-
end
|
483
|
-
else
|
484
|
-
if v && v != '' && @parser.regexp[:ABS_PATH] !~ v && @parser.regexp[:REL_PATH] !~ v
|
485
|
-
raise InvalidComponentError,
|
486
|
-
"bad component(expected relative path component): #{v}"
|
487
|
-
end
|
488
|
-
end
|
489
|
-
|
490
|
-
return true
|
491
|
-
end
|
492
|
-
private :check_path
|
493
|
-
|
494
|
-
def set_path(v)
|
495
|
-
@path = v
|
496
|
-
end
|
497
|
-
protected :set_path
|
498
|
-
|
499
|
-
def path=(v)
|
500
|
-
check_path(v)
|
501
|
-
set_path(v)
|
502
|
-
v
|
503
|
-
end
|
504
|
-
|
505
|
-
def check_query(v)
|
506
|
-
return v unless v
|
507
|
-
|
508
|
-
# raise if both hier and opaque are not nil, because:
|
509
|
-
# absoluteURI = scheme ":" ( hier_part | opaque_part )
|
510
|
-
# hier_part = ( net_path | abs_path ) [ "?" query ]
|
511
|
-
if @opaque
|
512
|
-
raise InvalidURIError,
|
513
|
-
"query conflicts with opaque"
|
514
|
-
end
|
515
|
-
|
516
|
-
if v && v != '' && @parser.regexp[:QUERY] !~ v
|
517
|
-
raise InvalidComponentError,
|
518
|
-
"bad component(expected query component): #{v}"
|
519
|
-
end
|
520
|
-
|
521
|
-
return true
|
522
|
-
end
|
523
|
-
private :check_query
|
524
|
-
|
525
|
-
def set_query(v)
|
526
|
-
@query = v
|
527
|
-
end
|
528
|
-
protected :set_query
|
529
|
-
|
530
|
-
def query=(v)
|
531
|
-
check_query(v)
|
532
|
-
set_query(v)
|
533
|
-
v
|
534
|
-
end
|
535
|
-
|
536
|
-
def check_opaque(v)
|
537
|
-
return v unless v
|
538
|
-
|
539
|
-
# raise if both hier and opaque are not nil, because:
|
540
|
-
# absoluteURI = scheme ":" ( hier_part | opaque_part )
|
541
|
-
# hier_part = ( net_path | abs_path ) [ "?" query ]
|
542
|
-
if @host || @port || @user || @path # userinfo = @user + ':' + @password
|
543
|
-
raise InvalidURIError,
|
544
|
-
"can not set opaque with host, port, userinfo or path"
|
545
|
-
elsif v && @parser.regexp[:OPAQUE] !~ v
|
546
|
-
raise InvalidComponentError,
|
547
|
-
"bad component(expected opaque component): #{v}"
|
548
|
-
end
|
549
|
-
|
550
|
-
return true
|
551
|
-
end
|
552
|
-
private :check_opaque
|
553
|
-
|
554
|
-
def set_opaque(v)
|
555
|
-
@opaque = v
|
556
|
-
end
|
557
|
-
protected :set_opaque
|
558
|
-
|
559
|
-
def opaque=(v)
|
560
|
-
check_opaque(v)
|
561
|
-
set_opaque(v)
|
562
|
-
v
|
563
|
-
end
|
564
|
-
|
565
|
-
def check_fragment(v)
|
566
|
-
return v unless v
|
567
|
-
|
568
|
-
if v && v != '' && @parser.regexp[:FRAGMENT] !~ v
|
569
|
-
raise InvalidComponentError,
|
570
|
-
"bad component(expected fragment component): #{v}"
|
571
|
-
end
|
572
|
-
|
573
|
-
return true
|
574
|
-
end
|
575
|
-
private :check_fragment
|
576
|
-
|
577
|
-
def set_fragment(v)
|
578
|
-
@fragment = v
|
579
|
-
end
|
580
|
-
protected :set_fragment
|
581
|
-
|
582
|
-
def fragment=(v)
|
583
|
-
check_fragment(v)
|
584
|
-
set_fragment(v)
|
585
|
-
v
|
586
|
-
end
|
587
|
-
|
588
|
-
#
|
589
|
-
# Checks if URI has a path
|
590
|
-
#
|
591
|
-
def hierarchical?
|
592
|
-
if @path
|
593
|
-
true
|
594
|
-
else
|
595
|
-
false
|
596
|
-
end
|
597
|
-
end
|
598
|
-
|
599
|
-
#
|
600
|
-
# Checks if URI is an absolute one
|
601
|
-
#
|
602
|
-
def absolute?
|
603
|
-
if @scheme
|
604
|
-
true
|
605
|
-
else
|
606
|
-
false
|
607
|
-
end
|
608
|
-
end
|
609
|
-
alias absolute absolute?
|
610
|
-
|
611
|
-
#
|
612
|
-
# Checks if URI is relative
|
613
|
-
#
|
614
|
-
def relative?
|
615
|
-
!absolute?
|
616
|
-
end
|
617
|
-
|
618
|
-
def split_path(path)
|
619
|
-
path.split(%r{/+}, -1)
|
620
|
-
end
|
621
|
-
private :split_path
|
622
|
-
|
623
|
-
def merge_path(base, rel)
|
624
|
-
|
625
|
-
# RFC2396, Section 5.2, 5)
|
626
|
-
# RFC2396, Section 5.2, 6)
|
627
|
-
base_path = split_path(base)
|
628
|
-
rel_path = split_path(rel)
|
629
|
-
|
630
|
-
# RFC2396, Section 5.2, 6), a)
|
631
|
-
base_path << '' if base_path.last == '..'
|
632
|
-
while i = base_path.index('..')
|
633
|
-
base_path.slice!(i - 1, 2)
|
634
|
-
end
|
635
|
-
|
636
|
-
if (first = rel_path.first) and first.empty?
|
637
|
-
base_path.clear
|
638
|
-
rel_path.shift
|
639
|
-
end
|
640
|
-
|
641
|
-
# RFC2396, Section 5.2, 6), c)
|
642
|
-
# RFC2396, Section 5.2, 6), d)
|
643
|
-
rel_path.push('') if rel_path.last == '.' || rel_path.last == '..'
|
644
|
-
rel_path.delete('.')
|
645
|
-
|
646
|
-
# RFC2396, Section 5.2, 6), e)
|
647
|
-
tmp = []
|
648
|
-
rel_path.each do |x|
|
649
|
-
if x == '..' &&
|
650
|
-
!(tmp.empty? || tmp.last == '..')
|
651
|
-
tmp.pop
|
652
|
-
else
|
653
|
-
tmp << x
|
654
|
-
end
|
655
|
-
end
|
656
|
-
|
657
|
-
add_trailer_slash = !tmp.empty?
|
658
|
-
if base_path.empty?
|
659
|
-
base_path = [''] # keep '/' for root directory
|
660
|
-
elsif add_trailer_slash
|
661
|
-
base_path.pop
|
662
|
-
end
|
663
|
-
while x = tmp.shift
|
664
|
-
if x == '..'
|
665
|
-
# RFC2396, Section 4
|
666
|
-
# a .. or . in an absolute path has no special meaning
|
667
|
-
base_path.pop if base_path.size > 1
|
668
|
-
else
|
669
|
-
# if x == '..'
|
670
|
-
# valid absolute (but abnormal) path "/../..."
|
671
|
-
# else
|
672
|
-
# valid absolute path
|
673
|
-
# end
|
674
|
-
base_path << x
|
675
|
-
tmp.each {|t| base_path << t}
|
676
|
-
add_trailer_slash = false
|
677
|
-
break
|
678
|
-
end
|
679
|
-
end
|
680
|
-
base_path.push('') if add_trailer_slash
|
681
|
-
|
682
|
-
return base_path.join('/')
|
683
|
-
end
|
684
|
-
private :merge_path
|
685
|
-
|
686
|
-
#
|
687
|
-
# == Args
|
688
|
-
#
|
689
|
-
# +oth+::
|
690
|
-
# URI or String
|
691
|
-
#
|
692
|
-
# == Description
|
693
|
-
#
|
694
|
-
# Destructive form of #merge
|
695
|
-
#
|
696
|
-
# == Usage
|
697
|
-
#
|
698
|
-
# require 'uri'
|
699
|
-
#
|
700
|
-
# uri = URI.parse("http://my.example.com")
|
701
|
-
# uri.merge!("/main.rbx?page=1")
|
702
|
-
# p uri
|
703
|
-
# # => #<URI::HTTP:0x2021f3b0 URL:http://my.example.com/main.rbx?page=1>
|
704
|
-
#
|
705
|
-
def merge!(oth)
|
706
|
-
t = merge(oth)
|
707
|
-
if self == t
|
708
|
-
nil
|
709
|
-
else
|
710
|
-
replace!(t)
|
711
|
-
self
|
712
|
-
end
|
713
|
-
end
|
714
|
-
|
715
|
-
#
|
716
|
-
# == Args
|
717
|
-
#
|
718
|
-
# +oth+::
|
719
|
-
# URI or String
|
720
|
-
#
|
721
|
-
# == Description
|
722
|
-
#
|
723
|
-
# Merges two URI's.
|
724
|
-
#
|
725
|
-
# == Usage
|
726
|
-
#
|
727
|
-
# require 'uri'
|
728
|
-
#
|
729
|
-
# uri = URI.parse("http://my.example.com")
|
730
|
-
# p uri.merge("/main.rbx?page=1")
|
731
|
-
# # => #<URI::HTTP:0x2021f3b0 URL:http://my.example.com/main.rbx?page=1>
|
732
|
-
#
|
733
|
-
def merge(oth)
|
734
|
-
begin
|
735
|
-
base, rel = merge0(oth)
|
736
|
-
rescue
|
737
|
-
raise $!.class, $!.message
|
738
|
-
end
|
739
|
-
|
740
|
-
if base == rel
|
741
|
-
return base
|
742
|
-
end
|
743
|
-
|
744
|
-
authority = rel.userinfo || rel.host || rel.port
|
745
|
-
|
746
|
-
# RFC2396, Section 5.2, 2)
|
747
|
-
if (rel.path.nil? || rel.path.empty?) && !authority && !rel.query
|
748
|
-
base.set_fragment(rel.fragment) if rel.fragment
|
749
|
-
return base
|
750
|
-
end
|
751
|
-
|
752
|
-
base.set_query(nil)
|
753
|
-
base.set_fragment(nil)
|
754
|
-
|
755
|
-
# RFC2396, Section 5.2, 4)
|
756
|
-
if !authority
|
757
|
-
base.set_path(merge_path(base.path, rel.path)) if base.path && rel.path
|
758
|
-
else
|
759
|
-
# RFC2396, Section 5.2, 4)
|
760
|
-
base.set_path(rel.path) if rel.path
|
761
|
-
end
|
762
|
-
|
763
|
-
# RFC2396, Section 5.2, 7)
|
764
|
-
base.set_userinfo(rel.userinfo) if rel.userinfo
|
765
|
-
base.set_host(rel.host) if rel.host
|
766
|
-
base.set_port(rel.port) if rel.port
|
767
|
-
base.set_query(rel.query) if rel.query
|
768
|
-
base.set_fragment(rel.fragment) if rel.fragment
|
769
|
-
|
770
|
-
return base
|
771
|
-
end # merge
|
772
|
-
alias + merge
|
773
|
-
|
774
|
-
# return base and rel.
|
775
|
-
# you can modify `base', but can not `rel'.
|
776
|
-
def merge0(oth)
|
777
|
-
case oth
|
778
|
-
when Generic
|
779
|
-
when String
|
780
|
-
oth = @parser.parse(oth)
|
781
|
-
else
|
782
|
-
raise ArgumentError,
|
783
|
-
"bad argument(expected URI object or URI string)"
|
784
|
-
end
|
785
|
-
|
786
|
-
if self.relative? && oth.relative?
|
787
|
-
raise BadURIError,
|
788
|
-
"both URI are relative"
|
789
|
-
end
|
790
|
-
|
791
|
-
if self.absolute? && oth.absolute?
|
792
|
-
#raise BadURIError,
|
793
|
-
# "both URI are absolute"
|
794
|
-
# hmm... should return oth for usability?
|
795
|
-
return oth, oth
|
796
|
-
end
|
797
|
-
|
798
|
-
if self.absolute?
|
799
|
-
return self.dup, oth
|
800
|
-
else
|
801
|
-
return oth, oth
|
802
|
-
end
|
803
|
-
end
|
804
|
-
private :merge0
|
805
|
-
|
806
|
-
def route_from_path(src, dst)
|
807
|
-
# RFC2396, Section 4.2
|
808
|
-
return '' if src == dst
|
809
|
-
|
810
|
-
src_path = split_path(src)
|
811
|
-
dst_path = split_path(dst)
|
812
|
-
|
813
|
-
# hmm... dst has abnormal absolute path,
|
814
|
-
# like "/./", "/../", "/x/../", ...
|
815
|
-
if dst_path.include?('..') ||
|
816
|
-
dst_path.include?('.')
|
817
|
-
return dst.dup
|
818
|
-
end
|
819
|
-
|
820
|
-
src_path.pop
|
821
|
-
|
822
|
-
# discard same parts
|
823
|
-
while dst_path.first == src_path.first
|
824
|
-
break if dst_path.empty?
|
825
|
-
|
826
|
-
src_path.shift
|
827
|
-
dst_path.shift
|
828
|
-
end
|
829
|
-
|
830
|
-
tmp = dst_path.join('/')
|
831
|
-
|
832
|
-
# calculate
|
833
|
-
if src_path.empty?
|
834
|
-
if tmp.empty?
|
835
|
-
return './'
|
836
|
-
elsif dst_path.first.include?(':') # (see RFC2396 Section 5)
|
837
|
-
return './' + tmp
|
838
|
-
else
|
839
|
-
return tmp
|
840
|
-
end
|
841
|
-
end
|
842
|
-
|
843
|
-
return '../' * src_path.size + tmp
|
844
|
-
end
|
845
|
-
private :route_from_path
|
846
|
-
|
847
|
-
def route_from0(oth)
|
848
|
-
case oth
|
849
|
-
when Generic
|
850
|
-
when String
|
851
|
-
oth = @parser.parse(oth)
|
852
|
-
else
|
853
|
-
raise ArgumentError,
|
854
|
-
"bad argument(expected URI object or URI string)"
|
855
|
-
end
|
856
|
-
|
857
|
-
if self.relative?
|
858
|
-
raise BadURIError,
|
859
|
-
"relative URI: #{self}"
|
860
|
-
end
|
861
|
-
if oth.relative?
|
862
|
-
raise BadURIError,
|
863
|
-
"relative URI: #{oth}"
|
864
|
-
end
|
865
|
-
|
866
|
-
if self.scheme != oth.scheme
|
867
|
-
return self, self.dup
|
868
|
-
end
|
869
|
-
rel = URI::Generic.new(nil, # it is relative URI
|
870
|
-
self.userinfo, self.host, self.port,
|
871
|
-
self.registry, self.path, self.opaque,
|
872
|
-
self.query, self.fragment, @parser)
|
873
|
-
|
874
|
-
if rel.userinfo != oth.userinfo ||
|
875
|
-
rel.host.to_s.downcase != oth.host.to_s.downcase ||
|
876
|
-
rel.port != oth.port
|
877
|
-
if self.userinfo.nil? && self.host.nil?
|
878
|
-
return self, self.dup
|
879
|
-
end
|
880
|
-
rel.set_port(nil) if rel.port == oth.default_port
|
881
|
-
return rel, rel
|
882
|
-
end
|
883
|
-
rel.set_userinfo(nil)
|
884
|
-
rel.set_host(nil)
|
885
|
-
rel.set_port(nil)
|
886
|
-
|
887
|
-
if rel.path && rel.path == oth.path
|
888
|
-
rel.set_path('')
|
889
|
-
rel.set_query(nil) if rel.query == oth.query
|
890
|
-
return rel, rel
|
891
|
-
elsif rel.opaque && rel.opaque == oth.opaque
|
892
|
-
rel.set_opaque('')
|
893
|
-
rel.set_query(nil) if rel.query == oth.query
|
894
|
-
return rel, rel
|
895
|
-
end
|
896
|
-
|
897
|
-
# you can modify `rel', but can not `oth'.
|
898
|
-
return oth, rel
|
899
|
-
end
|
900
|
-
private :route_from0
|
901
|
-
#
|
902
|
-
# == Args
|
903
|
-
#
|
904
|
-
# +oth+::
|
905
|
-
# URI or String
|
906
|
-
#
|
907
|
-
# == Description
|
908
|
-
#
|
909
|
-
# Calculates relative path from oth to self
|
910
|
-
#
|
911
|
-
# == Usage
|
912
|
-
#
|
913
|
-
# require 'uri'
|
914
|
-
#
|
915
|
-
# uri = URI.parse('http://my.example.com/main.rbx?page=1')
|
916
|
-
# p uri.route_from('http://my.example.com')
|
917
|
-
# #=> #<URI::Generic:0x20218858 URL:/main.rbx?page=1>
|
918
|
-
#
|
919
|
-
def route_from(oth)
|
920
|
-
# you can modify `rel', but can not `oth'.
|
921
|
-
begin
|
922
|
-
oth, rel = route_from0(oth)
|
923
|
-
rescue
|
924
|
-
raise $!.class, $!.message
|
925
|
-
end
|
926
|
-
if oth == rel
|
927
|
-
return rel
|
928
|
-
end
|
929
|
-
|
930
|
-
rel.set_path(route_from_path(oth.path, self.path))
|
931
|
-
if rel.path == './' && self.query
|
932
|
-
# "./?foo" -> "?foo"
|
933
|
-
rel.set_path('')
|
934
|
-
end
|
935
|
-
|
936
|
-
return rel
|
937
|
-
end
|
938
|
-
|
939
|
-
alias - route_from
|
940
|
-
|
941
|
-
#
|
942
|
-
# == Args
|
943
|
-
#
|
944
|
-
# +oth+::
|
945
|
-
# URI or String
|
946
|
-
#
|
947
|
-
# == Description
|
948
|
-
#
|
949
|
-
# Calculates relative path to oth from self
|
950
|
-
#
|
951
|
-
# == Usage
|
952
|
-
#
|
953
|
-
# require 'uri'
|
954
|
-
#
|
955
|
-
# uri = URI.parse('http://my.example.com')
|
956
|
-
# p uri.route_to('http://my.example.com/main.rbx?page=1')
|
957
|
-
# #=> #<URI::Generic:0x2020c2f6 URL:/main.rbx?page=1>
|
958
|
-
#
|
959
|
-
def route_to(oth)
|
960
|
-
case oth
|
961
|
-
when Generic
|
962
|
-
when String
|
963
|
-
oth = @parser.parse(oth)
|
964
|
-
else
|
965
|
-
raise ArgumentError,
|
966
|
-
"bad argument(expected URI object or URI string)"
|
967
|
-
end
|
968
|
-
|
969
|
-
oth.route_from(self)
|
970
|
-
end
|
971
|
-
|
972
|
-
#
|
973
|
-
# Returns normalized URI
|
974
|
-
#
|
975
|
-
def normalize
|
976
|
-
uri = dup
|
977
|
-
uri.normalize!
|
978
|
-
uri
|
979
|
-
end
|
980
|
-
|
981
|
-
#
|
982
|
-
# Destructive version of #normalize
|
983
|
-
#
|
984
|
-
def normalize!
|
985
|
-
if path && path == ''
|
986
|
-
set_path('/')
|
987
|
-
end
|
988
|
-
if host && host != host.downcase
|
989
|
-
set_host(self.host.downcase)
|
990
|
-
end
|
991
|
-
end
|
992
|
-
|
993
|
-
def path_query
|
994
|
-
str = @path
|
995
|
-
if @query
|
996
|
-
str += '?' + @query
|
997
|
-
end
|
998
|
-
str
|
999
|
-
end
|
1000
|
-
private :path_query
|
1001
|
-
|
1002
|
-
#
|
1003
|
-
# Constructs String from URI
|
1004
|
-
#
|
1005
|
-
def to_s
|
1006
|
-
str = ''
|
1007
|
-
if @scheme
|
1008
|
-
str << @scheme
|
1009
|
-
str << ':'
|
1010
|
-
end
|
1011
|
-
|
1012
|
-
if @opaque
|
1013
|
-
str << @opaque
|
1014
|
-
|
1015
|
-
else
|
1016
|
-
if @registry
|
1017
|
-
str << @registry
|
1018
|
-
else
|
1019
|
-
if @host
|
1020
|
-
str << '//'
|
1021
|
-
end
|
1022
|
-
if self.userinfo
|
1023
|
-
str << self.userinfo
|
1024
|
-
str << '@'
|
1025
|
-
end
|
1026
|
-
if @host
|
1027
|
-
str << @host
|
1028
|
-
end
|
1029
|
-
if @port && @port != self.default_port
|
1030
|
-
str << ':'
|
1031
|
-
str << @port.to_s
|
1032
|
-
end
|
1033
|
-
end
|
1034
|
-
|
1035
|
-
str << path_query
|
1036
|
-
end
|
1037
|
-
|
1038
|
-
if @fragment
|
1039
|
-
str << '#'
|
1040
|
-
str << @fragment
|
1041
|
-
end
|
1042
|
-
|
1043
|
-
str
|
1044
|
-
end
|
1045
|
-
|
1046
|
-
#
|
1047
|
-
# Compares to URI's
|
1048
|
-
#
|
1049
|
-
def ==(oth)
|
1050
|
-
if self.class == oth.class
|
1051
|
-
self.normalize.component_ary == oth.normalize.component_ary
|
1052
|
-
else
|
1053
|
-
false
|
1054
|
-
end
|
1055
|
-
end
|
1056
|
-
|
1057
|
-
def hash
|
1058
|
-
self.component_ary.hash
|
1059
|
-
end
|
1060
|
-
|
1061
|
-
def eql?(oth)
|
1062
|
-
@parser == oth.parser &&
|
1063
|
-
self.component_ary.eql?(oth.component_ary)
|
1064
|
-
end
|
1065
|
-
|
1066
|
-
=begin
|
1067
|
-
|
1068
|
-
--- URI::Generic#===(oth)
|
1069
|
-
|
1070
|
-
=end
|
1071
|
-
# def ===(oth)
|
1072
|
-
# raise NotImplementedError
|
1073
|
-
# end
|
1074
|
-
|
1075
|
-
=begin
|
1076
|
-
=end
|
1077
|
-
def component_ary
|
1078
|
-
component.collect do |x|
|
1079
|
-
self.send(x)
|
1080
|
-
end
|
1081
|
-
end
|
1082
|
-
protected :component_ary
|
1083
|
-
|
1084
|
-
# == Args
|
1085
|
-
#
|
1086
|
-
# +components+::
|
1087
|
-
# Multiple Symbol arguments defined in URI::HTTP
|
1088
|
-
#
|
1089
|
-
# == Description
|
1090
|
-
#
|
1091
|
-
# Selects specified components from URI
|
1092
|
-
#
|
1093
|
-
# == Usage
|
1094
|
-
#
|
1095
|
-
# require 'uri'
|
1096
|
-
#
|
1097
|
-
# uri = URI.parse('http://myuser:mypass@my.example.com/test.rbx')
|
1098
|
-
# p uri.select(:userinfo, :host, :path)
|
1099
|
-
# # => ["myuser:mypass", "my.example.com", "/test.rbx"]
|
1100
|
-
#
|
1101
|
-
def select(*components)
|
1102
|
-
components.collect do |c|
|
1103
|
-
if component.include?(c)
|
1104
|
-
self.send(c)
|
1105
|
-
else
|
1106
|
-
raise ArgumentError,
|
1107
|
-
"expected of components of #{self.class} (#{self.class.component.join(', ')})"
|
1108
|
-
end
|
1109
|
-
end
|
1110
|
-
end
|
1111
|
-
|
1112
|
-
@@to_s = Kernel.instance_method(:to_s)
|
1113
|
-
def inspect
|
1114
|
-
@@to_s.bind(self).call.sub!(/>\z/) {" URL:#{self}>"}
|
1115
|
-
end
|
1116
|
-
|
1117
|
-
def coerce(oth)
|
1118
|
-
case oth
|
1119
|
-
when String
|
1120
|
-
oth = @parser.parse(oth)
|
1121
|
-
else
|
1122
|
-
super
|
1123
|
-
end
|
1124
|
-
|
1125
|
-
return oth, self
|
1126
|
-
end
|
1127
|
-
end
|
1128
|
-
end
|