vagrant-unbundled 2.0.3.0 → 2.0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -10
  3. data/Gemfile.lock +16 -2
  4. data/README.md +1 -0
  5. data/bin/vagrant +1 -1
  6. data/lib/vagrant/action/builtin/handle_box.rb +1 -1
  7. data/lib/vagrant/action/general/package.rb +1 -1
  8. data/lib/vagrant/action.rb +3 -1
  9. data/lib/vagrant/alias.rb +56 -0
  10. data/lib/vagrant/bundler.rb +1 -1
  11. data/lib/vagrant/capability_host.rb +1 -1
  12. data/lib/vagrant/cli.rb +8 -0
  13. data/lib/vagrant/config/version_base.rb +1 -1
  14. data/lib/vagrant/environment.rb +7 -1
  15. data/lib/vagrant/errors.rb +4 -0
  16. data/lib/vagrant/host.rb +1 -1
  17. data/lib/vagrant/machine.rb +1 -1
  18. data/lib/vagrant/machine_index.rb +1 -1
  19. data/lib/vagrant/plugin/v1/guest.rb +1 -1
  20. data/lib/vagrant/plugin/v1/host.rb +1 -1
  21. data/lib/vagrant/plugin/v1/plugin.rb +1 -1
  22. data/lib/vagrant/plugin/v1/provider.rb +1 -1
  23. data/lib/vagrant/plugin/v2/guest.rb +1 -1
  24. data/lib/vagrant/plugin/v2/host.rb +1 -1
  25. data/lib/vagrant/plugin/v2/plugin.rb +1 -1
  26. data/lib/vagrant/plugin/v2/provider.rb +1 -1
  27. data/lib/vagrant/shared_helpers.rb +30 -9
  28. data/lib/vagrant/util/checkpoint_client.rb +8 -0
  29. data/lib/vagrant/util/downloader.rb +1 -1
  30. data/lib/vagrant/util/platform.rb +11 -3
  31. data/lib/vagrant/util/powershell.rb +17 -1
  32. data/lib/vagrant/util/safe_exec.rb +1 -1
  33. data/lib/vagrant/util/ssh.rb +4 -1
  34. data/lib/vagrant/util/stacked_proc_runner.rb +1 -1
  35. data/lib/vagrant/util/template_renderer.rb +2 -2
  36. data/lib/vagrant/vagrantfile.rb +1 -1
  37. data/lib/vagrant.rb +8 -0
  38. data/plugins/commands/plugin/gem_helper.rb +1 -1
  39. data/plugins/commands/powershell/command.rb +2 -2
  40. data/plugins/commands/powershell/scripts/enable_psremoting.ps1 +1 -1
  41. data/plugins/communicators/ssh/communicator.rb +10 -1
  42. data/plugins/communicators/winrm/command_filters/mkdir.rb +4 -2
  43. data/plugins/communicators/winrm/command_filters/rm.rb +5 -3
  44. data/plugins/communicators/winrm/command_filters/test.rb +3 -1
  45. data/plugins/communicators/winrm/command_filters/which.rb +4 -2
  46. data/plugins/communicators/winrm/communicator.rb +3 -3
  47. data/plugins/guests/amazon/cap/flavor.rb +1 -1
  48. data/plugins/guests/coreos/cap/configure_networks.rb +1 -1
  49. data/plugins/guests/coreos/guest.rb +1 -1
  50. data/plugins/guests/debian/cap/configure_networks.rb +1 -1
  51. data/plugins/guests/freebsd/cap/configure_networks.rb +1 -1
  52. data/plugins/guests/photon/guest.rb +1 -1
  53. data/plugins/guests/windows/cap/change_host_name.rb +6 -1
  54. data/plugins/guests/windows/cap/mount_shared_folder.rb +1 -1
  55. data/plugins/hosts/alt/plugin.rb +1 -1
  56. data/plugins/hosts/arch/plugin.rb +1 -1
  57. data/plugins/hosts/gentoo/plugin.rb +1 -1
  58. data/plugins/hosts/linux/plugin.rb +1 -1
  59. data/plugins/hosts/redhat/plugin.rb +1 -1
  60. data/plugins/hosts/slackware/plugin.rb +2 -2
  61. data/plugins/kernel_v2/config/push.rb +1 -1
  62. data/plugins/kernel_v2/config/vm.rb +1 -1
  63. data/plugins/providers/docker/action/compare_synced_folders.rb +1 -1
  64. data/plugins/providers/virtualbox/action/network.rb +9 -5
  65. data/plugins/providers/virtualbox/action/network_fix_ipv6.rb +1 -1
  66. data/plugins/provisioners/chef/config/chef_zero.rb +1 -1
  67. data/plugins/provisioners/chef/provisioner/chef_solo.rb +2 -2
  68. data/plugins/provisioners/chef/provisioner/chef_zero.rb +3 -3
  69. data/plugins/provisioners/puppet/config/puppet.rb +2 -0
  70. data/plugins/provisioners/puppet/provisioner/puppet.rb +18 -1
  71. data/plugins/provisioners/salt/config.rb +6 -0
  72. data/plugins/provisioners/salt/provisioner.rb +11 -1
  73. data/templates/locales/command_ps.yml +1 -1
  74. data/templates/locales/en.yml +13 -4
  75. data/templates/locales/guest_windows.yml +1 -1
  76. data/templates/locales/providers_docker.yml +1 -1
  77. data/templates/locales/synced_folder_smb.yml +2 -2
  78. data/vagrant.gemspec +2 -0
  79. data/vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/vagrant-spec.gemspec +1 -1
  80. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/.document +5 -0
  81. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/.gitignore +17 -0
  82. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/.travis.yml +21 -0
  83. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/CHANGELOG.md +209 -0
  84. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/Gemfile +4 -0
  85. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/LICENSE.txt +78 -0
  86. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/README.md +67 -0
  87. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/Rakefile +88 -0
  88. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/data/public_suffix_list.dat +12440 -0
  89. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/domain_name.gemspec +36 -0
  90. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/etld_data.rb +8474 -0
  91. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/etld_data.rb.erb +11 -0
  92. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/punycode.rb +283 -0
  93. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/version.rb +3 -0
  94. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name.rb +297 -0
  95. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/test/helper.rb +17 -0
  96. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/test/test_domain_name-punycode.rb +97 -0
  97. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/test/test_domain_name.rb +317 -0
  98. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/tool/gen_etld_data.rb +63 -0
  99. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/CHANGES +13 -0
  100. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/LICENSE +201 -0
  101. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/MANIFEST +9 -0
  102. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/README +48 -0
  103. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/Rakefile +42 -0
  104. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/certs/djberg96_pub.pem +21 -0
  105. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/ffi-win32-extensions.gemspec +25 -0
  106. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/lib/ffi/win32/extensions.rb +96 -0
  107. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/lib/ffi-win32-extensions.rb +1 -0
  108. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/test/test_ffi_extensions.rb +41 -0
  109. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/test/test_string_extensions.rb +20 -0
  110. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/CHANGES +235 -0
  111. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/MANIFEST +16 -0
  112. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/README +73 -0
  113. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/Rakefile +49 -0
  114. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/appveyor.yml +50 -0
  115. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/certs/djberg96_pub.pem +21 -0
  116. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/constants.rb +33 -0
  117. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/functions.rb +42 -0
  118. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/structs.rb +54 -0
  119. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file.rb +585 -0
  120. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32-file.rb +1 -0
  121. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_link.rb +141 -0
  122. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_misc.rb +16 -0
  123. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_path.rb +282 -0
  124. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_stat.rb +330 -0
  125. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/win32-file.gemspec +33 -0
  126. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/CHANGES +63 -0
  127. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/MANIFEST +18 -0
  128. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/README +47 -0
  129. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/Rakefile +66 -0
  130. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/appveyor.yml +53 -0
  131. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/certs/djberg96_pub.pem +21 -0
  132. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security/constants.rb +149 -0
  133. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security/functions.rb +63 -0
  134. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security/structs.rb +68 -0
  135. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security.rb +963 -0
  136. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32-file-security.rb +1 -0
  137. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_acls.rb +34 -0
  138. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_constants.rb +54 -0
  139. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_encryption.rb +90 -0
  140. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_ffi.rb +33 -0
  141. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_ownership.rb +174 -0
  142. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_permissions.rb +88 -0
  143. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_version.rb +14 -0
  144. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/win32-file-security.gemspec +28 -0
  145. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/CHANGES +169 -0
  146. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/MANIFEST +12 -0
  147. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/README +94 -0
  148. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/Rakefile +28 -0
  149. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/appveyor.yml +48 -0
  150. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/certs/djberg96_pub.pem +21 -0
  151. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/stat.rb +1008 -0
  152. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/windows/constants.rb +94 -0
  153. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/windows/functions.rb +68 -0
  154. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/windows/structs.rb +196 -0
  155. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32-file-stat.rb +1 -0
  156. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/test/test_file_stat.rb +677 -0
  157. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/win32-file-stat.gemspec +30 -0
  158. data/vendor/bundle/ruby/2.5.0/specifications/domain_name-0.5.20180417.gemspec +46 -0
  159. data/vendor/bundle/ruby/2.5.0/specifications/ffi-win32-extensions-1.0.3.gemspec +38 -0
  160. data/vendor/bundle/ruby/2.5.0/specifications/win32-file-0.8.1.gemspec +51 -0
  161. data/vendor/bundle/ruby/2.5.0/specifications/win32-file-security-1.0.10.gemspec +47 -0
  162. data/vendor/bundle/ruby/2.5.0/specifications/win32-file-stat-1.5.5.gemspec +48 -0
  163. data/version.txt +1 -1
  164. metadata +114 -2
