Permalink
Browse files

whois.hkirc.hk parser crashes when expiration date is "null".

  • Loading branch information...
1 parent 836b6c7 commit b2342a370ea454e2c0ea7b231117eb6ab40eff9b @weppos committed May 7, 2012
View
4 CHANGELOG.md
@@ -3,10 +3,12 @@
## master
-* NEW: whois.srs.net.nz now recognizes throttled responses.
+* NEW: whois.srs.net.nz parser now recognizes throttled responses.
* CHANGED: whois.nic.uk changed response format.
+* FIXED: whois.hkirc.hk parser crashes when expiration date is "null".
+
## Release 2.5.1
View
3 lib/whois/record/parser/whois.hkirc.hk.rb
@@ -52,7 +52,8 @@ class WhoisHkircHk < Base
property_supported :expires_on do
if content_for_scanner =~ /Expiry Date:\s(.+?)\n/
- Time.parse($1)
+ time = $1.strip
+ Time.parse(time) unless time == 'null'
end
end
View
2 spec/fixtures/responses/whois.hkirc.hk/property_expires_on_null.expected
@@ -0,0 +1,2 @@
+#expires_on
+ should: %s == nil
View
104 spec/fixtures/responses/whois.hkirc.hk/property_expires_on_null.txt
@@ -0,0 +1,104 @@
+
+ -------------------------------------------------------------------------------
+ Whois server by HKDNR
+ -------------------------------------------------------------------------------
+ Domain names in the .com.hk, .net.hk, .edu.hk, .org.hk,
+ .gov.hk, idv.hk. and .hk can now be registered with HKDNR.
+ Go to http://www.hkdnr.net.hk for detail information.
+ -------------------------------------------------------------------------------
+
+
+
+Domain Name: BRIGHTER.COM.HK
+
+Contract Version: Old Contract
+
+Registrar Name: Hong Kong Domain Name Registration Company Limited
+
+Registrar Contact Information: Email: enquiry@hkdnr.hk Hotline: +852 2319 1313
+
+
+
+
+Registrant Contact Information:
+
+Company English Name (It should be the same as the registered/corporation name on your Business Register Certificate or relevant documents): THE BRIGHTER CO
+Company Chinese name: -
+Address: FLAT F-H,14/F,WINNER INDUSTRIAL BLDG.,
+55 HUNG TO ROAD,
+KWUN TONG, KOWLOON
+Country: HK
+Email: qhau@neotech-hk.com
+Domain Name Commencement Date: 23-12-1998
+Expiry Date: null
+Re-registration Status: Complete
+
+
+
+Administrative Contact Information:
+
+Given name: QUEENIE
+Family name: HAU
+Company name: THE BRIGHTER COMPANY
+Address: FLAT F-H,14/F,WINNER INDUSTRIAL BLDG.,55 HUNG TO ROAD,KWUN TONG, KOWLOON
+Country: HK
+Phone: +852-23426328
+Fax: +852-23428180
+Email: qhau@neotech-hk.com
+Account Name: HK2763316T
+
+
+
+
+Technical Contact Information:
+
+Family name: HAU
+Company name: THE BRIGHTER COMPANY
+Address: FLAT F-H,14/F,WINNER INDUSTRIAL BLDG.,
+55 HUNG TO ROAD,
+KWUN TONG, KOWLOON
+Country: HK
+Phone: +852-23426328
+Fax: +852-23428180
+Email: qhau@neotech-hk.com
+
+
+
+
+Name Servers Information:
+
+NS5.HOSTINGSPEED.NET
+NS2.HOSTINGSPEED.NET
+
+
+
+ -------------------------------------------------------------------------------
+ The Registry contains ONLY .com.hk, .net.hk, .edu.hk, .org.hk,
+ .gov.hk, idv.hk. and .hk $domains.
+ -------------------------------------------------------------------------------
+
+WHOIS Terms of Use
+By using this WHOIS search enquiry service you agree to these terms of use.
+The data in HKDNR's WHOIS search engine is for information purposes only and HKDNR does not guarantee the accuracy of the data. The data is provided to assist people to obtain information about the registration record of domain names registered by HKDNR. You agree to use the data for lawful purposes only.
+
+You are not authorised to use high-volume, electronic or automated processes to access, query or harvest data from this WHOIS search enquiry service.
+
+You agree that you will not and will not allow anyone else to:
+
+a. use the data for mass unsolicited commercial advertising of any sort via any medium including telephone, email or fax; or
+
+b. enable high volume, automated or electronic processes that apply to HKDNR or its computer systems including the WHOIS search enquiry service; or
+
+c. without the prior written consent of HKDNR compile, repackage, disseminate, disclose to any third party or use the data for a purpose other than obtaining information about a domain name registration record; or
+
+d. use such data to derive an economic benefit for yourself.
+
+HKDNR in its sole discretion may terminate your access to the WHOIS search enquiry service (including, without limitation, blocking your IP address) at any time including, without limitation, for excessive use of the WHOIS search enquiry service.
+
+HKDNR may modify these terms of use at any time by publishing the modified terms of use on its website.
+
+
+
+
+
+
View
29 spec/whois/record/parser/responses/whois.hkirc.hk/property_expires_on_null_spec.rb
@@ -0,0 +1,29 @@
+# encoding: utf-8
+
+# This file is autogenerated. Do not edit it manually.
+# If you want change the content of this file, edit
+#
+# /spec/fixtures/responses/whois.hkirc.hk/property_expires_on_null.expected
+#
+# and regenerate the tests with the following rake task
+#
+# $ rake spec:generate
+#
+
+require 'spec_helper'
+require 'whois/record/parser/whois.hkirc.hk.rb'
+
+describe Whois::Record::Parser::WhoisHkircHk, "property_expires_on_null.expected" do
+
+ before(:each) do
+ file = fixture("responses", "whois.hkirc.hk/property_expires_on_null.txt")
+ part = Whois::Record::Part.new(:body => File.read(file))
+ @parser = klass.new(part)
+ end
+
+ describe "#expires_on" do
+ it do
+ @parser.expires_on.should == nil
+ end
+ end
+end

0 comments on commit b2342a3

Please sign in to comment.