rio 0.4.2 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +21 -0
- data/Gemfile +4 -0
- data/{COPYING → LICENSE} +3 -0
- data/README +20 -27
- data/Rakefile +48 -277
- data/lib/rio.rb +63 -24
- data/lib/rio/.document +5 -0
- data/lib/rio/abstract_method.rb +3 -14
- data/lib/rio/alturi.rb +507 -0
- data/lib/rio/alturi/algorithm.rb +313 -0
- data/lib/rio/alturi/cached_fields.rb +68 -0
- data/lib/rio/alturi/escape.rb +82 -0
- data/lib/rio/alturi/parse.rb +75 -0
- data/lib/rio/alturi/path_parts.rb +81 -0
- data/lib/rio/alturi/regex.rb +76 -0
- data/lib/rio/alturi/uri_parts.rb +512 -0
- data/lib/rio/argv.rb +3 -14
- data/lib/rio/arraynge.rb +146 -0
- data/lib/rio/arycopy.rb +3 -14
- data/lib/rio/assert.rb +87 -15
- data/lib/rio/base.rb +7 -30
- data/lib/rio/callstr.rb +3 -14
- data/lib/rio/const.rb +3 -14
- data/lib/rio/construct.rb +4 -15
- data/lib/rio/constructor.rb +4 -19
- data/lib/rio/context.rb +17 -14
- data/lib/rio/context/autoclose.rb +3 -14
- data/lib/rio/context/binmode.rb +63 -0
- data/lib/rio/context/copying.rb +3 -14
- data/lib/rio/context/cxx.rb +3 -14
- data/lib/rio/context/dir.rb +5 -15
- data/lib/rio/context/encoding.rb +84 -0
- data/lib/rio/context/gzip.rb +3 -14
- data/lib/rio/context/methods.rb +8 -17
- data/lib/rio/context/skip.rb +3 -14
- data/lib/rio/context/stream.rb +3 -14
- data/lib/rio/cp.rb +5 -20
- data/lib/rio/cxuri.rb +67 -0
- data/lib/rio/dbg/trace_states.rb +18 -0
- data/lib/rio/def.rb +3 -14
- data/lib/rio/dir.rb +9 -18
- data/lib/rio/doc.rb +3 -14
- data/lib/rio/doc/EXAMPLES.rb +256 -269
- data/lib/rio/doc/HOWTO.rb +685 -707
- data/lib/rio/doc/INDEX.rb +261 -282
- data/lib/rio/doc/INTRO.rb +1029 -1040
- data/lib/rio/doc/OPTIONAL.rb +77 -103
- data/lib/rio/doc/SYNOPSIS.rb +122 -143
- data/lib/rio/entrysel.rb +3 -14
- data/lib/rio/exception.rb +4 -14
- data/lib/rio/exception/copy.rb +3 -14
- data/lib/rio/exception/notimplemented.rb +3 -14
- data/lib/rio/exception/notsupported.rb +3 -14
- data/lib/rio/exception/open.rb +3 -14
- data/lib/rio/exception/state.rb +3 -14
- data/lib/rio/ext.rb +14 -17
- data/lib/rio/ext/csv.rb +25 -304
- data/lib/rio/ext/csv/csv-legacy.rb +344 -0
- data/lib/rio/ext/csv/csv.rb +359 -0
- data/lib/rio/ext/csv/filter.rb +209 -0
- data/lib/rio/ext/if.rb +3 -14
- data/lib/rio/ext/mp3info.rb +3 -14
- data/lib/rio/ext/splitlines.rb +3 -14
- data/lib/rio/ext/yaml.rb +3 -14
- data/lib/rio/ext/yaml/doc.rb +3 -14
- data/lib/rio/ext/yaml/tie.rb +3 -14
- data/lib/rio/ext/zipfile.rb +3 -14
- data/lib/rio/ext/zipfile/fs.rb +3 -14
- data/lib/rio/ext/zipfile/rl.rb +3 -14
- data/lib/rio/ext/zipfile/rootdir.rb +3 -14
- data/lib/rio/ext/zipfile/state.rb +3 -14
- data/lib/rio/ext/zipfile/wrap.rb +3 -14
- data/lib/rio/factory.rb +96 -213
- data/lib/rio/fibpipe.rb +373 -0
- data/lib/rio/file.rb +8 -17
- data/lib/rio/filter.rb +4 -15
- data/lib/rio/filter/closeoneof.rb +3 -14
- data/lib/rio/filter/gzip.rb +18 -27
- data/lib/rio/fs.rb +172 -0
- data/lib/rio/fs/base.rb +3 -14
- data/lib/rio/fs/impl.rb +3 -14
- data/lib/rio/fs/native.rb +3 -14
- data/lib/rio/fs/stream.rb +3 -14
- data/lib/rio/fs/url.rb +3 -14
- data/lib/rio/ftp/conncache.rb +16 -18
- data/lib/rio/ftp/dir.rb +4 -15
- data/lib/rio/ftp/fs.rb +62 -42
- data/lib/rio/fwd.rb +15 -0
- data/lib/rio/grande.rb +4 -15
- data/lib/rio/handle.rb +3 -45
- data/lib/rio/if.rb +15 -20
- data/lib/rio/if/basic.rb +3 -36
- data/lib/rio/if/csv.rb +7 -20
- data/lib/rio/if/dir.rb +9 -21
- data/lib/rio/if/file.rb +6 -19
- data/lib/rio/if/fileordir.rb +18 -29
- data/lib/rio/if/grande.rb +109 -120
- data/lib/rio/if/grande_entry.rb +5 -18
- data/lib/rio/if/grande_stream.rb +29 -42
- data/lib/rio/if/internal.rb +15 -16
- data/lib/rio/if/path.rb +35 -47
- data/lib/rio/if/rubyio.rb +35 -47
- data/lib/rio/if/string.rb +3 -16
- data/lib/rio/if/temp.rb +3 -16
- data/lib/rio/if/test.rb +8 -20
- data/lib/rio/if/yaml.rb +16 -29
- data/lib/rio/ioh.rb +35 -34
- data/lib/rio/iomode.rb +3 -14
- data/lib/rio/ios/fail.rb +3 -14
- data/lib/rio/ios/generic.rb +3 -14
- data/lib/rio/ios/mode.rb +3 -14
- data/lib/rio/ios/null.rb +3 -14
- data/lib/rio/iowrap.rb +3 -14
- data/lib/rio/kernel.rb +4 -17
- data/lib/rio/local.rb +3 -14
- data/lib/rio/match.rb +3 -14
- data/lib/rio/matchrecord.rb +8 -17
- data/lib/rio/no_warn.rb +3 -14
- data/lib/rio/nullio.rb +3 -14
- data/lib/rio/open3.rb +3 -16
- data/lib/rio/ops.rb +33 -0
- data/lib/rio/ops/construct.rb +3 -14
- data/lib/rio/ops/create.rb +11 -25
- data/lib/rio/ops/dir.rb +17 -24
- data/lib/rio/ops/either.rb +28 -31
- data/lib/rio/ops/file.rb +29 -26
- data/lib/rio/ops/path.rb +65 -34
- data/lib/rio/ops/stream.rb +13 -15
- data/lib/rio/ops/stream/input.rb +59 -28
- data/lib/rio/ops/stream/output.rb +4 -14
- data/lib/rio/ops/stream/read.rb +4 -15
- data/lib/rio/ops/stream/write.rb +3 -14
- data/lib/rio/ops/symlink.rb +6 -15
- data/lib/rio/path.rb +10 -17
- data/lib/rio/path/reset.rb +3 -14
- data/lib/rio/piper.rb +3 -27
- data/lib/rio/piper/cp.rb +50 -27
- data/lib/rio/prompt.rb +3 -14
- data/lib/rio/rectype.rb +8 -16
- data/lib/rio/rl/base.rb +12 -25
- data/lib/rio/rl/builder.rb +25 -24
- data/lib/rio/rl/chmap.rb +3 -16
- data/lib/rio/rl/fs2url.rb +5 -16
- data/lib/rio/rl/ioi.rb +3 -14
- data/lib/rio/rl/path.rb +14 -25
- data/lib/rio/rl/pathmethods.rb +3 -14
- data/lib/rio/rl/uri.rb +18 -35
- data/lib/rio/rl/withpath.rb +36 -53
- data/lib/rio/rrl/base.rb +75 -0
- data/lib/rio/rrl/builder.rb +122 -0
- data/lib/rio/rrl/chmap.rb +53 -0
- data/lib/rio/rrl/ioi.rb +78 -0
- data/lib/rio/rrl/path.rb +117 -0
- data/lib/rio/rrl/withpath.rb +269 -0
- data/lib/rio/scheme/aryio.rb +3 -14
- data/lib/rio/scheme/cmdio.rb +73 -42
- data/lib/rio/scheme/cmdpipe.rb +122 -59
- data/lib/rio/scheme/fd.rb +19 -33
- data/lib/rio/scheme/ftp.rb +34 -40
- data/lib/rio/scheme/http.rb +13 -22
- data/lib/rio/scheme/null.rb +6 -17
- data/lib/rio/scheme/path.rb +60 -71
- data/lib/rio/scheme/stderr.rb +9 -21
- data/lib/rio/scheme/stdio.rb +14 -26
- data/lib/rio/scheme/strio.rb +37 -38
- data/lib/rio/scheme/sysio.rb +20 -32
- data/lib/rio/scheme/tcp.rb +3 -14
- data/lib/rio/scheme/temp.rb +103 -92
- data/lib/rio/state.rb +85 -67
- data/lib/rio/state/data.rb +55 -0
- data/lib/rio/state/error.rb +7 -27
- data/lib/rio/stream.rb +46 -19
- data/lib/rio/stream/base.rb +14 -14
- data/lib/rio/stream/duplex.rb +64 -26
- data/lib/rio/stream/open.rb +9 -19
- data/lib/rio/symantics.rb +3 -14
- data/lib/rio/tempdir.rb +8 -17
- data/lib/rio/to_rio.rb +3 -16
- data/lib/rio/to_rio/all.rb +3 -14
- data/lib/rio/to_rio/array.rb +3 -14
- data/lib/rio/to_rio/io.rb +3 -14
- data/lib/rio/to_rio/object.rb +3 -14
- data/lib/rio/to_rio/string.rb +3 -14
- data/lib/rio/uri/file.rb +98 -153
- data/lib/rio/uriref.rb +144 -0
- data/lib/rio/util.rb +3 -14
- data/lib/rio/version.rb +4 -15
- data/misc/clean-heading-comments.rb +39 -0
- data/misc/fixdoclinks.rb +36 -0
- data/misc/update-copyright.rb +17 -0
- data/rio.gemspec +31 -0
- data/test/alturi/tc/create.rb +24 -0
- data/test/alturi/tc/empty.rb +13 -0
- data/test/alturi/tc/encoding.rb +73 -0
- data/test/alturi/tc/file_test.rb +335 -0
- data/test/alturi/tc/ftp_alturi.rb +147 -0
- data/test/alturi/tc/generic_test.rb +335 -0
- data/test/alturi/tc/http_test.rb +359 -0
- data/test/alturi/tc/path_parts_test.rb +215 -0
- data/test/alturi/tc/rfc_test.rb +83 -0
- data/test/alturi/tc/uri_parts_authority.rb +129 -0
- data/test/alturi/tc/uri_parts_test.rb +473 -0
- data/test/alturi/tc/uri_parts_userinfo.rb +140 -0
- data/test/alturi/tests.rb +27 -0
- data/test/base_test.rb +18 -0
- data/test/bin/demo_chdir.rb +60 -0
- data/test/bin/elipsis.rb +11 -0
- data/test/env.sh +4 -0
- data/test/ftp/initftpfiles.rb +1 -0
- data/test/ftp/tc/anon_copy_data.rb +31 -0
- data/test/ftp/tc/anon_misc.rb +109 -0
- data/test/ftp/tc/anon_read.rb +99 -0
- data/test/ftp/tc/anon_special.rb +37 -0
- data/test/ftp/tc/anon_write.rb +68 -0
- data/test/ftp/tc/copy.rb +35 -0
- data/test/ftp/tc/empty.rb +16 -0
- data/test/ftp/tc/ftp2ftp.rb +42 -0
- data/test/ftp/tc/ftp_fs.rb +333 -0
- data/test/ftp/testdef.rb +7 -2
- data/test/ftp/tests.rb +24 -0
- data/test/gem_runtests.rb +1 -1
- data/test/http/copy-from-http.rb +0 -1
- data/test/http/def.rb +20 -0
- data/test/http/tc/copy_from_http.rb +128 -0
- data/test/http/tc/empty.rb +14 -0
- data/test/http/tc/uri_meta.rb +52 -0
- data/test/http/tests.rb +19 -0
- data/test/lib/assertions.rb +7 -0
- data/test/lib/run_tests.rb +26 -0
- data/test/lib/temp_server.rb +7 -4
- data/test/methods/test_suite.rb +108 -0
- data/test/platform.rb +5 -0
- data/test/qpdir.rb +2 -0
- data/test/rio/scheme.rb +49 -0
- data/test/rio/tc/pathparts.rb +61 -0
- data/test/riotest/test_suite.rb +33 -0
- data/test/riotest/unit_test.rb +118 -0
- data/test/riotest/util.rb +23 -0
- data/test/runalltests.rb +1 -1
- data/test/runftptests.rb +2 -7
- data/test/runhttp.rb +4 -2
- data/test/runhttptests.rb +6 -5
- data/test/runtests.rb +66 -37
- data/test/srv/www/htdocs/riotest/dir/index.html +11 -0
- data/test/srv/www/htdocs/riotest/hw.html +8 -0
- data/test/srv/www/htdocs/riotest/lines.txt.gz +0 -0
- data/test/tc/abs2.rb +358 -0
- data/test/tc/all.rb +17 -10
- data/test/tc/base2.rb +8 -7
- data/test/tc/clearsel.rb +3 -2
- data/test/tc/closeoneof.rb +14 -15
- data/test/tc/cmdio.rb +193 -0
- data/test/tc/cmdpipe.rb +258 -63
- data/test/tc/copy.rb +3 -2
- data/test/tc/copyarray.rb +0 -4
- data/test/tc/copydest.rb +2 -3
- data/test/tc/copydir.rb +5 -1
- data/test/tc/copydir2.rb +68 -0
- data/test/tc/create.rb +4 -9
- data/test/tc/csv.rb +38 -119
- data/test/tc/csv2.rb +38 -57
- data/test/tc/csv_columns.rb +210 -8
- data/test/tc/csv_gzip.rb +78 -0
- data/test/tc/csv_headers.rb +134 -0
- data/test/tc/csvutil.rb +53 -16
- data/test/tc/dir.rb +3 -4
- data/test/tc/dir_iter.rb +3 -1
- data/test/tc/dirent.rb +8 -7
- data/test/tc/each.rb +62 -47
- data/test/tc/each_break.rb +67 -25
- data/test/tc/edf.rb +3 -2
- data/test/tc/empty.rb +6 -4
- data/test/tc/encoding.rb +30 -0
- data/test/tc/entary.rb +6 -5
- data/test/tc/eq.rb +2 -2
- data/test/tc/expand_path.rb +14 -14
- data/test/tc/ext.rb +7 -7
- data/test/tc/fileno.rb +3 -2
- data/test/tc/files_select.rb +1 -1
- data/test/tc/getrec.rb +2 -3
- data/test/tc/gzip.rb +5 -3
- data/test/tc/likeio.rb +5 -5
- data/test/tc/lineno.rb +1 -1
- data/test/tc/lines.rb +4 -4
- data/test/tc/misc.rb +29 -171
- data/test/tc/nolines.rb +4 -2
- data/test/tc/noqae.rb +12 -10
- data/test/tc/overload.rb +1 -2
- data/test/tc/pa.rb +25 -24
- data/test/tc/path_parts.rb +54 -20
- data/test/tc/paths.rb +3 -2
- data/test/tc/piper.rb +32 -31
- data/test/tc/programs_util.rb +9 -9
- data/test/tc/qae.rb +9 -8
- data/test/tc/qae_riovar.rb +9 -8
- data/test/tc/records.rb +3 -2
- data/test/tc/rename.rb +4 -4
- data/test/tc/riorl.rb +19 -19
- data/test/tc/rlparts.ans.yml +1161 -0
- data/test/tc/splitlines.rb +1 -1
- data/test/tc/splitpath.rb +9 -8
- data/test/tc/strio.rb +73 -0
- data/test/tc/symlink.rb +3 -2
- data/test/tc/symlink0.rb +4 -3
- data/test/tc/symlink1.rb +4 -3
- data/test/tc/temp.rb +40 -26
- data/test/tc/tempdir.rb +12 -12
- data/test/tc/testcase.rb +45 -31
- data/test/tc/tonl.rb +0 -1
- data/test/tc/truncate.rb +111 -13
- data/test/tc/yaml.rb +1 -1
- data/test/test_suite.rb +31 -0
- data/test/tests.rb +35 -0
- data/test/tsuite.rb +19 -0
- data/test/uriref/tc/basic.rb +171 -0
- data/test/uriref/tc/build.rb +30 -0
- data/test/uriref/tc/empty.rb +13 -0
- data/test/uriref/tc/route.rb +72 -0
- data/test/uriref/tests.rb +16 -0
- metadata +356 -424
- data/ChangeLog +0 -3122
- data/VERSION +0 -1
- data/build_doc.rb +0 -94
- data/doc/ANNOUNCE +0 -157
- data/doc/RELEASE_NOTES +0 -308
- data/doc/RIOIS +0 -215
- data/doc/generators/template/html/rio.css +0 -428
- data/doc/generators/template/html/rio.rb +0 -523
- data/doc/generators/template/html/ugly.rb +0 -132
- data/doc/pkg_def.rb +0 -60
- data/doc/rdoc/classes/Kernel.html +0 -133
- data/doc/rdoc/classes/Kernel.src/M000234.html +0 -18
- data/doc/rdoc/classes/RIO.html +0 -625
- data/doc/rdoc/classes/RIO.src/M000001.html +0 -18
- data/doc/rdoc/classes/RIO.src/M000002.html +0 -18
- data/doc/rdoc/classes/RIO.src/M000003.html +0 -18
- data/doc/rdoc/classes/RIO/Doc.html +0 -149
- data/doc/rdoc/classes/RIO/Doc/EXAMPLES.html +0 -432
- data/doc/rdoc/classes/RIO/Doc/HOWTO.html +0 -1084
- data/doc/rdoc/classes/RIO/Doc/INDEX.html +0 -368
- data/doc/rdoc/classes/RIO/Doc/INTRO.html +0 -1529
- data/doc/rdoc/classes/RIO/Doc/OPTIONAL.html +0 -221
- data/doc/rdoc/classes/RIO/Doc/SYNOPSIS.html +0 -336
- data/doc/rdoc/classes/RIO/IF.html +0 -165
- data/doc/rdoc/classes/RIO/IF/CSV.html +0 -203
- data/doc/rdoc/classes/RIO/IF/CSV.src/M000129.html +0 -19
- data/doc/rdoc/classes/RIO/IF/CSV.src/M000130.html +0 -16
- data/doc/rdoc/classes/RIO/IF/CSV.src/M000131.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Dir.html +0 -343
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000045.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000046.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000047.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000048.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000049.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000050.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Dir.src/M000051.html +0 -16
- data/doc/rdoc/classes/RIO/IF/File.html +0 -223
- data/doc/rdoc/classes/RIO/IF/File.src/M000216.html +0 -16
- data/doc/rdoc/classes/RIO/IF/File.src/M000217.html +0 -16
- data/doc/rdoc/classes/RIO/IF/File.src/M000218.html +0 -16
- data/doc/rdoc/classes/RIO/IF/File.src/M000219.html +0 -16
- data/doc/rdoc/classes/RIO/IF/FileOrDir.html +0 -572
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000117.html +0 -16
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000118.html +0 -16
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000119.html +0 -16
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000120.html +0 -16
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000121.html +0 -16
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000122.html +0 -16
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000123.html +0 -16
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000124.html +0 -16
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000125.html +0 -16
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000126.html +0 -16
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000127.html +0 -16
- data/doc/rdoc/classes/RIO/IF/FileOrDir.src/M000128.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.html +0 -1376
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000052.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000053.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000054.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000055.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000056.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000057.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000058.html +0 -21
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000059.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000060.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000061.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000062.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000063.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000064.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000065.html +0 -21
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000066.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000067.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000068.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000069.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Grande.src/M000070.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.html +0 -810
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000107.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000108.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000109.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000110.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000111.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000112.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000113.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000114.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000115.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeEntry.src/M000116.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.html +0 -1513
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000071.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000072.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000073.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000074.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000075.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000076.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000077.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000078.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000079.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000080.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000081.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000082.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000083.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000084.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000085.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000086.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000087.html +0 -19
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000088.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000089.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000090.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000091.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000092.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000093.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000094.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000095.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000096.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000097.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000098.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000099.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000100.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000101.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000102.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000103.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000104.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000105.html +0 -16
- data/doc/rdoc/classes/RIO/IF/GrandeStream.src/M000106.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.html +0 -999
- data/doc/rdoc/classes/RIO/IF/Path.src/M000132.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000133.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000134.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000135.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000136.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000137.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000138.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000139.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000140.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000141.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000142.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000143.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000144.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000145.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000146.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000147.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000148.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000149.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000150.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000151.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000152.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000153.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000154.html +0 -18
- data/doc/rdoc/classes/RIO/IF/Path.src/M000155.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000156.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000157.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000158.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000159.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000160.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000161.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000162.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Path.src/M000163.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.html +0 -1416
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000004.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000005.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000006.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000007.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000008.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000009.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000010.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000011.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000012.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000013.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000014.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000015.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000016.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000017.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000018.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000019.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000020.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000021.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000022.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000023.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000024.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000025.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000026.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000027.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000028.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000029.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000030.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000031.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000032.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000033.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000034.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000035.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000036.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000037.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000038.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000039.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000040.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000041.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000042.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000043.html +0 -16
- data/doc/rdoc/classes/RIO/IF/RubyIO.src/M000044.html +0 -16
- data/doc/rdoc/classes/RIO/IF/String.html +0 -203
- data/doc/rdoc/classes/RIO/IF/String.src/M000213.html +0 -16
- data/doc/rdoc/classes/RIO/IF/String.src/M000214.html +0 -16
- data/doc/rdoc/classes/RIO/IF/String.src/M000215.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.html +0 -990
- data/doc/rdoc/classes/RIO/IF/Test.src/M000177.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000178.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000179.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000180.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000181.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000182.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000183.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000184.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000185.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000186.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000187.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000188.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000189.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000190.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000191.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000192.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000193.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000194.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000195.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000196.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000197.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000198.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000199.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000200.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000201.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000202.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000203.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000204.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000205.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000206.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000207.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000208.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000209.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000210.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000211.html +0 -16
- data/doc/rdoc/classes/RIO/IF/Test.src/M000212.html +0 -16
- data/doc/rdoc/classes/RIO/IF/YAML.html +0 -517
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000164.html +0 -19
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000165.html +0 -16
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000166.html +0 -16
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000167.html +0 -16
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000168.html +0 -16
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000169.html +0 -16
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000170.html +0 -16
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000171.html +0 -16
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000172.html +0 -16
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000173.html +0 -16
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000174.html +0 -16
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000175.html +0 -16
- data/doc/rdoc/classes/RIO/IF/YAML.src/M000176.html +0 -16
- data/doc/rdoc/classes/RIO/Rio.html +0 -508
- data/doc/rdoc/classes/RIO/Rio.src/M000220.html +0 -18
- data/doc/rdoc/classes/RIO/Rio.src/M000221.html +0 -20
- data/doc/rdoc/classes/RIO/Rio.src/M000222.html +0 -27
- data/doc/rdoc/classes/RIO/Rio.src/M000223.html +0 -16
- data/doc/rdoc/classes/RIO/Rio.src/M000225.html +0 -19
- data/doc/rdoc/classes/RIO/Rio.src/M000226.html +0 -20
- data/doc/rdoc/classes/RIO/Rio.src/M000227.html +0 -16
- data/doc/rdoc/classes/RIO/Rio.src/M000228.html +0 -16
- data/doc/rdoc/classes/RIO/Rio.src/M000229.html +0 -16
- data/doc/rdoc/classes/RIO/Rio.src/M000230.html +0 -16
- data/doc/rdoc/classes/RIO/Rio.src/M000231.html +0 -16
- data/doc/rdoc/classes/RIO/Rio.src/M000232.html +0 -16
- data/doc/rdoc/classes/RIO/Rio.src/M000233.html +0 -16
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/README.html +0 -232
- data/doc/rdoc/files/lib/rio/constructor_rb.html +0 -141
- data/doc/rdoc/files/lib/rio/doc/EXAMPLES_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/doc/HOWTO_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/doc/INDEX_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/doc/INTRO_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/doc/OPTIONAL_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/doc/SYNOPSIS_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/basic_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/csv_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/dir_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/file_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/fileordir_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/grande_entry_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/grande_rb.html +0 -141
- data/doc/rdoc/files/lib/rio/if/grande_stream_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/internal_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/path_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/rubyio_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/string_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/temp_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/test_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/if/yaml_rb.html +0 -134
- data/doc/rdoc/files/lib/rio/kernel_rb.html +0 -142
- data/doc/rdoc/files/lib/rio_rb.html +0 -153
- data/doc/rdoc/fr_class_index.html +0 -49
- data/doc/rdoc/fr_file_index.html +0 -51
- data/doc/rdoc/fr_method_index.html +0 -260
- data/doc/rdoc/index.html +0 -30
- data/doc/rdoc/rdoc-style.css +0 -428
- data/doc/rfc1738.txt +0 -1403
- data/doc/rfc959.txt +0 -3933
- data/ex/catcsv.rb +0 -64
- data/ex/colx.rb +0 -8
- data/ex/findinruby +0 -15
- data/ex/findruby +0 -14
- data/ex/passwd_report.rb +0 -8
- data/ex/prompt.rb +0 -25
- data/ex/rgb.txt.gz +0 -0
- data/ex/riocat +0 -42
- data/ex/riogunzip +0 -31
- data/ex/riogzip +0 -24
- data/ex/rioprompt.rb +0 -10
- data/ex/targz2zip +0 -17
- data/ex/tonl +0 -10
- data/setup.rb +0 -1360
- data/test/ftp/all.rb +0 -9
- data/test/ftp/anon_copy_data.rb +0 -36
- data/test/ftp/anon_misc.rb +0 -124
- data/test/ftp/anon_read.rb +0 -105
- data/test/ftp/anon_special.rb +0 -68
- data/test/ftp/anon_write.rb +0 -70
- data/test/ftp/ftp2ftp.rb +0 -51
- data/test/tc/abs.rb +0 -355
@@ -0,0 +1,313 @@
|
|
1
|
+
module Alt
|
2
|
+
module URI
|
3
|
+
module Algorithm
|
4
|
+
|
5
|
+
def self.relative(t,base)
|
6
|
+
r = t.class.new
|
7
|
+
if t.scheme != base.scheme
|
8
|
+
r = t
|
9
|
+
else
|
10
|
+
if t.authority != base.authority
|
11
|
+
r = t
|
12
|
+
else
|
13
|
+
r.path = rel_path(t.path,base.path)
|
14
|
+
r.path = "." if r.path.empty?
|
15
|
+
r.query = t.query
|
16
|
+
r.fragment = t.fragment
|
17
|
+
end
|
18
|
+
end
|
19
|
+
return r
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.rel_path(path,base)
|
23
|
+
bs = base.split("/",-1)
|
24
|
+
pa = path.split("/",-1)
|
25
|
+
bsize = bs.size
|
26
|
+
psize = pa.size
|
27
|
+
out = []
|
28
|
+
(0...[bsize,psize].min).each do |i|
|
29
|
+
out[0] = pa[i]
|
30
|
+
if bs[i] != pa[i]
|
31
|
+
i += 1
|
32
|
+
out.unshift(*([".."] * (bsize - i)))
|
33
|
+
out += pa[i,psize-1]
|
34
|
+
return out.join("/")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
if bsize > psize
|
38
|
+
out.unshift(*([".."] * (bsize - psize)))
|
39
|
+
elsif psize > bsize
|
40
|
+
out += pa[bsize,psize-bsize]
|
41
|
+
end
|
42
|
+
return out.join("/")
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
# 7) The resulting URI components, including any inherited from the
|
48
|
+
# base URI, are recombined to give the absolute form of the URI
|
49
|
+
# reference. Using pseudocode, this would be
|
50
|
+
|
51
|
+
# result = ""
|
52
|
+
|
53
|
+
# if scheme is defined then
|
54
|
+
# append scheme to result
|
55
|
+
# append ":" to result
|
56
|
+
|
57
|
+
# if authority is defined then
|
58
|
+
# append "//" to result
|
59
|
+
# append authority to result
|
60
|
+
|
61
|
+
# append path to result
|
62
|
+
|
63
|
+
# if query is defined then
|
64
|
+
# append "?" to result
|
65
|
+
# append query to result
|
66
|
+
|
67
|
+
# if fragment is defined then
|
68
|
+
# append "#" to result
|
69
|
+
# append fragment to result
|
70
|
+
|
71
|
+
# return result
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
def self.uri_string(r)
|
84
|
+
( defined(r.scheme) ? r.scheme + ":" : "") +
|
85
|
+
( defined(r.authority) ? "//" + r.authority : "") +
|
86
|
+
r.path +
|
87
|
+
( defined(r.query) ? "?" + r.query : "") +
|
88
|
+
( defined(r.fragment) ? "#" + r.fragment : "")
|
89
|
+
end
|
90
|
+
def self.authority_string(r)
|
91
|
+
( defined(r.userinfo) ? r.userinfo + "@" : "") +
|
92
|
+
r.host +
|
93
|
+
( defined(r.port) ? ":" + r.port : "")
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
def self.defined(el)
|
100
|
+
!el.nil?
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.transform(r,base,strict=true)
|
104
|
+
|
105
|
+
#-- A non-strict parser may ignore a scheme in the reference
|
106
|
+
#-- if it is identical to the base URI's scheme.
|
107
|
+
#--
|
108
|
+
if ((not strict) and (r.scheme == base.scheme))
|
109
|
+
r.scheme = nil
|
110
|
+
end
|
111
|
+
|
112
|
+
t = r.class.new
|
113
|
+
if defined(r.scheme)
|
114
|
+
t.scheme = r.scheme;
|
115
|
+
t.authority = r.authority;
|
116
|
+
t.path = remove_dot_segments(r.path);
|
117
|
+
t.query = r.query;
|
118
|
+
else
|
119
|
+
if defined(r.authority)
|
120
|
+
t.authority = r.authority;
|
121
|
+
t.path = remove_dot_segments(r.path);
|
122
|
+
t.query = r.query;
|
123
|
+
else
|
124
|
+
if (r.path == "")
|
125
|
+
t.path = base.path;
|
126
|
+
|
127
|
+
if defined(r.query)
|
128
|
+
t.query = r.query;
|
129
|
+
else
|
130
|
+
t.query = base.query;
|
131
|
+
end
|
132
|
+
else
|
133
|
+
if (r.path.start_with?("/")) then
|
134
|
+
t.path = remove_dot_segments(r.path);
|
135
|
+
else
|
136
|
+
t.path = merge(base, r);
|
137
|
+
t.path = remove_dot_segments(t.path);
|
138
|
+
end
|
139
|
+
t.query = r.query;
|
140
|
+
end
|
141
|
+
t.authority = base.authority;
|
142
|
+
end
|
143
|
+
t.scheme = base.scheme;
|
144
|
+
end
|
145
|
+
t.fragment = r.fragment;
|
146
|
+
|
147
|
+
return t
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
# 5.2.3. Merge Paths
|
152
|
+
|
153
|
+
# The pseudocode above refers to a "merge" routine for merging a
|
154
|
+
# relative-path reference with the path of the base URI. This is
|
155
|
+
# accomplished as follows:
|
156
|
+
|
157
|
+
# o If the base URI has a defined authority component and an empty
|
158
|
+
# path, then return a string consisting of "/" concatenated with the
|
159
|
+
# reference's path; otherwise,
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
# o return a string consisting of the reference's path component
|
164
|
+
# appended to all but the last segment of the base URI's path (i.e.,
|
165
|
+
# excluding any characters after the right-most "/" in the base URI
|
166
|
+
# path, or excluding the entire base URI path if it does not contain
|
167
|
+
# any "/" characters).
|
168
|
+
|
169
|
+
|
170
|
+
def self.merge(base,r)
|
171
|
+
if defined(base.authority) and base.path.empty?
|
172
|
+
"/"
|
173
|
+
else
|
174
|
+
if npos = base.path.rindex("/")
|
175
|
+
base.path[0,npos+1]
|
176
|
+
else
|
177
|
+
""
|
178
|
+
end
|
179
|
+
end + r.path
|
180
|
+
end
|
181
|
+
|
182
|
+
|
183
|
+
# 5.2.4. Remove Dot Segments
|
184
|
+
|
185
|
+
# The pseudocode also refers to a "remove_dot_segments" routine for
|
186
|
+
# interpreting and removing the special "." and ".." complete path
|
187
|
+
# segments from a referenced path. This is done after the path is
|
188
|
+
# extracted from a reference, whether or not the path was relative, in
|
189
|
+
# order to remove any invalid or extraneous dot-segments prior to
|
190
|
+
# forming the target URI. Although there are many ways to accomplish
|
191
|
+
# this removal process, we describe a simple method using two string
|
192
|
+
# buffers.
|
193
|
+
|
194
|
+
# 1. The input buffer is initialized with the now-appended path
|
195
|
+
# components and the output buffer is initialized to the empty
|
196
|
+
# string.
|
197
|
+
|
198
|
+
# 2. While the input buffer is not empty, loop as follows:
|
199
|
+
|
200
|
+
# A. If the input buffer begins with a prefix of "../" or "./",
|
201
|
+
# then remove that prefix from the input buffer; otherwise,
|
202
|
+
|
203
|
+
# B. if the input buffer begins with a prefix of "/./" or "/.",
|
204
|
+
# where "." is a complete path segment, then replace that
|
205
|
+
# prefix with "/" in the input buffer; otherwise,
|
206
|
+
|
207
|
+
# C. if the input buffer begins with a prefix of "/../" or "/..",
|
208
|
+
# where ".." is a complete path segment, then replace that
|
209
|
+
# prefix with "/" in the input buffer and remove the last
|
210
|
+
# segment and its preceding "/" (if any) from the output
|
211
|
+
# buffer; otherwise,
|
212
|
+
|
213
|
+
# D. if the input buffer consists only of "." or "..", then remove
|
214
|
+
# that from the input buffer; otherwise,
|
215
|
+
|
216
|
+
# E. move the first path segment in the input buffer to the end of
|
217
|
+
# the output buffer, including the initial "/" character (if
|
218
|
+
# any) and any subsequent characters up to, but not including,
|
219
|
+
# the next "/" character or the end of the input buffer.
|
220
|
+
|
221
|
+
# 3. Finally, the output buffer is returned as the result of
|
222
|
+
# remove_dot_segments.
|
223
|
+
|
224
|
+
def self.remove_dot_segments(instr)
|
225
|
+
# 1. The input buffer is initialized with the now-appended path
|
226
|
+
# components and the output buffer is initialized to the empty
|
227
|
+
# string.
|
228
|
+
inp = instr.dup
|
229
|
+
out = ""
|
230
|
+
|
231
|
+
# 2. While the input buffer is not empty, loop as follows:
|
232
|
+
while !inp.empty?
|
233
|
+
|
234
|
+
# A. If the input buffer begins with a prefix of "../" or "./",
|
235
|
+
# then remove that prefix from the input buffer; otherwise,
|
236
|
+
unless inp.sub!( %r'^\.\.?/' , '')
|
237
|
+
|
238
|
+
# B. if the input buffer begins with a prefix of "/./" or "/.",
|
239
|
+
# where "." is a complete path segment, then replace that
|
240
|
+
# prefix with "/" in the input buffer; otherwise,
|
241
|
+
unless inp.sub!( %r'^/\.(/|\Z)' ,"/" )#
|
242
|
+
|
243
|
+
# C. if the input buffer begins with a prefix of "/../" or "/..",
|
244
|
+
# where ".." is a complete path segment, then replace that
|
245
|
+
# prefix with "/" in the input buffer and remove the last
|
246
|
+
# segment and its preceding "/" (if any) from the output
|
247
|
+
# buffer; otherwise,
|
248
|
+
if inp.sub!( %r'^/\.\.(/|\Z)' ,"/" )
|
249
|
+
out.sub!(%r'/?[^/]*\Z',"")
|
250
|
+
else
|
251
|
+
|
252
|
+
# D. if the input buffer consists only of "." or "..", then remove
|
253
|
+
# that from the input buffer; otherwise,
|
254
|
+
unless inp.sub!( /^\.\.?$/, "")
|
255
|
+
|
256
|
+
# E. move the first path segment in the input buffer to the end of
|
257
|
+
# the output buffer, including the initial "/" character (if
|
258
|
+
# any) and any subsequent characters up to, but not including,
|
259
|
+
# the next "/" character or the end of the input buffer.
|
260
|
+
inp.sub!( %r'^(/?[^/]*)' ) { |match|
|
261
|
+
out << match
|
262
|
+
""
|
263
|
+
}
|
264
|
+
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
# 3. Finally, the output buffer is returned as the result of
|
272
|
+
# remove_dot_segments.
|
273
|
+
out
|
274
|
+
|
275
|
+
end
|
276
|
+
|
277
|
+
|
278
|
+
def self.dump_bufs(inp,out)
|
279
|
+
#printf("inp:[%-15s] out:[%-15s]\n",inp,out)
|
280
|
+
end
|
281
|
+
|
282
|
+
def self.remove_dot_segments0(inp)
|
283
|
+
out = ""
|
284
|
+
while !inp.empty?
|
285
|
+
unless inp.sub!( %r'^\.\.?/' , "")
|
286
|
+
unless inp.sub!( %r'^/\.(/|\Z)' ,"/" )
|
287
|
+
if inp.sub!( %r'^/\.\.(/|\Z)' ,"/" )
|
288
|
+
out.sub!(%r'/?[^/]*\Z',"")
|
289
|
+
else
|
290
|
+
unless inp.sub!( /^\.\.?$/, "")
|
291
|
+
inp.sub!( %r'^(/?[^/]*)' ) { |match|
|
292
|
+
out << match
|
293
|
+
""
|
294
|
+
}
|
295
|
+
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
out
|
302
|
+
end
|
303
|
+
|
304
|
+
end
|
305
|
+
|
306
|
+
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
if __FILE__ == $0
|
311
|
+
# TODO Generated stub
|
312
|
+
end
|
313
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module Alt
|
2
|
+
module URI
|
3
|
+
class CachedFields
|
4
|
+
DEPENDS = {
|
5
|
+
:uri => [:scheme,:authority,:path,:query,:fragment],
|
6
|
+
:authority => [:userinfo,:host,:port]
|
7
|
+
}
|
8
|
+
|
9
|
+
def self.flatten_depends_list(depends,list)
|
10
|
+
flat = []
|
11
|
+
list.each do |sym|
|
12
|
+
flat << sym
|
13
|
+
if depends[sym]
|
14
|
+
flat += flatten_depends_list(depends,depends[sym])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
flat
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.gen_sullies(depends)
|
21
|
+
sullies = {}
|
22
|
+
depends.each do |key,ary|
|
23
|
+
list = flatten_depends_list(depends,ary)
|
24
|
+
list.each do |k|
|
25
|
+
sullies[k] ||= []
|
26
|
+
sullies[k] << key
|
27
|
+
end
|
28
|
+
sullies[key] ||= []
|
29
|
+
sullies[key] += list
|
30
|
+
end
|
31
|
+
sullies
|
32
|
+
end
|
33
|
+
SULLIES = gen_sullies(DEPENDS)
|
34
|
+
|
35
|
+
def initialize
|
36
|
+
@store = Hash.new
|
37
|
+
end
|
38
|
+
|
39
|
+
def [](key)
|
40
|
+
@store[key]
|
41
|
+
end
|
42
|
+
|
43
|
+
def clear_key(key)
|
44
|
+
if klist = SULLIES[key]
|
45
|
+
klist.each do |k|
|
46
|
+
@store.delete(k)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
@store.delete(key)
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
def []=(key,val)
|
55
|
+
clear_key(key)
|
56
|
+
@store[key] = val
|
57
|
+
end
|
58
|
+
|
59
|
+
def has_key?(arg)
|
60
|
+
@store.has_key?(arg)
|
61
|
+
end
|
62
|
+
def inspect
|
63
|
+
@store.inspect
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'rio/alturi/regex'
|
2
|
+
|
3
|
+
module Alt
|
4
|
+
module URI
|
5
|
+
module Escape
|
6
|
+
def self.build_escape_table(re)
|
7
|
+
ca = []
|
8
|
+
|
9
|
+
(0..255).each do |n|
|
10
|
+
ca[n] = (n.chr =~ re ? n.chr : sprintf('%%%02X', n))
|
11
|
+
end
|
12
|
+
return ca
|
13
|
+
end
|
14
|
+
|
15
|
+
CHAR_TABLE = {
|
16
|
+
:path => build_escape_table(REGEXP::PCHAR),
|
17
|
+
:query => build_escape_table(REGEXP::QCHAR),
|
18
|
+
:query_part => build_escape_table(REGEXP::QPCHAR),
|
19
|
+
:fragment => build_escape_table(REGEXP::FCHAR),
|
20
|
+
:userinfo => build_escape_table(REGEXP::UCHAR),
|
21
|
+
:user => build_escape_table(REGEXP::USERCHAR),
|
22
|
+
:host => build_escape_table(REGEXP::HCHAR),
|
23
|
+
}
|
24
|
+
|
25
|
+
def escape(str,arg)
|
26
|
+
Escape.escape(str,arg)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.escape(str,arg)
|
30
|
+
tmp = ""
|
31
|
+
# p "escape: #{es(str)}"
|
32
|
+
table = (::Symbol === arg ? CHAR_TABLE[arg] : arg)
|
33
|
+
str.each_byte do |b|
|
34
|
+
tmp << table[b]
|
35
|
+
end
|
36
|
+
#p "escape: tmp=#{es(str)} str.enc=#{str.encoding}"
|
37
|
+
tmp.encode(str.encoding)
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.build_unescape_hash
|
41
|
+
lookup = {}
|
42
|
+
|
43
|
+
chars = "0123456789ABCDEF"
|
44
|
+
chars.split('').each do |cu|
|
45
|
+
chars.split('').each do |cl|
|
46
|
+
str = "%#{cu}#{cl}"
|
47
|
+
lookup[str] = str[1,2].hex.chr
|
48
|
+
end
|
49
|
+
end
|
50
|
+
lookup
|
51
|
+
end
|
52
|
+
UNESCAPE_HASH = build_unescape_hash
|
53
|
+
|
54
|
+
def self.unescape(estr)
|
55
|
+
#p "ESTR: #{estr}"
|
56
|
+
ustr = ""
|
57
|
+
pos = 0
|
58
|
+
while npos = estr.index('%',pos)
|
59
|
+
uh = UNESCAPE_HASH[estr[npos,3].upcase]
|
60
|
+
#p "UH: #{uh.inspect} npos:#{npos} pos:#{pos}"
|
61
|
+
ustr << estr[pos,npos-pos] << uh
|
62
|
+
pos = npos +3
|
63
|
+
end
|
64
|
+
ustr << estr[pos..-1]
|
65
|
+
end
|
66
|
+
|
67
|
+
def unescape(str)
|
68
|
+
Escape.unescape(str)
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.unescape0(str, escaped = REGEXP::PCT_ENCODED)
|
72
|
+
str.gsub(escaped) {
|
73
|
+
[$&[1, 2].hex].pack('C')
|
74
|
+
}.force_encoding(str.encoding)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
if __FILE__ == $0
|
81
|
+
# TODO Generated stub
|
82
|
+
end
|