@@ -0,0 +1,97 @@
1
+ require 'helper'
2
+
3
+ class TestDomainName < Test::Unit::TestCase
4
+ test "encode labels just as listed in RFC 3492 #7.1 (slightly modified)" do
5
+ [
6
+ ['(A) Arabic (Egyptian)',
7
+ [0x0644, 0x064A, 0x0647, 0x0645, 0x0627, 0x0628, 0x062A, 0x0643, 0x0644,
8
+ 0x0645, 0x0648, 0x0634, 0x0639, 0x0631, 0x0628, 0x064A, 0x061F],
9
+ 'egbpdaj6bu4bxfgehfvwxn'],
10
+ ['(B) Chinese (simplified)',
11
+ [0x4ED6, 0x4EEC, 0x4E3A, 0x4EC0, 0x4E48, 0x4E0D, 0x8BF4, 0x4E2D, 0x6587],
12
+ 'ihqwcrb4cv8a8dqg056pqjye'],
13
+ ['(C) Chinese (traditional)',
14
+ [0x4ED6, 0x5011, 0x7232, 0x4EC0, 0x9EBD, 0x4E0D, 0x8AAA, 0x4E2D, 0x6587],
15
+ 'ihqwctvzc91f659drss3x8bo0yb'],
16
+ ['(D) Czech: Pro<ccaron>prost<ecaron>nemluv<iacute><ccaron>esky',
17
+ [0x0050, 0x0072, 0x006F, 0x010D, 0x0070, 0x0072, 0x006F, 0x0073, 0x0074,
18
+ 0x011B, 0x006E, 0x0065, 0x006D, 0x006C, 0x0075, 0x0076, 0x00ED, 0x010D,
19
+ 0x0065, 0x0073, 0x006B, 0x0079],
20
+ 'Proprostnemluvesky-uyb24dma41a'],
21
+ ['(E) Hebrew',
22
+ [0x05DC, 0x05DE, 0x05D4, 0x05D4, 0x05DD, 0x05E4, 0x05E9, 0x05D5, 0x05D8,
23
+ 0x05DC, 0x05D0, 0x05DE, 0x05D3, 0x05D1, 0x05E8, 0x05D9, 0x05DD, 0x05E2,
24
+ 0x05D1, 0x05E8, 0x05D9, 0x05EA],
25
+ '4dbcagdahymbxekheh6e0a7fei0b'],
26
+ ['(F) Hindi (Devanagari)',
27
+ [0x092F, 0x0939, 0x0932, 0x094B, 0x0917, 0x0939, 0x093F, 0x0928, 0x094D,
28
+ 0x0926, 0x0940, 0x0915, 0x094D, 0x092F, 0x094B, 0x0902, 0x0928, 0x0939,
29
+ 0x0940, 0x0902, 0x092C, 0x094B, 0x0932, 0x0938, 0x0915, 0x0924, 0x0947,
30
+ 0x0939, 0x0948, 0x0902],
31
+ 'i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd'],
32
+ ['(G) Japanese (kanji and hiragana)',
33
+ [0x306A, 0x305C, 0x307F, 0x3093, 0x306A, 0x65E5, 0x672C, 0x8A9E, 0x3092,
34
+ 0x8A71, 0x3057, 0x3066, 0x304F, 0x308C, 0x306A, 0x3044, 0x306E, 0x304B],
35
+ 'n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa'],
36
+ ['(H) Korean (Hangul syllables)',
37
+ [0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC, 0xB78C, 0xB4E4, 0xC774,
38
+ 0xD55C, 0xAD6D, 0xC5B4, 0xB97C, 0xC774, 0xD574, 0xD55C, 0xB2E4, 0xBA74,
39
+ 0xC5BC, 0xB9C8, 0xB098, 0xC88B, 0xC744, 0xAE4C],
40
+ '989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5j' <<
41
+ 'psd879ccm6fea98c'],
42
+ ['(I) Russian (Cyrillic)',
43
+ [0x043F, 0x043E, 0x0447, 0x0435, 0x043C, 0x0443, 0x0436, 0x0435, 0x043E,
44
+ 0x043D, 0x0438, 0x043D, 0x0435, 0x0433, 0x043E, 0x0432, 0x043E, 0x0440,
45
+ 0x044F, 0x0442, 0x043F, 0x043E, 0x0440, 0x0443, 0x0441, 0x0441, 0x043A,
46
+ 0x0438],
47
+ 'b1abfaaepdrnnbgefbadotcwatmq2g4l'],
48
+ ['(J) Spanish: Porqu<eacute>nopuedensimplementehablarenEspa<ntilde>ol',
49
+ [0x0050, 0x006F, 0x0072, 0x0071, 0x0075, 0x00E9, 0x006E, 0x006F, 0x0070,
50
+ 0x0075, 0x0065, 0x0064, 0x0065, 0x006E, 0x0073, 0x0069, 0x006D, 0x0070,
51
+ 0x006C, 0x0065, 0x006D, 0x0065, 0x006E, 0x0074, 0x0065, 0x0068, 0x0061,
52
+ 0x0062, 0x006C, 0x0061, 0x0072, 0x0065, 0x006E, 0x0045, 0x0073, 0x0070,
53
+ 0x0061, 0x00F1, 0x006F, 0x006C],
54
+ 'PorqunopuedensimplementehablarenEspaol-fmd56a'],
55
+ ['(K) Vietnamese: T<adotbelow>isaoh<odotbelow>kh<ocirc>ngth<ecirchookabove>ch' <<
56
+ '<ihookabove>n<oacute>iti<ecircacute>ngVi<ecircdotbelow>t',
57
+ [0x0054, 0x1EA1, 0x0069, 0x0073, 0x0061, 0x006F, 0x0068, 0x1ECD, 0x006B,
58
+ 0x0068, 0x00F4, 0x006E, 0x0067, 0x0074, 0x0068, 0x1EC3, 0x0063, 0x0068,
59
+ 0x1EC9, 0x006E, 0x00F3, 0x0069, 0x0074, 0x0069, 0x1EBF, 0x006E, 0x0067,
60
+ 0x0056, 0x0069, 0x1EC7, 0x0074],
61
+ 'TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g'],
62
+ ['(L) 3<nen>B<gumi><kinpachi><sensei>',
63
+ [0x0033, 0x5E74, 0x0042, 0x7D44, 0x91D1, 0x516B, 0x5148, 0x751F],
64
+ '3B-ww4c5e180e575a65lsy2b'],
65
+ ['(M) <amuro><namie>-with-SUPER-MONKEYS',
66
+ [0x5B89, 0x5BA4, 0x5948, 0x7F8E, 0x6075, 0x002D, 0x0077, 0x0069, 0x0074,
67
+ 0x0068, 0x002D, 0x0053, 0x0055, 0x0050, 0x0045, 0x0052, 0x002D, 0x004D,
68
+ 0x004F, 0x004E, 0x004B, 0x0045, 0x0059, 0x0053],
69
+ '-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n'],
70
+ ['(N) Hello-Another-Way-<sorezore><no><basho>',
71
+ [0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x002D, 0x0041, 0x006E, 0x006F,
72
+ 0x0074, 0x0068, 0x0065, 0x0072, 0x002D, 0x0057, 0x0061, 0x0079, 0x002D,
73
+ 0x305D, 0x308C, 0x305E, 0x308C, 0x306E, 0x5834, 0x6240],
74
+ 'Hello-Another-Way--fc4qua05auwb3674vfr0b'],
75
+ ['(O) <hitotsu><yane><no><shita>2',
76
+ [0x3072, 0x3068, 0x3064, 0x5C4B, 0x6839, 0x306E, 0x4E0B, 0x0032],
77
+ '2-u9tlzr9756bt3uc0v'],
78
+ ['(P) Maji<de>Koi<suru>5<byou><mae>',
79
+ [0x004D, 0x0061, 0x006A, 0x0069, 0x3067, 0x004B, 0x006F, 0x0069, 0x3059,
80
+ 0x308B, 0x0035, 0x79D2, 0x524D],
81
+ 'MajiKoi5-783gue6qz075azm5e'],
82
+ ['(Q) <pafii>de<runba>',
83
+ [0x30D1, 0x30D5, 0x30A3, 0x30FC, 0x0064, 0x0065, 0x30EB, 0x30F3, 0x30D0],
84
+ 'de-jg4avhby1noc0d'],
85
+ ['(R) <sono><supiido><de>',
86
+ [0x305D, 0x306E, 0x30B9, 0x30D4, 0x30FC, 0x30C9, 0x3067],
87
+ 'd9juau41awczczp'],
88
+ ['(S) -> $1.00 <-',
89
+ [0x002D, 0x003E, 0x0020, 0x0024, 0x0031, 0x002E, 0x0030, 0x0030, 0x0020,
90
+ 0x003C, 0x002D],
91
+ '-> $1.00 <--']
92
+ ].each { |title, cps, punycode|
93
+ assert_equal punycode, DomainName::Punycode.encode(cps.pack('U*')), title
94
+ assert_equal cps.pack('U*').to_nfc, DomainName::Punycode.decode(punycode), title
95
+ }
96
+ end
97
+ end
@@ -0,0 +1,317 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+ require 'ipaddr'
4
+
5
+ class TestDomainName < Test::Unit::TestCase
6
+ test "raise ArgumentError if hostname starts with a dot" do
7
+ [
8
+ # Leading dot.
9
+ '.com',
10
+ '.example',
11
+ '.example.com',
12
+ '.example.example',
13
+ ].each { |hostname|
14
+ assert_raises(ArgumentError) { DomainName.new(hostname) }
15
+ }
16
+ end
17
+
18
+ test "accept a String-alike for initialization" do
19
+ Object.new.tap { |obj|
20
+ def obj.to_str
21
+ "Example.org"
22
+ end
23
+ assert_equal "example.org", DomainName.new(obj).hostname
24
+ }
25
+
26
+ Object.new.tap { |obj|
27
+ def obj.to_str
28
+ 123
29
+ end
30
+ assert_raises(TypeError) { DomainName.new(obj) }
31
+ }
32
+
33
+ Object.new.tap { |obj|
34
+ assert_raises(TypeError) { DomainName.new(obj) }
35
+ }
36
+ end
37
+
38
+ test "parse canonical domain names correctly" do
39
+ [
40
+ # Mixed case.
41
+ ['COM', nil, false, 'com', true],
42
+ ['example.COM', 'example.com', true, 'com', true],
43
+ ['WwW.example.COM', 'example.com', true, 'com', true],
44
+ # Unlisted TLD.
45
+ ['example', 'example', false, 'example', false],
46
+ ['example.example', 'example.example', false, 'example', false],
47
+ ['b.example.example', 'example.example', false, 'example', false],
48
+ ['a.b.example.example', 'example.example', false, 'example', false],
49
+ # Listed, but non-Internet, TLD.
50
+ ['local', 'local', false, 'local', false],
51
+ ['example.local', 'example.local', false, 'local', false],
52
+ ['b.example.local', 'example.local', false, 'local', false],
53
+ ['a.b.example.local', 'example.local', false, 'local', false],
54
+ # TLD with only 1 rule.
55
+ ['biz', nil, false, 'biz', true],
56
+ ['domain.biz', 'domain.biz', true, 'biz', true],
57
+ ['b.domain.biz', 'domain.biz', true, 'biz', true],
58
+ ['a.b.domain.biz', 'domain.biz', true, 'biz', true],
59
+ # TLD with some 2-level rules.
60
+ ['com', nil, false, 'com', true],
61
+ ['example.com', 'example.com', true, 'com', true],
62
+ ['b.example.com', 'example.com', true, 'com', true],
63
+ ['a.b.example.com', 'example.com', true, 'com', true],
64
+ ['uk.com', nil, false, 'com', true],
65
+ ['example.uk.com', 'example.uk.com', true, 'com', true],
66
+ ['b.example.uk.com', 'example.uk.com', true, 'com', true],
67
+ ['a.b.example.uk.com', 'example.uk.com', true, 'com', true],
68
+ ['test.ac', 'test.ac', true, 'ac', true],
69
+ # TLD with only 1 (wildcard) rule.
70
+ ['bd', nil, false, 'bd', true],
71
+ ['c.bd', nil, false, 'bd', true],
72
+ ['b.c.bd', 'b.c.bd', true, 'bd', true],
73
+ ['a.b.c.bd', 'b.c.bd', true, 'bd', true],
74
+ # More complex TLD.
75
+ ['jp', nil, false, 'jp', true],
76
+ ['test.jp', 'test.jp', true, 'jp', true],
77
+ ['www.test.jp', 'test.jp', true, 'jp', true],
78
+ ['ac.jp', nil, false, 'jp', true],
79
+ ['test.ac.jp', 'test.ac.jp', true, 'jp', true],
80
+ ['www.test.ac.jp', 'test.ac.jp', true, 'jp', true],
81
+ ['kyoto.jp', nil, false, 'jp', true],
82
+ ['test.kyoto.jp', 'test.kyoto.jp', true, 'jp', true],
83
+ ['ide.kyoto.jp', nil, false, 'jp', true],
84
+ ['b.ide.kyoto.jp', 'b.ide.kyoto.jp', true, 'jp', true],
85
+ ['a.b.ide.kyoto.jp', 'b.ide.kyoto.jp', true, 'jp', true],
86
+ ['c.kobe.jp', nil, false, 'jp', true],
87
+ ['b.c.kobe.jp', 'b.c.kobe.jp', true, 'jp', true],
88
+ ['a.b.c.kobe.jp', 'b.c.kobe.jp', true, 'jp', true],
89
+ ['city.kobe.jp', 'city.kobe.jp', true, 'jp', true],
90
+ ['www.city.kobe.jp', 'city.kobe.jp', true, 'jp', true],
91
+ # TLD with a wildcard rule and exceptions.
92
+ ['ck', nil, false, 'ck', true],
93
+ ['test.ck', nil, false, 'ck', true],
94
+ ['b.test.ck', 'b.test.ck', true, 'ck', true],
95
+ ['a.b.test.ck', 'b.test.ck', true, 'ck', true],
96
+ ['www.ck', 'www.ck', true, 'ck', true],
97
+ ['www.www.ck', 'www.ck', true, 'ck', true],
98
+ # US K12.
99
+ ['us', nil, false, 'us', true],
100
+ ['test.us', 'test.us', true, 'us', true],
101
+ ['www.test.us', 'test.us', true, 'us', true],
102
+ ['ak.us', nil, false, 'us', true],
103
+ ['test.ak.us', 'test.ak.us', true, 'us', true],
104
+ ['www.test.ak.us', 'test.ak.us', true, 'us', true],
105
+ ['k12.ak.us', nil, false, 'us', true],
106
+ ['test.k12.ak.us', 'test.k12.ak.us', true, 'us', true],
107
+ ['www.test.k12.ak.us', 'test.k12.ak.us', true, 'us', true],
108
+ # IDN labels. (modified; currently DomainName always converts U-labels to A-labels)
109
+ ['食狮.com.cn', 'xn--85x722f.com.cn', true, 'cn', true],
110
+ ['食狮.公司.cn', 'xn--85x722f.xn--55qx5d.cn', true, 'cn', true],
111
+ ['www.食狮.公司.cn', 'xn--85x722f.xn--55qx5d.cn', true, 'cn', true],
112
+ ['shishi.公司.cn', 'shishi.xn--55qx5d.cn', true, 'cn', true],
113
+ ['公司.cn', nil, false, 'cn', true],
114
+ ['食狮.中国', 'xn--85x722f.xn--fiqs8s', true, 'xn--fiqs8s', true],
115
+ ['www.食狮.中国', 'xn--85x722f.xn--fiqs8s', true, 'xn--fiqs8s', true],
116
+ ['shishi.中国', 'shishi.xn--fiqs8s', true, 'xn--fiqs8s', true],
117
+ ['中国', nil, false, 'xn--fiqs8s', true],
118
+ # Same as above, but punycoded.
119
+ ['xn--85x722f.com.cn', 'xn--85x722f.com.cn', true, 'cn', true],
120
+ ['xn--85x722f.xn--55qx5d.cn', 'xn--85x722f.xn--55qx5d.cn', true, 'cn', true],
121
+ ['www.xn--85x722f.xn--55qx5d.cn', 'xn--85x722f.xn--55qx5d.cn', true, 'cn', true],
122
+ ['shishi.xn--55qx5d.cn', 'shishi.xn--55qx5d.cn', true, 'cn', true],
123
+ ['xn--55qx5d.cn', nil, false, 'cn', true],
124
+ ['xn--85x722f.xn--fiqs8s', 'xn--85x722f.xn--fiqs8s', true, 'xn--fiqs8s', true],
125
+ ['www.xn--85x722f.xn--fiqs8s', 'xn--85x722f.xn--fiqs8s', true, 'xn--fiqs8s', true],
126
+ ['shishi.xn--fiqs8s', 'shishi.xn--fiqs8s', true, 'xn--fiqs8s', true],
127
+ ['xn--fiqs8s', nil, false, 'xn--fiqs8s', true],
128
+ ].each { |hostname, domain, canonical, tld, canonical_tld|
129
+ dn = DomainName.new(hostname)
130
+ assert_equal(domain, dn.domain, hostname + ':domain')
131
+ assert_equal(canonical, dn.canonical?, hostname + ':canoninal?')
132
+ assert_equal(tld, dn.tld, hostname + ':tld')
133
+ assert_equal(canonical_tld, dn.canonical_tld?, hostname + ':canoninal_tld?')
134
+ }
135
+ end
136
+
137
+ test "compare hostnames correctly" do
138
+ [
139
+ ["foo.com", "abc.foo.com", 1],
140
+ ["COM", "abc.foo.com", 1],
141
+ ["abc.def.foo.com", "foo.com", -1],
142
+ ["abc.def.foo.com", "ABC.def.FOO.com", 0],
143
+ ["abc.def.foo.com", "bar.com", nil],
144
+ ].each { |x, y, v|
145
+ dx, dy = DomainName(x), DomainName(y)
146
+ [
147
+ [dx, y, v],
148
+ [dx, dy, v],
149
+ [dy, x, v ? -v : v],
150
+ [dy, dx, v ? -v : v],
151
+ ].each { |a, b, expected|
152
+ assert_equal expected, a <=> b
153
+ case expected
154
+ when 1
155
+ assert_equal(true, a > b)
156
+ assert_equal(true, a >= b)
157
+ assert_equal(false, a == b)
158
+ assert_equal(false, a <= b)
159
+ assert_equal(false, a < b)
160
+ when -1
161
+ assert_equal(true, a < b)
162
+ assert_equal(true, a <= b)
163
+ assert_equal(false, a == b)
164
+ assert_equal(false, a >= b)
165
+ assert_equal(false, a > b)
166
+ when 0
167
+ assert_equal(false, a < b)
168
+ assert_equal(true, a <= b)
169
+ assert_equal(true, a == b)
170
+ assert_equal(true, a >= b)
171
+ assert_equal(false, a > b)
172
+ when nil
173
+ assert_equal(nil, a < b)
174
+ assert_equal(nil, a <= b)
175
+ assert_equal(false, a == b)
176
+ assert_equal(nil, a >= b)
177
+ assert_equal(nil, a > b)
178
+ end
179
+ }
180
+ }
181
+ end
182
+
183
+ test "check cookie domain correctly" do
184
+ {
185
+ 'com' => [
186
+ ['com', false],
187
+ ['example.com', false],
188
+ ['foo.example.com', false],
189
+ ['bar.foo.example.com', false],
190
+ ],
191
+
192
+ 'example.com' => [
193
+ ['com', false],
194
+ ['example.com', true],
195
+ ['foo.example.com', false],
196
+ ['bar.foo.example.com', false],
197
+ ],
198
+
199
+ 'foo.example.com' => [
200
+ ['com', false],
201
+ ['example.com', true],
202
+ ['foo.example.com', true],
203
+ ['foo.Example.com', true],
204
+ ['bar.foo.example.com', false],
205
+ ['bar.Foo.Example.com', false],
206
+ ],
207
+
208
+ 'b.sapporo.jp' => [
209
+ ['jp', false],
210
+ ['sapporo.jp', false],
211
+ ['b.sapporo.jp', false],
212
+ ['a.b.sapporo.jp', false],
213
+ ],
214
+
215
+ 'b.c.sapporo.jp' => [
216
+ ['jp', false],
217
+ ['sapporo.jp', false],
218
+ ['c.sapporo.jp', false],
219
+ ['b.c.sapporo.jp', true],
220
+ ['a.b.c.sapporo.jp', false],
221
+ ],
222
+
223
+ 'b.c.d.sapporo.jp' => [
224
+ ['jp', false],
225
+ ['sapporo.jp', false],
226
+ ['d.sapporo.jp', false],
227
+ ['c.d.sapporo.jp', true],
228
+ ['b.c.d.sapporo.jp', true],
229
+ ['a.b.c.d.sapporo.jp', false],
230
+ ],
231
+
232
+ 'city.sapporo.jp' => [
233
+ ['jp', false],
234
+ ['sapporo.jp', false],
235
+ ['city.sapporo.jp', true],
236
+ ['a.city.sapporo.jp', false],
237
+ ],
238
+
239
+ 'b.city.sapporo.jp' => [
240
+ ['jp', false],
241
+ ['sapporo.jp', false],
242
+ ['city.sapporo.jp', true],
243
+ ['b.city.sapporo.jp', true],
244
+ ['a.b.city.sapporo.jp', false],
245
+ ],
246
+ }.each_pair { |host, pairs|
247
+ dn = DomainName(host)
248
+ assert_equal(true, dn.cookie_domain?(host.upcase, true), dn.to_s)
249
+ assert_equal(true, dn.cookie_domain?(host.downcase, true), dn.to_s)
250
+ assert_equal(false, dn.cookie_domain?("www." << host, true), dn.to_s)
251
+ pairs.each { |domain, expected|
252
+ assert_equal(expected, dn.cookie_domain?(domain), "%s - %s" % [dn.to_s, domain])
253
+ assert_equal(expected, dn.cookie_domain?(DomainName(domain)), "%s - %s" % [dn.to_s, domain])
254
+ }
255
+ }
256
+ end
257
+
258
+ test "parse IPv4 addresseses" do
259
+ a = '192.168.10.20'
260
+ dn = DomainName(a)
261
+ assert_equal(a, dn.hostname)
262
+ assert_equal(true, dn.ipaddr?)
263
+ assert_equal(IPAddr.new(a), dn.ipaddr)
264
+ assert_equal(true, dn.cookie_domain?(a))
265
+ assert_equal(true, dn.cookie_domain?(a, true))
266
+ assert_equal(true, dn.cookie_domain?(dn))
267
+ assert_equal(true, dn.cookie_domain?(dn, true))
268
+ assert_equal(false, dn.cookie_domain?('168.10.20'))
269
+ assert_equal(false, dn.cookie_domain?('20'))
270
+ assert_equal(nil, dn.superdomain)
271
+ end
272
+
273
+ test "parse IPv6 addresseses" do
274
+ a = '2001:200:dff:fff1:216:3eff:feb1:44d7'
275
+ b = '2001:0200:0dff:fff1:0216:3eff:feb1:44d7'
276
+ [b, b.upcase, "[#{b}]", "[#{b.upcase}]"].each { |host|
277
+ dn = DomainName(host)
278
+ assert_equal("[#{a}]", dn.uri_host)
279
+ assert_equal(a, dn.hostname)
280
+ assert_equal(true, dn.ipaddr?)
281
+ assert_equal(IPAddr.new(a), dn.ipaddr)
282
+ assert_equal(true, dn.cookie_domain?(host))
283
+ assert_equal(true, dn.cookie_domain?(host, true))
284
+ assert_equal(true, dn.cookie_domain?(dn))
285
+ assert_equal(true, dn.cookie_domain?(dn, true))
286
+ assert_equal(true, dn.cookie_domain?(a))
287
+ assert_equal(true, dn.cookie_domain?(a, true))
288
+ assert_equal(nil, dn.superdomain)
289
+ }
290
+ end
291
+
292
+ test "get superdomain" do
293
+ [
294
+ %w[www.sub.example.local sub.example.local example.local local],
295
+ %w[www.sub.example.com sub.example.com example.com com],
296
+ ].each { |domain, *superdomains|
297
+ dn = DomainName(domain)
298
+ superdomains.each { |superdomain|
299
+ sdn = DomainName(superdomain)
300
+ assert_equal sdn, dn.superdomain
301
+ dn = sdn
302
+ }
303
+ assert_equal nil, dn.superdomain
304
+ }
305
+ end
306
+
307
+ test "have idn methods" do
308
+ dn = DomainName("金八先生.B組.3年.日本語ドメイン名Example.日本")
309
+
310
+ assert_equal "xn--44q1cv48kq8x.xn--b-gf6c.xn--3-pj3b.xn--example-6q4fyliikhk162btq3b2zd4y2o.xn--wgv71a", dn.hostname
311
+ assert_equal "金八先生.b組.3年.日本語ドメイン名example.日本", dn.hostname_idn
312
+ assert_equal "xn--example-6q4fyliikhk162btq3b2zd4y2o.xn--wgv71a", dn.domain
313
+ assert_equal "日本語ドメイン名example.日本", dn.domain_idn
314
+ assert_equal "xn--wgv71a", dn.tld
315
+ assert_equal "日本", dn.tld_idn
316
+ end
317
+ end
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'pathname'
5
+ $basedir = Pathname.new(__FILE__).dirname.parent
6
+ $LOAD_PATH.unshift $basedir + 'lib'
7
+ require 'domain_name'
8
+ require 'set'
9
+ require 'erb'
10
+
11
+ def main
12
+ dat_file = $basedir + 'data' + 'public_suffix_list.dat'
13
+ dir = $basedir + 'lib' + 'domain_name'
14
+ erb_file = dir + 'etld_data.rb.erb'
15
+ rb_file = dir + 'etld_data.rb'
16
+
17
+ etld_data_date = File.mtime(dat_file)
18
+
19
+ File.open(dat_file, 'r:utf-8') { |dat|
20
+ etld_data = parse(dat)
21
+ File.open(rb_file, 'w:utf-8') { |rb|
22
+ File.open(erb_file, 'r:utf-8') { |erb|
23
+ rb.print ERB.new(erb.read).result(binding)
24
+ }
25
+ }
26
+ }
27
+ end
28
+
29
+ def normalize_hostname(domain)
30
+ DomainName.normalize(domain)
31
+ end
32
+
33
+ def parse(f)
34
+ {}.tap { |table|
35
+ tlds = Set[]
36
+ f.each_line { |line|
37
+ line.sub!(%r{//.*}, '')
38
+ line.strip!
39
+ next if line.empty?
40
+ case line
41
+ when /^local$/
42
+ # ignore .local
43
+ next
44
+ when /^([^!*]+)$/
45
+ domain = normalize_hostname($1)
46
+ value = 0
47
+ when /^\*\.([^!*]+)$/
48
+ domain = normalize_hostname($1)
49
+ value = -1
50
+ when /^\!([^!*]+)$/
51
+ domain = normalize_hostname($1)
52
+ value = 1
53
+ else
54
+ raise "syntax error: #{line}"
55
+ end
56
+ tld = domain.match(/(?:^|\.)([^.]+)$/)[1]
57
+ table[tld] ||= 1
58
+ table[domain] = value
59
+ }
60
+ }
61
+ end
62
+
63
+ main()
@@ -0,0 +1,13 @@
1
+ = 1.0.3 - 21-Aug-2016
2
+ * The FFI::MemoryPointer#read_wide_string now defaults to its own size
3
+ for the +num_bytes+ argument.
4
+
5
+ = 1.0.2 - 20-Jun-2016
6
+ * Added the String#read_wide_string method.
7
+ * Refactored the windows_error_message method a bit.
8
+
9
+ = 1.0.1 - 8-May-2016
10
+ * The String#wstrip method defaults to nil on failure.
11
+
12
+ = 1.0.0 - 7-May-2016
13
+ * Initial release