Sha256: a5ca30954d08422f4b446d9da52454f41dddd424566ae968f77c87d08a4faa55
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
module R509 module CertificateAuthority module Http class SubjectParser def parse(raw, name="subject") if raw.nil? raise ArgumentError, "Must provide a query string" end subject = R509::Subject.new raw.split(/[&;] */n).each { |pair| key, value = pair.split('=', 2).map { |data| unescape(data) } match = key.match(/#{name}\[(.*)\]/) if not match.nil? and not value.empty? subject[match[1]] = value end } subject end if defined?(::Encoding) def unescape(s, encoding = Encoding::UTF_8) URI.decode_www_form_component(s, encoding) end else def unescape(s, encoding = nil) URI.decode_www_form_component(s, encoding) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
r509-ca-http-0.1 | lib/r509/certificateauthority/http/subjectparser.rb |