ronin-support 0.5.2 → 1.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +5 -6
- data/.gitignore +7 -6
- data/.mailmap +1 -0
- data/.ruby-version +1 -1
- data/.yardopts +0 -1
- data/ChangeLog.md +518 -148
- data/Gemfile +17 -16
- data/README.md +107 -52
- data/Rakefile +28 -8
- data/data/text/homoglyphs/ascii.txt +8 -0
- data/data/text/homoglyphs/cyrillic.txt +33 -0
- data/data/text/homoglyphs/full_width.txt +81 -0
- data/data/text/homoglyphs/greek.txt +21 -0
- data/data/text/homoglyphs/latin_numbers.txt +14 -0
- data/data/text/homoglyphs/punctuation.txt +7 -0
- data/data/text/patterns/network/public_suffix.rb.erb +44 -0
- data/examples/ssl_proxy.rb +38 -0
- data/examples/tcp_proxy.rb +41 -0
- data/gemspec.yml +16 -15
- data/lib/ronin/support/archive/core_ext/file.rb +118 -0
- data/lib/ronin/{formatting/sql.rb → support/archive/core_ext.rb} +3 -4
- data/lib/ronin/support/archive/mixin.rb +213 -0
- data/lib/ronin/support/archive/tar/reader.rb +135 -0
- data/lib/ronin/support/archive/tar/writer.rb +197 -0
- data/lib/ronin/support/archive/tar.rb +155 -0
- data/lib/ronin/support/archive/zip/reader/entry.rb +134 -0
- data/lib/ronin/support/archive/zip/reader/statistics.rb +76 -0
- data/lib/ronin/support/archive/zip/reader.rb +273 -0
- data/lib/ronin/support/archive/zip/writer.rb +175 -0
- data/lib/ronin/support/archive/zip.rb +105 -0
- data/lib/ronin/support/archive.rb +211 -0
- data/lib/ronin/support/binary/array.rb +255 -0
- data/lib/ronin/support/binary/bit_flip.rb +147 -0
- data/lib/ronin/support/binary/buffer.rb +2027 -0
- data/lib/ronin/support/binary/byte_slice.rb +324 -0
- data/lib/ronin/{formatting/extensions/binary → support/binary/core_ext}/array.rb +25 -11
- data/lib/ronin/support/binary/core_ext/float.rb +80 -0
- data/lib/ronin/support/binary/core_ext/integer.rb +305 -0
- data/lib/ronin/support/binary/core_ext/io.rb +38 -0
- data/lib/ronin/support/binary/core_ext/string.rb +162 -0
- data/lib/ronin/{formatting/extensions/text.rb → support/binary/core_ext.rb} +6 -6
- data/lib/ronin/support/binary/cstring.rb +259 -0
- data/lib/ronin/support/binary/ctypes/aggregate_type.rb +98 -0
- data/lib/ronin/support/binary/ctypes/arch/arm/big_endian.rb +77 -0
- data/lib/ronin/support/binary/ctypes/arch/arm.rb +75 -0
- data/lib/ronin/support/binary/ctypes/arch/arm64/big_endian.rb +77 -0
- data/lib/ronin/support/binary/ctypes/arch/arm64.rb +75 -0
- data/lib/ronin/support/binary/ctypes/arch/mips/little_endian.rb +77 -0
- data/lib/ronin/support/binary/ctypes/arch/mips.rb +75 -0
- data/lib/ronin/support/binary/ctypes/arch/mips64/little_endian.rb +77 -0
- data/lib/ronin/support/binary/ctypes/arch/mips64.rb +75 -0
- data/lib/ronin/support/binary/ctypes/arch/ppc.rb +75 -0
- data/lib/ronin/support/binary/ctypes/arch/ppc64.rb +75 -0
- data/lib/ronin/support/binary/ctypes/arch/x86.rb +75 -0
- data/lib/ronin/support/binary/ctypes/arch/x86_64.rb +75 -0
- data/lib/ronin/support/binary/ctypes/arch.rb +30 -0
- data/lib/ronin/support/binary/ctypes/array_object_type.rb +164 -0
- data/lib/ronin/support/binary/ctypes/array_type.rb +232 -0
- data/lib/ronin/support/binary/ctypes/big_endian.rb +195 -0
- data/lib/ronin/support/binary/ctypes/char_type.rb +59 -0
- data/lib/ronin/support/binary/ctypes/char_types.rb +39 -0
- data/lib/ronin/support/binary/ctypes/enum_type.rb +181 -0
- data/lib/ronin/support/binary/ctypes/float32_type.rb +50 -0
- data/lib/ronin/support/binary/ctypes/float64_type.rb +50 -0
- data/lib/ronin/support/binary/ctypes/float_type.rb +62 -0
- data/lib/ronin/support/binary/ctypes/int16_type.rb +50 -0
- data/lib/ronin/support/binary/ctypes/int32_type.rb +50 -0
- data/lib/ronin/support/binary/ctypes/int64_type.rb +50 -0
- data/lib/ronin/support/{support.rb → binary/ctypes/int8_type.rb} +20 -21
- data/lib/ronin/support/binary/ctypes/int_type.rb +62 -0
- data/lib/ronin/support/binary/ctypes/little_endian.rb +195 -0
- data/lib/ronin/support/binary/ctypes/mixin.rb +135 -0
- data/lib/ronin/support/binary/ctypes/native.rb +205 -0
- data/lib/ronin/support/binary/ctypes/network.rb +29 -0
- data/lib/ronin/support/binary/ctypes/object_type.rb +55 -0
- data/lib/ronin/support/binary/ctypes/os/bsd.rb +65 -0
- data/lib/ronin/support/binary/ctypes/os/freebsd.rb +215 -0
- data/lib/ronin/support/binary/ctypes/os/linux.rb +193 -0
- data/lib/ronin/support/binary/ctypes/os/macos.rb +151 -0
- data/lib/ronin/support/binary/ctypes/os/netbsd.rb +147 -0
- data/lib/ronin/support/binary/ctypes/os/openbsd.rb +168 -0
- data/lib/ronin/support/binary/ctypes/os/unix.rb +78 -0
- data/lib/ronin/support/binary/ctypes/os/windows.rb +125 -0
- data/lib/ronin/support/binary/ctypes/os.rb +125 -0
- data/lib/ronin/support/binary/ctypes/scalar_type.rb +200 -0
- data/lib/ronin/support/binary/ctypes/string_type.rb +143 -0
- data/lib/ronin/support/binary/ctypes/struct_object_type.rb +173 -0
- data/lib/ronin/support/binary/ctypes/struct_type.rb +359 -0
- data/lib/ronin/support/binary/ctypes/type.rb +193 -0
- data/lib/ronin/support/binary/ctypes/type_resolver.rb +206 -0
- data/lib/ronin/support/binary/ctypes/uint16_type.rb +50 -0
- data/lib/ronin/support/binary/ctypes/uint32_type.rb +50 -0
- data/lib/ronin/support/binary/ctypes/uint64_type.rb +50 -0
- data/lib/ronin/support/binary/ctypes/uint8_type.rb +41 -0
- data/lib/ronin/support/binary/ctypes/uint_type.rb +59 -0
- data/lib/ronin/support/binary/ctypes/unbounded_array_type.rb +258 -0
- data/lib/ronin/support/binary/ctypes/union_object_type.rb +173 -0
- data/lib/ronin/support/binary/ctypes/union_type.rb +261 -0
- data/lib/ronin/support/binary/ctypes.rb +462 -0
- data/lib/ronin/support/binary/hexdump/core_ext/file.rb +118 -0
- data/lib/ronin/support/binary/hexdump/core_ext/string.rb +115 -0
- data/lib/ronin/support/binary/hexdump/core_ext.rb +20 -0
- data/lib/ronin/support/binary/hexdump/parser.rb +492 -0
- data/lib/ronin/support/binary/hexdump.rb +20 -0
- data/lib/ronin/support/binary/memory.rb +268 -0
- data/lib/ronin/support/binary/packet.rb +33 -0
- data/lib/ronin/support/binary/stack.rb +256 -0
- data/lib/ronin/support/binary/stream/methods.rb +1755 -0
- data/lib/ronin/support/binary/stream.rb +151 -0
- data/lib/ronin/support/binary/struct/member.rb +86 -0
- data/lib/ronin/support/binary/struct.rb +830 -0
- data/lib/ronin/support/binary/template.rb +284 -0
- data/lib/ronin/support/binary/union.rb +162 -0
- data/lib/ronin/{formatting/extensions → support}/binary.rb +10 -10
- data/lib/ronin/support/cli/ansi.rb +330 -0
- data/lib/ronin/support/cli/io_shell/core_ext/io.rb +67 -0
- data/lib/ronin/{extensions/meta.rb → support/cli/io_shell/core_ext.rb} +3 -4
- data/lib/ronin/support/cli/io_shell.rb +161 -0
- data/lib/ronin/support/cli/printing.rb +216 -0
- data/lib/ronin/support/cli.rb +20 -0
- data/lib/ronin/support/compression/core_ext/file.rb +70 -0
- data/lib/ronin/support/compression/core_ext/string.rb +101 -0
- data/lib/ronin/{fuzzing/extensions.rb → support/compression/core_ext.rb} +3 -4
- data/lib/ronin/support/compression/gzip/reader.rb +70 -0
- data/lib/ronin/support/compression/gzip/writer.rb +74 -0
- data/lib/ronin/support/compression/gzip.rb +105 -0
- data/lib/ronin/support/compression/mixin.rb +180 -0
- data/lib/ronin/{network/extensions/esmtp/net.rb → support/compression/zlib.rb} +6 -7
- data/lib/ronin/support/compression.rb +174 -0
- data/lib/ronin/{extensions → support/core_ext}/enumerable.rb +2 -3
- data/lib/ronin/{extensions → support/core_ext}/file.rb +2 -31
- data/lib/ronin/support/core_ext/integer.rb +37 -0
- data/lib/ronin/support/core_ext/ipaddr.rb +65 -0
- data/lib/ronin/{extensions → support/core_ext}/kernel.rb +7 -6
- data/lib/ronin/{extensions → support/core_ext}/resolv.rb +2 -25
- data/lib/ronin/{extensions → support/core_ext}/string.rb +114 -54
- data/lib/ronin/support/core_ext.rb +34 -0
- data/lib/ronin/support/crypto/cert.rb +522 -0
- data/lib/ronin/support/crypto/cert_chain.rb +204 -0
- data/lib/ronin/support/crypto/cipher/aes.rb +71 -0
- data/lib/ronin/support/crypto/cipher/aes128.rb +54 -0
- data/lib/ronin/support/crypto/cipher/aes256.rb +54 -0
- data/lib/ronin/support/crypto/cipher.rb +194 -0
- data/lib/ronin/support/crypto/core_ext/file.rb +660 -0
- data/lib/ronin/support/crypto/core_ext/string.rb +548 -0
- data/lib/ronin/{binary.rb → support/crypto/core_ext.rb} +4 -5
- data/lib/ronin/{network/mixins/mixin.rb → support/crypto/hmac.rb} +18 -28
- data/lib/ronin/support/crypto/key/dh.rb +122 -0
- data/lib/ronin/support/crypto/key/dsa.rb +103 -0
- data/lib/ronin/support/crypto/key/ec.rb +99 -0
- data/lib/ronin/support/crypto/key/methods.rb +163 -0
- data/lib/ronin/support/crypto/key/rsa.rb +169 -0
- data/lib/ronin/support/crypto/key.rb +105 -0
- data/lib/ronin/support/crypto/mixin.rb +620 -0
- data/lib/ronin/{network/extensions/http/net.rb → support/crypto/openssl.rb} +6 -7
- data/lib/ronin/support/crypto.rb +779 -0
- data/lib/ronin/support/encoding/base16/core_ext/string.rb +63 -0
- data/lib/ronin/{formatting/binary.rb → support/encoding/base16/core_ext.rb} +3 -4
- data/lib/ronin/support/encoding/base16.rb +82 -0
- data/lib/ronin/support/encoding/base32/core_ext/string.rb +63 -0
- data/lib/ronin/support/encoding/base32/core_ext.rb +19 -0
- data/lib/ronin/support/encoding/base32.rb +164 -0
- data/lib/ronin/support/encoding/base64/core_ext/string.rb +76 -0
- data/lib/ronin/support/encoding/base64/core_ext.rb +19 -0
- data/lib/ronin/support/encoding/base64.rb +78 -0
- data/lib/ronin/support/encoding/c/core_ext/integer.rb +82 -0
- data/lib/ronin/support/encoding/c/core_ext/string.rb +125 -0
- data/lib/ronin/support/encoding/c/core_ext.rb +20 -0
- data/lib/ronin/support/encoding/c.rb +277 -0
- data/lib/ronin/support/encoding/core_ext/string.rb +107 -0
- data/lib/ronin/support/encoding/core_ext.rb +33 -0
- data/lib/ronin/support/encoding/hex/core_ext/integer.rb +82 -0
- data/lib/ronin/support/encoding/hex/core_ext/string.rb +133 -0
- data/lib/ronin/support/encoding/hex/core_ext.rb +22 -0
- data/lib/ronin/support/encoding/hex.rb +248 -0
- data/lib/ronin/support/encoding/html/core_ext/integer.rb +106 -0
- data/lib/ronin/support/encoding/html/core_ext/string.rb +130 -0
- data/lib/ronin/support/encoding/html/core_ext.rb +20 -0
- data/lib/ronin/support/encoding/html.rb +233 -0
- data/lib/ronin/support/encoding/http/core_ext/integer.rb +95 -0
- data/lib/ronin/support/encoding/http/core_ext/string.rb +129 -0
- data/lib/ronin/support/encoding/http/core_ext.rb +20 -0
- data/lib/ronin/support/encoding/http.rb +241 -0
- data/lib/ronin/support/encoding/js/core_ext/integer.rb +67 -0
- data/lib/ronin/support/encoding/js/core_ext/string.rb +125 -0
- data/lib/ronin/support/encoding/js/core_ext.rb +20 -0
- data/lib/ronin/support/encoding/js.rb +279 -0
- data/lib/ronin/support/encoding/powershell/core_ext/integer.rb +87 -0
- data/lib/ronin/support/encoding/powershell/core_ext/string.rb +145 -0
- data/lib/ronin/support/encoding/powershell/core_ext.rb +20 -0
- data/lib/ronin/support/encoding/powershell.rb +297 -0
- data/lib/ronin/{formatting/extensions/http/integer.rb → support/encoding/punycode/core_ext/string.rb} +23 -29
- data/lib/ronin/support/encoding/punycode/core_ext.rb +19 -0
- data/lib/ronin/support/encoding/punycode.rb +76 -0
- data/lib/ronin/support/encoding/quoted_printable/core_ext/string.rb +75 -0
- data/lib/ronin/support/encoding/quoted_printable/core_ext.rb +19 -0
- data/lib/ronin/support/encoding/quoted_printable.rb +102 -0
- data/lib/ronin/support/encoding/ruby/core_ext/string.rb +129 -0
- data/lib/ronin/support/encoding/ruby/core_ext.rb +19 -0
- data/lib/ronin/support/encoding/ruby.rb +235 -0
- data/lib/ronin/support/encoding/shell/core_ext/integer.rb +89 -0
- data/lib/ronin/support/encoding/shell/core_ext/string.rb +134 -0
- data/lib/ronin/support/encoding/shell/core_ext.rb +20 -0
- data/lib/ronin/support/encoding/shell.rb +293 -0
- data/lib/ronin/{network/extensions → support/encoding}/smtp.rb +4 -4
- data/lib/ronin/support/encoding/sql/core_ext/string.rb +114 -0
- data/lib/ronin/{formatting/html.rb → support/encoding/sql/core_ext.rb} +3 -4
- data/lib/ronin/support/encoding/sql.rb +124 -0
- data/lib/ronin/support/encoding/uri/core_ext/integer.rb +149 -0
- data/lib/ronin/support/encoding/uri/core_ext/string.rb +195 -0
- data/lib/ronin/support/encoding/uri/core_ext.rb +20 -0
- data/lib/ronin/support/encoding/uri.rb +424 -0
- data/lib/ronin/support/encoding/uuencoding/core_ext/string.rb +73 -0
- data/lib/ronin/support/encoding/uuencoding/core_ext.rb +19 -0
- data/lib/ronin/support/encoding/uuencoding.rb +70 -0
- data/lib/ronin/support/encoding/xml/core_ext/integer.rb +100 -0
- data/lib/ronin/support/encoding/xml/core_ext/string.rb +124 -0
- data/lib/ronin/support/encoding/xml/core_ext.rb +20 -0
- data/lib/ronin/support/encoding/xml.rb +328 -0
- data/lib/ronin/support/encoding.rb +46 -0
- data/lib/ronin/support/home.rb +88 -0
- data/lib/ronin/{network/network.rb → support/mixin.rb} +17 -20
- data/lib/ronin/support/network/asn/dns_record.rb +112 -0
- data/lib/ronin/support/network/asn/list.rb +269 -0
- data/lib/ronin/support/network/asn/record.rb +164 -0
- data/lib/ronin/support/network/asn/record_set.rb +226 -0
- data/lib/ronin/support/network/asn.rb +88 -0
- data/lib/ronin/{binary/hexdump.rb → support/network/core_ext.rb} +3 -4
- data/lib/ronin/support/network/dns/idn.rb +38 -0
- data/lib/ronin/support/network/dns/mixin.rb +941 -0
- data/lib/ronin/support/network/dns/resolver.rb +707 -0
- data/lib/ronin/support/network/dns.rb +1109 -0
- data/lib/ronin/support/network/domain.rb +70 -0
- data/lib/ronin/support/network/email_address.rb +574 -0
- data/lib/ronin/support/network/esmtp/mixin.rb +115 -0
- data/lib/ronin/support/network/exceptions.rb +43 -0
- data/lib/ronin/support/network/ftp/mixin.rb +106 -0
- data/lib/ronin/support/network/host.rb +1473 -0
- data/lib/ronin/support/network/http/cookie.rb +245 -0
- data/lib/ronin/support/network/http/core_ext/uri/http.rb +63 -0
- data/lib/ronin/support/network/http/core_ext.rb +19 -0
- data/lib/ronin/support/network/http/mixin.rb +890 -0
- data/lib/ronin/support/network/http/request.rb +215 -0
- data/lib/ronin/support/network/http/set_cookie.rb +210 -0
- data/lib/ronin/support/network/http/user_agents.rb +115 -0
- data/lib/ronin/support/network/http.rb +2582 -0
- data/lib/ronin/support/network/imap/mixin.rb +133 -0
- data/lib/ronin/support/network/ip/mixin.rb +114 -0
- data/lib/ronin/support/network/ip.rb +540 -0
- data/lib/ronin/support/network/ip_range/cidr.rb +252 -0
- data/lib/ronin/support/network/ip_range/glob.rb +309 -0
- data/lib/ronin/support/network/ip_range/range.rb +249 -0
- data/lib/ronin/support/network/ip_range.rb +284 -0
- data/lib/ronin/support/network/mixin.rb +58 -0
- data/lib/ronin/support/network/packet.rb +27 -0
- data/lib/ronin/support/network/pop3/mixin.rb +113 -0
- data/lib/ronin/support/network/proxy.rb +602 -0
- data/lib/ronin/support/network/public_suffix/list.rb +339 -0
- data/lib/ronin/support/network/public_suffix/suffix.rb +118 -0
- data/lib/ronin/support/network/public_suffix/suffix_set.rb +150 -0
- data/lib/ronin/support/network/public_suffix.rb +41 -0
- data/lib/ronin/support/network/smtp/email.rb +190 -0
- data/lib/ronin/support/network/smtp/mixin.rb +290 -0
- data/lib/ronin/support/network/smtp.rb +19 -0
- data/lib/ronin/support/network/ssl/local_cert.rb +114 -0
- data/lib/ronin/support/network/ssl/local_key.rb +84 -0
- data/lib/ronin/support/network/ssl/mixin.rb +740 -0
- data/lib/ronin/{network/extensions/imap/net.rb → support/network/ssl/openssl.rb} +6 -7
- data/lib/ronin/support/network/ssl/proxy.rb +296 -0
- data/lib/ronin/support/network/ssl.rb +173 -0
- data/lib/ronin/support/network/tcp/mixin.rb +400 -0
- data/lib/ronin/support/network/tcp/proxy.rb +435 -0
- data/lib/ronin/support/network/tcp.rb +443 -0
- data/lib/ronin/support/network/telnet/mixin.rb +150 -0
- data/lib/ronin/support/network/telnet.rb +90 -0
- data/lib/ronin/support/network/tld/list.rb +266 -0
- data/lib/ronin/support/network/tld.rb +41 -0
- data/lib/ronin/support/network/tls/mixin.rb +670 -0
- data/lib/ronin/support/network/tls/proxy.rb +135 -0
- data/lib/ronin/{network/mixins/dns.rb → support/network/tls.rb} +23 -25
- data/lib/ronin/support/network/udp/mixin.rb +389 -0
- data/lib/ronin/support/network/udp/proxy.rb +192 -0
- data/lib/ronin/support/network/udp.rb +435 -0
- data/lib/ronin/support/network/unix/mixin.rb +273 -0
- data/lib/ronin/support/network.rb +37 -0
- data/lib/ronin/support/path.rb +136 -0
- data/lib/ronin/{network/extensions/dns/net.rb → support/text/core_ext/regexp.rb} +5 -6
- data/lib/ronin/support/text/core_ext/string.rb +46 -0
- data/lib/ronin/{formatting.rb → support/text/core_ext.rb} +7 -9
- data/lib/ronin/support/text/entropy/core_ext/string.rb +45 -0
- data/lib/ronin/{formatting/http.rb → support/text/entropy/core_ext.rb} +3 -4
- data/lib/ronin/support/text/entropy.rb +66 -0
- data/lib/ronin/support/text/erb/mixin.rb +44 -0
- data/lib/ronin/support/text/erb.rb +19 -0
- data/lib/ronin/support/text/homoglyph/core_ext/string.rb +108 -0
- data/lib/ronin/{formatting/digest.rb → support/text/homoglyph/core_ext.rb} +3 -4
- data/lib/ronin/{network/http/exceptions/unknown_request.rb → support/text/homoglyph/exceptions.rb} +7 -6
- data/lib/ronin/support/text/homoglyph/table.rb +228 -0
- data/lib/ronin/support/text/homoglyph.rb +142 -0
- data/lib/ronin/support/text/mixin.rb +31 -0
- data/lib/ronin/support/text/patterns/credentials.rb +75 -0
- data/lib/ronin/support/text/patterns/crypto.rb +67 -0
- data/lib/ronin/support/text/patterns/file_system.rb +93 -0
- data/lib/ronin/support/text/patterns/language.rb +37 -0
- data/lib/ronin/support/text/patterns/network/public_suffix.rb +44 -0
- data/lib/ronin/support/text/patterns/network.rb +140 -0
- data/lib/ronin/support/text/patterns/numeric.rb +52 -0
- data/lib/ronin/support/text/patterns/pii.rb +105 -0
- data/lib/ronin/support/text/patterns/source_code.rb +148 -0
- data/lib/ronin/{extensions.rb → support/text/patterns.rb} +10 -13
- data/lib/ronin/support/text/random/mixin.rb +437 -0
- data/lib/ronin/support/text/random.rb +419 -0
- data/lib/ronin/support/text/typo/core_ext/string.rb +123 -0
- data/lib/ronin/support/text/typo/core_ext.rb +19 -0
- data/lib/ronin/support/text/typo/exceptions.rb +28 -0
- data/lib/ronin/support/text/typo/generator.rb +161 -0
- data/lib/ronin/support/text/typo.rb +260 -0
- data/lib/ronin/{formatting → support}/text.rb +10 -4
- data/lib/ronin/support/version.rb +3 -4
- data/lib/ronin/support.rb +17 -12
- data/ronin-support.gemspec +2 -1
- metadata +342 -291
- data/lib/ronin/binary/hexdump/parser.rb +0 -403
- data/lib/ronin/binary/struct.rb +0 -567
- data/lib/ronin/binary/template.rb +0 -454
- data/lib/ronin/extensions/ip_addr.rb +0 -216
- data/lib/ronin/extensions/meta/object.rb +0 -24
- data/lib/ronin/extensions/regexp.rb +0 -157
- data/lib/ronin/formatting/extensions/binary/base64.rb +0 -106
- data/lib/ronin/formatting/extensions/binary/file.rb +0 -77
- data/lib/ronin/formatting/extensions/binary/float.rb +0 -65
- data/lib/ronin/formatting/extensions/binary/integer.rb +0 -180
- data/lib/ronin/formatting/extensions/binary/string.rb +0 -345
- data/lib/ronin/formatting/extensions/digest/file.rb +0 -129
- data/lib/ronin/formatting/extensions/digest/string.rb +0 -86
- data/lib/ronin/formatting/extensions/digest.rb +0 -21
- data/lib/ronin/formatting/extensions/html/integer.rb +0 -142
- data/lib/ronin/formatting/extensions/html/string.rb +0 -194
- data/lib/ronin/formatting/extensions/html.rb +0 -21
- data/lib/ronin/formatting/extensions/http/string.rb +0 -110
- data/lib/ronin/formatting/extensions/http.rb +0 -21
- data/lib/ronin/formatting/extensions/sql/string.rb +0 -130
- data/lib/ronin/formatting/extensions/sql.rb +0 -20
- data/lib/ronin/formatting/extensions/text/array.rb +0 -137
- data/lib/ronin/formatting/extensions/text/string.rb +0 -297
- data/lib/ronin/formatting/extensions.rb +0 -24
- data/lib/ronin/fuzzing/extensions/string.rb +0 -209
- data/lib/ronin/fuzzing/fuzzer.rb +0 -110
- data/lib/ronin/fuzzing/fuzzing.rb +0 -360
- data/lib/ronin/fuzzing/mutator.rb +0 -161
- data/lib/ronin/fuzzing/repeater.rb +0 -81
- data/lib/ronin/fuzzing/template.rb +0 -133
- data/lib/ronin/fuzzing.rb +0 -21
- data/lib/ronin/mixin.rb +0 -89
- data/lib/ronin/network/dns.rb +0 -201
- data/lib/ronin/network/esmtp.rb +0 -113
- data/lib/ronin/network/extensions/dns.rb +0 -20
- data/lib/ronin/network/extensions/esmtp.rb +0 -20
- data/lib/ronin/network/extensions/http/uri/http.rb +0 -228
- data/lib/ronin/network/extensions/http.rb +0 -21
- data/lib/ronin/network/extensions/imap.rb +0 -20
- data/lib/ronin/network/extensions/pop3/net.rb +0 -24
- data/lib/ronin/network/extensions/pop3.rb +0 -20
- data/lib/ronin/network/extensions/smtp/net.rb +0 -24
- data/lib/ronin/network/extensions/ssl/net.rb +0 -24
- data/lib/ronin/network/extensions/ssl.rb +0 -20
- data/lib/ronin/network/extensions/tcp/net.rb +0 -24
- data/lib/ronin/network/extensions/tcp.rb +0 -20
- data/lib/ronin/network/extensions/telnet/net.rb +0 -24
- data/lib/ronin/network/extensions/telnet.rb +0 -20
- data/lib/ronin/network/extensions/udp/net.rb +0 -24
- data/lib/ronin/network/extensions/udp.rb +0 -20
- data/lib/ronin/network/extensions.rb +0 -29
- data/lib/ronin/network/ftp.rb +0 -149
- data/lib/ronin/network/http/exceptions.rb +0 -20
- data/lib/ronin/network/http/http.rb +0 -1122
- data/lib/ronin/network/http/proxy.rb +0 -330
- data/lib/ronin/network/http.rb +0 -22
- data/lib/ronin/network/imap.rb +0 -158
- data/lib/ronin/network/mixins/esmtp.rb +0 -164
- data/lib/ronin/network/mixins/ftp.rb +0 -155
- data/lib/ronin/network/mixins/http.rb +0 -227
- data/lib/ronin/network/mixins/imap.rb +0 -156
- data/lib/ronin/network/mixins/pop3.rb +0 -149
- data/lib/ronin/network/mixins/smtp.rb +0 -159
- data/lib/ronin/network/mixins/ssl.rb +0 -148
- data/lib/ronin/network/mixins/tcp.rb +0 -368
- data/lib/ronin/network/mixins/telnet.rb +0 -208
- data/lib/ronin/network/mixins/udp.rb +0 -381
- data/lib/ronin/network/mixins/unix.rb +0 -279
- data/lib/ronin/network/mixins.rb +0 -29
- data/lib/ronin/network/pop3.rb +0 -124
- data/lib/ronin/network/proxy.rb +0 -578
- data/lib/ronin/network/smtp/email.rb +0 -174
- data/lib/ronin/network/smtp/smtp.rb +0 -230
- data/lib/ronin/network/smtp.rb +0 -22
- data/lib/ronin/network/ssl.rb +0 -186
- data/lib/ronin/network/tcp/proxy.rb +0 -417
- data/lib/ronin/network/tcp/tcp.rb +0 -452
- data/lib/ronin/network/tcp.rb +0 -21
- data/lib/ronin/network/telnet.rb +0 -266
- data/lib/ronin/network/udp/proxy.rb +0 -191
- data/lib/ronin/network/udp/udp.rb +0 -452
- data/lib/ronin/network/udp.rb +0 -21
- data/lib/ronin/network/unix.rb +0 -286
- data/lib/ronin/network.rb +0 -31
- data/lib/ronin/path.rb +0 -133
- data/lib/ronin/spec/ui/output.rb +0 -22
- data/lib/ronin/support/inflector.rb +0 -92
- data/lib/ronin/templates/erb.rb +0 -78
- data/lib/ronin/templates/template.rb +0 -169
- data/lib/ronin/templates.rb +0 -21
- data/lib/ronin/ui/output/helpers.rb +0 -296
- data/lib/ronin/ui/output/output.rb +0 -142
- data/lib/ronin/ui/output/terminal/color.rb +0 -124
- data/lib/ronin/ui/output/terminal/raw.rb +0 -103
- data/lib/ronin/ui/output/terminal.rb +0 -21
- data/lib/ronin/ui/output.rb +0 -21
- data/lib/ronin/ui/shell.rb +0 -286
- data/lib/ronin/wordlist.rb +0 -287
- data/spec/binary/hexdump/helpers/hexdumps/ascii.bin +0 -0
- data/spec/binary/hexdump/helpers/hexdumps/hexdump_decimal_shorts.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/hexdump_hex_bytes.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/hexdump_hex_shorts.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/hexdump_octal_bytes.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/hexdump_octal_shorts.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/hexdump_repeated.txt +0 -6
- data/spec/binary/hexdump/helpers/hexdumps/od_decimal_bytes.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_decimal_ints.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_decimal_quads.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_decimal_shorts.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_doubles.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_floats.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_hex_bytes.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_hex_ints.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_hex_quads.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_hex_shorts.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_named_chars.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_octal_bytes.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_octal_ints.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_octal_quads.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_octal_shorts.txt +0 -17
- data/spec/binary/hexdump/helpers/hexdumps/od_repeated.txt +0 -6
- data/spec/binary/hexdump/helpers/hexdumps/repeated.bin +0 -1
- data/spec/binary/hexdump/helpers/hexdumps.rb +0 -13
- data/spec/binary/hexdump/parser_spec.rb +0 -302
- data/spec/binary/struct_spec.rb +0 -496
- data/spec/binary/template_spec.rb +0 -416
- data/spec/extensions/enumerable_spec.rb +0 -24
- data/spec/extensions/file_spec.rb +0 -61
- data/spec/extensions/ip_addr_spec.rb +0 -203
- data/spec/extensions/kernel_spec.rb +0 -30
- data/spec/extensions/regexp_spec.rb +0 -482
- data/spec/extensions/resolv_spec.rb +0 -18
- data/spec/extensions/string_spec.rb +0 -180
- data/spec/formatting/binary/array_spec.rb +0 -26
- data/spec/formatting/binary/base64_spec.rb +0 -50
- data/spec/formatting/binary/float_spec.rb +0 -36
- data/spec/formatting/binary/integer_spec.rb +0 -166
- data/spec/formatting/binary/string_spec.rb +0 -199
- data/spec/formatting/digest/string_spec.rb +0 -82
- data/spec/formatting/html/integer_spec.rb +0 -66
- data/spec/formatting/html/string_spec.rb +0 -103
- data/spec/formatting/http/integer_spec.rb +0 -42
- data/spec/formatting/http/string_spec.rb +0 -76
- data/spec/formatting/sql/string_spec.rb +0 -77
- data/spec/formatting/text/array_spec.rb +0 -105
- data/spec/formatting/text/string_spec.rb +0 -162
- data/spec/fuzzing/extensions/string_spec.rb +0 -87
- data/spec/fuzzing/fuzzer_spec.rb +0 -109
- data/spec/fuzzing/fuzzing_spec.rb +0 -24
- data/spec/fuzzing/mutator_spec.rb +0 -112
- data/spec/fuzzing/repeater_spec.rb +0 -57
- data/spec/fuzzing/template_spec.rb +0 -54
- data/spec/mixin_spec.rb +0 -51
- data/spec/network/dns_spec.rb +0 -203
- data/spec/network/ftp_spec.rb +0 -81
- data/spec/network/http/http_spec.rb +0 -559
- data/spec/network/http/proxy_spec.rb +0 -148
- data/spec/network/network_spec.rb +0 -8
- data/spec/network/proxy_spec.rb +0 -121
- data/spec/network/shared/unix_server.rb +0 -31
- data/spec/network/smtp/email_spec.rb +0 -100
- data/spec/network/ssl_spec.rb +0 -70
- data/spec/network/tcp/proxy_spec.rb +0 -118
- data/spec/network/tcp/tcp_spec.rb +0 -316
- data/spec/network/telnet_spec.rb +0 -67
- data/spec/network/udp/udp_spec.rb +0 -298
- data/spec/network/unix_spec.rb +0 -182
- data/spec/path_spec.rb +0 -111
- data/spec/spec_helper.rb +0 -8
- data/spec/support/inflector_spec.rb +0 -22
- data/spec/support_spec.rb +0 -8
- data/spec/templates/classes/example_erb.rb +0 -11
- data/spec/templates/classes/example_template.rb +0 -35
- data/spec/templates/erb_spec.rb +0 -21
- data/spec/templates/helpers/data/includes/_relative.erb +0 -1
- data/spec/templates/helpers/data/templates/example.erb +0 -1
- data/spec/templates/helpers/data.rb +0 -9
- data/spec/templates/template_spec.rb +0 -54
- data/spec/ui/classes/test_shell.rb +0 -22
- data/spec/ui/output_spec.rb +0 -32
- data/spec/ui/shell_spec.rb +0 -83
- data/spec/wordlist_spec.rb +0 -151
@@ -1,1122 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2006-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
-
#
|
4
|
-
# This file is part of ronin-support.
|
5
|
-
#
|
6
|
-
# ronin-support is free software: you can redistribute it and/or modify
|
7
|
-
# it under the terms of the GNU Lesser General Public License as published
|
8
|
-
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
-
# (at your option) any later version.
|
10
|
-
#
|
11
|
-
# ronin-support is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU Lesser General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Lesser General Public License
|
17
|
-
# along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
|
18
|
-
#
|
19
|
-
|
20
|
-
require 'ronin/network/http/exceptions/unknown_request'
|
21
|
-
require 'ronin/network/http/proxy'
|
22
|
-
require 'ronin/network/ssl'
|
23
|
-
|
24
|
-
require 'uri/query_params'
|
25
|
-
require 'net/http'
|
26
|
-
|
27
|
-
begin
|
28
|
-
require 'net/https'
|
29
|
-
rescue ::LoadError
|
30
|
-
$stderr.puts "WARNING: could not load 'net/https'"
|
31
|
-
end
|
32
|
-
|
33
|
-
module Ronin
|
34
|
-
module Network
|
35
|
-
#
|
36
|
-
# Provides helper methods for communicating with HTTP Servers.
|
37
|
-
#
|
38
|
-
module HTTP
|
39
|
-
#
|
40
|
-
# The Ronin HTTP proxy to use.
|
41
|
-
#
|
42
|
-
# @return [Proxy]
|
43
|
-
# The Ronin HTTP proxy.
|
44
|
-
#
|
45
|
-
# @note
|
46
|
-
# If the `HTTP_PROXY` environment variable is specified, it will
|
47
|
-
# be used as the default value.
|
48
|
-
#
|
49
|
-
# @see Proxy.new
|
50
|
-
# @see Proxy.parse
|
51
|
-
#
|
52
|
-
# @api public
|
53
|
-
#
|
54
|
-
def self.proxy
|
55
|
-
@proxy ||= if ENV['HTTP_PROXY']
|
56
|
-
Proxy.parse(ENV['HTTP_PROXY'])
|
57
|
-
else
|
58
|
-
Proxy.new
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
#
|
63
|
-
# Sets the Ronin HTTP proxy to use.
|
64
|
-
#
|
65
|
-
# @param [Proxy, URI::HTTP, Hash, String] new_proxy
|
66
|
-
# The new proxy information to use.
|
67
|
-
#
|
68
|
-
# @return [Proxy]
|
69
|
-
# The new proxy.
|
70
|
-
#
|
71
|
-
# @raise [ArgumentError]
|
72
|
-
# The given proxy information was not a {Proxy}, `URI::HTTP`,
|
73
|
-
# `Hash` or {String}.
|
74
|
-
#
|
75
|
-
# @api public
|
76
|
-
#
|
77
|
-
def self.proxy=(new_proxy)
|
78
|
-
@proxy = Proxy.create(new_proxy)
|
79
|
-
end
|
80
|
-
|
81
|
-
#
|
82
|
-
# The default Ronin HTTP User-Agent string.
|
83
|
-
#
|
84
|
-
# @return [String, nil]
|
85
|
-
# The default Ronin HTTP User-Agent.
|
86
|
-
#
|
87
|
-
# @api public
|
88
|
-
#
|
89
|
-
def self.user_agent
|
90
|
-
@user_agent ||= nil
|
91
|
-
end
|
92
|
-
|
93
|
-
#
|
94
|
-
# Sets the default Ronin HTTP User-Agent string.
|
95
|
-
#
|
96
|
-
# @param [String] agent
|
97
|
-
# The new User-Agent string to use.
|
98
|
-
#
|
99
|
-
# @api public
|
100
|
-
#
|
101
|
-
def self.user_agent=(agent)
|
102
|
-
@user_agent = agent
|
103
|
-
end
|
104
|
-
|
105
|
-
#
|
106
|
-
# Expands the URL into options.
|
107
|
-
#
|
108
|
-
# @param [URI::HTTP, String] url
|
109
|
-
# The URL to expand.
|
110
|
-
#
|
111
|
-
# @return [Hash{Symbol => Object}]
|
112
|
-
# The options for the URL.
|
113
|
-
#
|
114
|
-
# @api private
|
115
|
-
#
|
116
|
-
def self.expand_url(url)
|
117
|
-
new_options = {}
|
118
|
-
|
119
|
-
url = case url
|
120
|
-
when URI then url
|
121
|
-
when Hash then URI::HTTP.build(url)
|
122
|
-
else URI(url.to_s)
|
123
|
-
end
|
124
|
-
|
125
|
-
new_options[:ssl] = {} if url.scheme == 'https'
|
126
|
-
|
127
|
-
new_options[:host] = url.host
|
128
|
-
new_options[:port] = url.port
|
129
|
-
|
130
|
-
new_options[:user] = url.user if url.user
|
131
|
-
new_options[:password] = url.password if url.password
|
132
|
-
|
133
|
-
new_options[:path] = url.path unless url.path.empty?
|
134
|
-
new_options[:query] = url.query unless url.query.nil?
|
135
|
-
|
136
|
-
return new_options
|
137
|
-
end
|
138
|
-
|
139
|
-
#
|
140
|
-
# Expands the given HTTP options.
|
141
|
-
#
|
142
|
-
# @param [Hash] options
|
143
|
-
# HTTP options.
|
144
|
-
#
|
145
|
-
# @option options [String, URI::HTTP, URI::HTTPS] :url
|
146
|
-
# The URL to request.
|
147
|
-
#
|
148
|
-
# @option options [String] :host
|
149
|
-
# The host to connect to.
|
150
|
-
#
|
151
|
-
# @option options [String] :port (Net::HTTP.default_port)
|
152
|
-
# The port to connect to.
|
153
|
-
#
|
154
|
-
# @option options [String] :user
|
155
|
-
# The user to authenticate as.
|
156
|
-
#
|
157
|
-
# @option options [String] :password
|
158
|
-
# The password to authenticate with.
|
159
|
-
#
|
160
|
-
# @option options [String] :path ('/')
|
161
|
-
# The path to request.
|
162
|
-
#
|
163
|
-
# @option options [String, Hash] :proxy (HTTP.proxy)
|
164
|
-
# The Proxy information.
|
165
|
-
#
|
166
|
-
# @return [Hash]
|
167
|
-
# The expanded version of options.
|
168
|
-
#
|
169
|
-
# @api private
|
170
|
-
#
|
171
|
-
def self.expand_options(options={})
|
172
|
-
new_options = options.dup
|
173
|
-
|
174
|
-
new_options[:port] ||= Net::HTTP.default_port
|
175
|
-
new_options[:path] ||= '/'
|
176
|
-
|
177
|
-
if new_options[:ssl] == true
|
178
|
-
new_options[:ssl] = {}
|
179
|
-
end
|
180
|
-
|
181
|
-
if (url = new_options.delete(:url))
|
182
|
-
new_options.merge!(HTTP.expand_url(url))
|
183
|
-
end
|
184
|
-
|
185
|
-
new_options[:proxy] = if new_options.has_key?(:proxy)
|
186
|
-
HTTP::Proxy.create(new_options[:proxy])
|
187
|
-
else
|
188
|
-
HTTP.proxy
|
189
|
-
end
|
190
|
-
|
191
|
-
return new_options
|
192
|
-
end
|
193
|
-
|
194
|
-
#
|
195
|
-
# Converts an underscored, dashed, lowercase or uppercase HTTP header
|
196
|
-
# name to the standard camel-case HTTP header name.
|
197
|
-
#
|
198
|
-
# @param [Symbol, String] name
|
199
|
-
# The unformatted HTTP header name.
|
200
|
-
#
|
201
|
-
# @return [String]
|
202
|
-
# The camel-case HTTP header name.
|
203
|
-
#
|
204
|
-
# @api private
|
205
|
-
#
|
206
|
-
def self.header_name(name)
|
207
|
-
words = name.to_s.split(/[\s+_-]/)
|
208
|
-
|
209
|
-
words.each { |word| word.capitalize! }
|
210
|
-
return words.join('-')
|
211
|
-
end
|
212
|
-
|
213
|
-
#
|
214
|
-
# Converts underscored, dashed, lowercase and uppercase HTTP headers
|
215
|
-
# to standard camel-cased HTTP headers.
|
216
|
-
#
|
217
|
-
# @param [Hash{Symbol,String => String}] options
|
218
|
-
# Ronin HTTP headers.
|
219
|
-
#
|
220
|
-
# @return [Hash]
|
221
|
-
# The camel-cased HTTP headers created from the given options.
|
222
|
-
#
|
223
|
-
# @api private
|
224
|
-
#
|
225
|
-
def self.headers(options={})
|
226
|
-
headers = {}
|
227
|
-
|
228
|
-
if user_agent
|
229
|
-
headers['User-Agent'] = user_agent
|
230
|
-
end
|
231
|
-
|
232
|
-
if options
|
233
|
-
options.each do |name,value|
|
234
|
-
headers[HTTP.header_name(name)] = value.to_s
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
return headers
|
239
|
-
end
|
240
|
-
|
241
|
-
#
|
242
|
-
# Creates a specific type of HTTP request object.
|
243
|
-
#
|
244
|
-
# @param [Hash] options
|
245
|
-
# The HTTP options for the request.
|
246
|
-
#
|
247
|
-
# @option options [Symbol, String] :method
|
248
|
-
# The HTTP method to use for the request.
|
249
|
-
#
|
250
|
-
# @option options [String] :path ('/')
|
251
|
-
# The path to request.
|
252
|
-
#
|
253
|
-
# @option options [String] :query
|
254
|
-
# The query-string to append to the request path.
|
255
|
-
#
|
256
|
-
# @option options [String] :query_params
|
257
|
-
# The query-params to append to the request path.
|
258
|
-
#
|
259
|
-
# @option options [String] :body
|
260
|
-
# The body of the request.
|
261
|
-
#
|
262
|
-
# @option options [Hash, String] :form_data
|
263
|
-
# The form data that may be sent in the body of the request.
|
264
|
-
#
|
265
|
-
# @option options [String] :user
|
266
|
-
# The user to authenticate as.
|
267
|
-
#
|
268
|
-
# @option options [String] :password
|
269
|
-
# The password to authenticate with.
|
270
|
-
#
|
271
|
-
# @option options [Hash{Symbol,String => String}] :headers
|
272
|
-
# Additional HTTP headers to use for the request.
|
273
|
-
#
|
274
|
-
# @return [HTTP::Request]
|
275
|
-
# The new HTTP Request object.
|
276
|
-
#
|
277
|
-
# @raise [ArgumentError]
|
278
|
-
# The `:method` option must be specified.
|
279
|
-
#
|
280
|
-
# @raise [UnknownRequest]
|
281
|
-
# The `:method` option did not match a known Net::HTTP request
|
282
|
-
# class.
|
283
|
-
#
|
284
|
-
# @see HTTP.expand_options
|
285
|
-
#
|
286
|
-
# @api private
|
287
|
-
#
|
288
|
-
def self.request(options={})
|
289
|
-
unless options[:method]
|
290
|
-
raise(ArgumentError,"the :method option must be specified")
|
291
|
-
end
|
292
|
-
|
293
|
-
name = options[:method].to_s.capitalize
|
294
|
-
|
295
|
-
unless Net::HTTP.const_defined?(name)
|
296
|
-
raise(UnknownRequest,"unknown HTTP request type #{name.dump}")
|
297
|
-
end
|
298
|
-
|
299
|
-
headers = headers(options[:headers])
|
300
|
-
path = (options[:path] || '/').to_s
|
301
|
-
query = if options[:query]
|
302
|
-
options[:query].to_s
|
303
|
-
elsif options[:query_params]
|
304
|
-
URI::QueryParams.dump(options[:query_params])
|
305
|
-
end
|
306
|
-
|
307
|
-
if query
|
308
|
-
# append the query-string onto the path
|
309
|
-
path += if path.include?('?') then "&#{query}"
|
310
|
-
else "?#{query}"
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
request = Net::HTTP.const_get(name).new(path,headers)
|
315
|
-
|
316
|
-
if options[:form_data]
|
317
|
-
case options[:form_data]
|
318
|
-
when String
|
319
|
-
request.content_type = 'application/x-www-form-urlencoded'
|
320
|
-
request.body = options[:form_data]
|
321
|
-
else
|
322
|
-
request.form_data = options[:form_data]
|
323
|
-
end
|
324
|
-
elsif options[:body]
|
325
|
-
request.body = options[:body]
|
326
|
-
end
|
327
|
-
|
328
|
-
if options[:user]
|
329
|
-
user = options[:user].to_s
|
330
|
-
password = if options[:password]
|
331
|
-
options[:password].to_s
|
332
|
-
end
|
333
|
-
|
334
|
-
request.basic_auth(user,password)
|
335
|
-
end
|
336
|
-
|
337
|
-
return request
|
338
|
-
end
|
339
|
-
|
340
|
-
#
|
341
|
-
# Starts a HTTP connection with the server.
|
342
|
-
#
|
343
|
-
# @param [Hash] options
|
344
|
-
# Additional options
|
345
|
-
#
|
346
|
-
# @option options [String, URI::HTTP] :url
|
347
|
-
# The full URL to request.
|
348
|
-
#
|
349
|
-
# @option options [String] :host
|
350
|
-
# The host the HTTP server is running on.
|
351
|
-
#
|
352
|
-
# @option options [Integer] :port (Net::HTTP.default_port)
|
353
|
-
# The port the HTTP server is listening on.
|
354
|
-
#
|
355
|
-
# @option options [String, Hash] :proxy (HTTP.proxy)
|
356
|
-
# A Hash of proxy settings to use when connecting to the HTTP server.
|
357
|
-
#
|
358
|
-
# @option options [String] :user
|
359
|
-
# The user to authenticate with when connecting to the HTTP server.
|
360
|
-
#
|
361
|
-
# @option options [String] :password
|
362
|
-
# The password to authenticate with when connecting to the HTTP server.
|
363
|
-
#
|
364
|
-
# @option options [Boolean, Hash] :ssl
|
365
|
-
# Enables SSL for the HTTP connection.
|
366
|
-
#
|
367
|
-
# @option :ssl [Symbol] :verify
|
368
|
-
# Specifies the SSL certificate verification mode.
|
369
|
-
#
|
370
|
-
# @yield [http]
|
371
|
-
# If a block is given, it will be passed the newly created HTTP
|
372
|
-
# session object.
|
373
|
-
#
|
374
|
-
# @yieldparam [Net::HTTP] http
|
375
|
-
# The newly created HTTP session.
|
376
|
-
#
|
377
|
-
# @return [Net::HTTP]
|
378
|
-
# The HTTP session object.
|
379
|
-
#
|
380
|
-
# @api public
|
381
|
-
#
|
382
|
-
def http_connect(options={},&block)
|
383
|
-
options = HTTP.expand_options(options)
|
384
|
-
|
385
|
-
host = options[:host].to_s
|
386
|
-
port = options[:port]
|
387
|
-
proxy = options[:proxy]
|
388
|
-
proxy_host = if (proxy && proxy[:host])
|
389
|
-
proxy[:host].to_s
|
390
|
-
end
|
391
|
-
|
392
|
-
http = Net::HTTP::Proxy(
|
393
|
-
proxy_host,
|
394
|
-
proxy[:port],
|
395
|
-
proxy[:user],
|
396
|
-
proxy[:password]
|
397
|
-
).new(host,port)
|
398
|
-
|
399
|
-
if options[:ssl]
|
400
|
-
http.use_ssl = true
|
401
|
-
http.verify_mode = SSL::VERIFY[options[:ssl][:verify]]
|
402
|
-
end
|
403
|
-
|
404
|
-
http.start()
|
405
|
-
|
406
|
-
if block
|
407
|
-
if block.arity == 2
|
408
|
-
block.call(http,options)
|
409
|
-
else
|
410
|
-
block.call(http)
|
411
|
-
end
|
412
|
-
end
|
413
|
-
|
414
|
-
return http
|
415
|
-
end
|
416
|
-
|
417
|
-
#
|
418
|
-
# Creates a new temporary HTTP session with the server.
|
419
|
-
#
|
420
|
-
# @param [Hash] options
|
421
|
-
# Additional options
|
422
|
-
#
|
423
|
-
# @option options [String, URI::HTTP] :url
|
424
|
-
# The full URL to request.
|
425
|
-
#
|
426
|
-
# @option options [String] :host
|
427
|
-
# The host the HTTP server is running on.
|
428
|
-
#
|
429
|
-
# @option options [Integer] :port (Net::HTTP.default_port)
|
430
|
-
# The port the HTTP server is listening on.
|
431
|
-
#
|
432
|
-
# @option options [String] :user
|
433
|
-
# The user to authenticate with when connecting to the HTTP server.
|
434
|
-
#
|
435
|
-
# @option options [String] :password
|
436
|
-
# The password to authenticate with when connecting to the HTTP server.
|
437
|
-
#
|
438
|
-
# @option options [String, Hash] :proxy (HTTP.proxy)
|
439
|
-
# A Hash of proxy settings to use when connecting to the HTTP server.
|
440
|
-
#
|
441
|
-
# @option options [Boolean, Hash] :ssl
|
442
|
-
# Enables SSL for the HTTP connection.
|
443
|
-
#
|
444
|
-
# @option :ssl [Symbol] :verify
|
445
|
-
# Specifies the SSL certificate verification mode.
|
446
|
-
#
|
447
|
-
# @yield [http]
|
448
|
-
# If a block is given, it will be passed the newly created HTTP
|
449
|
-
# session object.
|
450
|
-
#
|
451
|
-
# @yieldparam [Net::HTTP] http
|
452
|
-
# The newly created HTTP session.
|
453
|
-
#
|
454
|
-
# @return [nil]
|
455
|
-
#
|
456
|
-
# @see #http_connect
|
457
|
-
#
|
458
|
-
# @api public
|
459
|
-
#
|
460
|
-
def http_session(options={},&block)
|
461
|
-
http_connect(options) do |http,expanded_options|
|
462
|
-
if block
|
463
|
-
if block.arity == 2
|
464
|
-
block.call(http,expanded_options)
|
465
|
-
else
|
466
|
-
block.call(http)
|
467
|
-
end
|
468
|
-
end
|
469
|
-
|
470
|
-
http.finish
|
471
|
-
end
|
472
|
-
|
473
|
-
return nil
|
474
|
-
end
|
475
|
-
|
476
|
-
#
|
477
|
-
# Connects to the HTTP server and sends an HTTP Request.
|
478
|
-
#
|
479
|
-
# @param [Hash] options
|
480
|
-
# Additional options.
|
481
|
-
#
|
482
|
-
# @option options [Symbol, String] :method
|
483
|
-
# The HTTP method to use in the request.
|
484
|
-
#
|
485
|
-
# @option options [String] :path
|
486
|
-
# The path to request from the HTTP server.
|
487
|
-
#
|
488
|
-
# @option options [Hash] :headers
|
489
|
-
# The Hash of the HTTP headers to send with the request.
|
490
|
-
# May contain either Strings or Symbols, lower-case or camel-case keys.
|
491
|
-
#
|
492
|
-
# @option options [String] :body
|
493
|
-
# The body of the request.
|
494
|
-
#
|
495
|
-
# @option options [Hash, String] :form_data
|
496
|
-
# The form data that may be sent in the body of the request.
|
497
|
-
#
|
498
|
-
# @yield [request, (options)]
|
499
|
-
# If a block is given, it will be passed the HTTP request object.
|
500
|
-
# If the block has an arity of 2, it will also be passed the expanded
|
501
|
-
# version of the given _options_.
|
502
|
-
#
|
503
|
-
# @yieldparam [Net::HTTPRequest] request
|
504
|
-
# The HTTP request object to use in the request.
|
505
|
-
#
|
506
|
-
# @yieldparam [Hash] options
|
507
|
-
# The expanded version of the given _options_.
|
508
|
-
#
|
509
|
-
# @return [Net::HTTPResponse]
|
510
|
-
# The response of the HTTP request.
|
511
|
-
#
|
512
|
-
# @see #http_session
|
513
|
-
#
|
514
|
-
# @api public
|
515
|
-
#
|
516
|
-
def http_request(options={},&block)
|
517
|
-
response = nil
|
518
|
-
|
519
|
-
http_session(options) do |http,expanded_options|
|
520
|
-
req = HTTP.request(expanded_options)
|
521
|
-
|
522
|
-
if block
|
523
|
-
if block.arity == 2
|
524
|
-
block.call(req,expanded_options)
|
525
|
-
else
|
526
|
-
block.call(req)
|
527
|
-
end
|
528
|
-
end
|
529
|
-
|
530
|
-
response = http.request(req)
|
531
|
-
end
|
532
|
-
|
533
|
-
return response
|
534
|
-
end
|
535
|
-
|
536
|
-
#
|
537
|
-
# Returns the Status Code of the Response.
|
538
|
-
#
|
539
|
-
# @param [Hash] options
|
540
|
-
# Additional options.
|
541
|
-
#
|
542
|
-
# @option options [Symbol, String] :method (:head)
|
543
|
-
# The method to use for the request.
|
544
|
-
#
|
545
|
-
# @return [Integer]
|
546
|
-
# The HTTP Response Status.
|
547
|
-
#
|
548
|
-
# @see #http_request
|
549
|
-
#
|
550
|
-
# @since 0.2.0
|
551
|
-
#
|
552
|
-
# @api public
|
553
|
-
#
|
554
|
-
def http_status(options={})
|
555
|
-
options = {:method => :head}.merge(options)
|
556
|
-
|
557
|
-
return http_request(options).code.to_i
|
558
|
-
end
|
559
|
-
|
560
|
-
#
|
561
|
-
# Checks if the response has an HTTP OK status code.
|
562
|
-
#
|
563
|
-
# @param [Hash] options
|
564
|
-
# Additional options.
|
565
|
-
#
|
566
|
-
# @option options [Symbol, String] :method (:head)
|
567
|
-
# The method to use for the request.
|
568
|
-
#
|
569
|
-
# @return [Boolean]
|
570
|
-
# Specifies whether the response had an HTTP OK status code or not.
|
571
|
-
#
|
572
|
-
# @see #http_status
|
573
|
-
#
|
574
|
-
# @api public
|
575
|
-
#
|
576
|
-
def http_ok?(options={})
|
577
|
-
http_status(options) == 200
|
578
|
-
end
|
579
|
-
|
580
|
-
#
|
581
|
-
# Sends a HTTP Head request and returns the HTTP Server header.
|
582
|
-
#
|
583
|
-
# @param [Hash] options
|
584
|
-
# Additional options.
|
585
|
-
#
|
586
|
-
# @option options [Symbol, String] :method (:head)
|
587
|
-
# The method to use for the request.
|
588
|
-
#
|
589
|
-
# @return [String]
|
590
|
-
# The HTTP `Server` header.
|
591
|
-
#
|
592
|
-
# @see #http_request
|
593
|
-
#
|
594
|
-
# @api public
|
595
|
-
#
|
596
|
-
def http_server(options={})
|
597
|
-
options = {:method => :head}.merge(options)
|
598
|
-
|
599
|
-
return http_request(options)['server']
|
600
|
-
end
|
601
|
-
|
602
|
-
#
|
603
|
-
# Sends an HTTP Head request and returns the HTTP X-Powered-By header.
|
604
|
-
#
|
605
|
-
# @param [Hash] options
|
606
|
-
# Additional options.
|
607
|
-
#
|
608
|
-
# @option options [Symbol, String] :method (:get)
|
609
|
-
# The method to use for the request.
|
610
|
-
#
|
611
|
-
# @return [String]
|
612
|
-
# The HTTP `X-Powered-By` header.
|
613
|
-
#
|
614
|
-
# @see #http_request
|
615
|
-
#
|
616
|
-
# @api public
|
617
|
-
#
|
618
|
-
def http_powered_by(options={})
|
619
|
-
options = {:method => :get}.merge(options)
|
620
|
-
|
621
|
-
return http_request(options)['x-powered-by']
|
622
|
-
end
|
623
|
-
|
624
|
-
#
|
625
|
-
# Performs an HTTP Copy request.
|
626
|
-
#
|
627
|
-
# @param [Hash] options
|
628
|
-
# Additional options.
|
629
|
-
#
|
630
|
-
# @yield [response]
|
631
|
-
# If a block is given, it will be passed the response received
|
632
|
-
# from the request.
|
633
|
-
#
|
634
|
-
# @yieldparam [Net::HTTPResponse] response
|
635
|
-
# The HTTP response object.
|
636
|
-
#
|
637
|
-
# @return [Net::HTTPResponse]
|
638
|
-
# The response of the HTTP request.
|
639
|
-
#
|
640
|
-
# @see #http_request
|
641
|
-
#
|
642
|
-
# @api public
|
643
|
-
#
|
644
|
-
def http_copy(options={})
|
645
|
-
response = http_request(options.merge(:method => :copy))
|
646
|
-
|
647
|
-
yield response if block_given?
|
648
|
-
return response
|
649
|
-
end
|
650
|
-
|
651
|
-
#
|
652
|
-
# Performs an HTTP Delete request.
|
653
|
-
#
|
654
|
-
# @param [Hash] options
|
655
|
-
# Additional options.
|
656
|
-
#
|
657
|
-
# @yield [response]
|
658
|
-
# If a block is given, it will be passed the response received from
|
659
|
-
# the request.
|
660
|
-
#
|
661
|
-
# @yieldparam [Net::HTTPResponse] response
|
662
|
-
# The HTTP response object.
|
663
|
-
#
|
664
|
-
# @return [Net::HTTPResponse]
|
665
|
-
# The response of the HTTP request.
|
666
|
-
#
|
667
|
-
# @see #http_request
|
668
|
-
#
|
669
|
-
# @api public
|
670
|
-
#
|
671
|
-
def http_delete(options={},&block)
|
672
|
-
original_headers = options[:headers]
|
673
|
-
|
674
|
-
# set the HTTP Depth header
|
675
|
-
options[:headers] = {:depth => 'Infinity'}
|
676
|
-
|
677
|
-
if original_headers
|
678
|
-
options[:header].merge!(original_headers)
|
679
|
-
end
|
680
|
-
|
681
|
-
response = http_request(options.merge(:method => :delete))
|
682
|
-
|
683
|
-
yield response if block_given?
|
684
|
-
return response
|
685
|
-
end
|
686
|
-
|
687
|
-
#
|
688
|
-
# Performs an HTTP Get request.
|
689
|
-
#
|
690
|
-
# @param [Hash] options
|
691
|
-
# Additional options.
|
692
|
-
#
|
693
|
-
# @yield [response]
|
694
|
-
# If a block is given, it will be passed the response received from
|
695
|
-
# the request.
|
696
|
-
#
|
697
|
-
# @yieldparam [Net::HTTPResponse] response
|
698
|
-
# The HTTP response object.
|
699
|
-
#
|
700
|
-
# @return [Net::HTTPResponse]
|
701
|
-
# The response of the HTTP request.
|
702
|
-
#
|
703
|
-
# @see #http_request
|
704
|
-
#
|
705
|
-
# @api public
|
706
|
-
#
|
707
|
-
def http_get(options={},&block)
|
708
|
-
response = http_request(options.merge(:method => :get))
|
709
|
-
|
710
|
-
yield response if block_given?
|
711
|
-
return response
|
712
|
-
end
|
713
|
-
|
714
|
-
#
|
715
|
-
# Performs an HTTP Get request and returns the Response Headers.
|
716
|
-
#
|
717
|
-
# @param [Hash] options
|
718
|
-
# Additional options.
|
719
|
-
#
|
720
|
-
# @return [Hash{String => Array<String>}]
|
721
|
-
# The Headers of the HTTP response.
|
722
|
-
#
|
723
|
-
# @see #http_get
|
724
|
-
#
|
725
|
-
# @since 0.2.0
|
726
|
-
#
|
727
|
-
# @api public
|
728
|
-
#
|
729
|
-
def http_get_headers(options={})
|
730
|
-
headers = {}
|
731
|
-
|
732
|
-
http_get(options).each_header do |name,value|
|
733
|
-
headers[HTTP.header_name(name)] = value
|
734
|
-
end
|
735
|
-
|
736
|
-
return headers
|
737
|
-
end
|
738
|
-
|
739
|
-
#
|
740
|
-
# Performs an HTTP Get request and returns the Respond Body.
|
741
|
-
#
|
742
|
-
# @param [Hash] options
|
743
|
-
# Additional options.
|
744
|
-
#
|
745
|
-
# @return [String]
|
746
|
-
# The body of the HTTP response.
|
747
|
-
#
|
748
|
-
# @see #http_get
|
749
|
-
#
|
750
|
-
# @api public
|
751
|
-
#
|
752
|
-
def http_get_body(options={})
|
753
|
-
http_get(options).body
|
754
|
-
end
|
755
|
-
|
756
|
-
#
|
757
|
-
# Performs an HTTP Head request.
|
758
|
-
#
|
759
|
-
# @param [Hash] options
|
760
|
-
# Additional options.
|
761
|
-
#
|
762
|
-
# @yield [response]
|
763
|
-
# If a block is given, it will be passed the response received from
|
764
|
-
# the request.
|
765
|
-
#
|
766
|
-
# @yieldparam [Net::HTTPResponse] response
|
767
|
-
# The HTTP response object.
|
768
|
-
#
|
769
|
-
# @return [Net::HTTPResponse]
|
770
|
-
# The response of the HTTP request.
|
771
|
-
#
|
772
|
-
# @see #http_request
|
773
|
-
#
|
774
|
-
# @api public
|
775
|
-
#
|
776
|
-
def http_head(options={},&block)
|
777
|
-
response = http_request(options.merge(:method => :head))
|
778
|
-
|
779
|
-
yield response if block_given?
|
780
|
-
return response
|
781
|
-
end
|
782
|
-
|
783
|
-
#
|
784
|
-
# Performs an HTTP Lock request.
|
785
|
-
#
|
786
|
-
# @param [Hash] options
|
787
|
-
# Additional options.
|
788
|
-
#
|
789
|
-
# @yield [response]
|
790
|
-
# If a block is given, it will be passed the response received from
|
791
|
-
# the request.
|
792
|
-
#
|
793
|
-
# @yieldparam [Net::HTTPResponse] response
|
794
|
-
# The HTTP response object.
|
795
|
-
#
|
796
|
-
# @return [Net::HTTPResponse]
|
797
|
-
# The response of the HTTP request.
|
798
|
-
#
|
799
|
-
# @see #http_request
|
800
|
-
#
|
801
|
-
# @api public
|
802
|
-
#
|
803
|
-
def http_lock(options={},&block)
|
804
|
-
response = http_request(options.merge(:method => :lock))
|
805
|
-
|
806
|
-
yield response if block_given?
|
807
|
-
return response
|
808
|
-
end
|
809
|
-
|
810
|
-
#
|
811
|
-
# Performs an HTTP Mkcol request.
|
812
|
-
#
|
813
|
-
# @param [Hash] options
|
814
|
-
# Additional options.
|
815
|
-
#
|
816
|
-
# @yield [response]
|
817
|
-
# If a block is given, it will be passed the response received from
|
818
|
-
# the request.
|
819
|
-
#
|
820
|
-
# @yieldparam [Net::HTTPResponse] response
|
821
|
-
# The HTTP response object.
|
822
|
-
#
|
823
|
-
# @return [Net::HTTPResponse]
|
824
|
-
# The response of the HTTP request.
|
825
|
-
#
|
826
|
-
# @see #http_request
|
827
|
-
#
|
828
|
-
# @api public
|
829
|
-
#
|
830
|
-
def http_mkcol(options={},&block)
|
831
|
-
response = http_request(options.merge(:method => :mkcol))
|
832
|
-
|
833
|
-
yield response if block_given?
|
834
|
-
return response
|
835
|
-
end
|
836
|
-
|
837
|
-
#
|
838
|
-
# Performs an HTTP Move request.
|
839
|
-
#
|
840
|
-
# @param [Hash] options
|
841
|
-
# Additional options.
|
842
|
-
#
|
843
|
-
# @yield [response]
|
844
|
-
# If a block is given, it will be passed the response received from
|
845
|
-
# the request.
|
846
|
-
#
|
847
|
-
# @yieldparam [Net::HTTPResponse] response
|
848
|
-
# The HTTP response object.
|
849
|
-
#
|
850
|
-
# @return [Net::HTTPResponse]
|
851
|
-
# The response of the HTTP request.
|
852
|
-
#
|
853
|
-
# @see #http_request
|
854
|
-
#
|
855
|
-
# @api public
|
856
|
-
#
|
857
|
-
def http_move(options={},&block)
|
858
|
-
response = http_request(options.merge(:method => :move))
|
859
|
-
|
860
|
-
yield response if block_given?
|
861
|
-
return response
|
862
|
-
end
|
863
|
-
|
864
|
-
#
|
865
|
-
# Performs an HTTP Options request.
|
866
|
-
#
|
867
|
-
# @param [Hash] options
|
868
|
-
# Additional options.
|
869
|
-
#
|
870
|
-
# @yield [response]
|
871
|
-
# If a block is given, it will be passed the response received from
|
872
|
-
# the request.
|
873
|
-
#
|
874
|
-
# @yieldparam [Net::HTTPResponse] response
|
875
|
-
# The HTTP response object.
|
876
|
-
#
|
877
|
-
# @return [Net::HTTPResponse]
|
878
|
-
# The response of the HTTP request.
|
879
|
-
#
|
880
|
-
# @see #http_request
|
881
|
-
#
|
882
|
-
# @api public
|
883
|
-
#
|
884
|
-
def http_options(options={},&block)
|
885
|
-
response = http_request(options.merge(:method => :options))
|
886
|
-
|
887
|
-
yield response if block_given?
|
888
|
-
return response
|
889
|
-
end
|
890
|
-
|
891
|
-
#
|
892
|
-
# Performs an HTTP Post request.
|
893
|
-
#
|
894
|
-
# @param [Hash] options
|
895
|
-
# Additional options.
|
896
|
-
#
|
897
|
-
# @option options [Hash, String] :form_data
|
898
|
-
# The form data to send with the HTTP Post request.
|
899
|
-
#
|
900
|
-
# @yield [response]
|
901
|
-
# If a block is given, it will be passed the response received from
|
902
|
-
# the request.
|
903
|
-
#
|
904
|
-
# @yieldparam [Net::HTTPResponse] response
|
905
|
-
# The HTTP response object.
|
906
|
-
#
|
907
|
-
# @return [Net::HTTPResponse]
|
908
|
-
# The response of the HTTP request.
|
909
|
-
#
|
910
|
-
# @see #http_request
|
911
|
-
#
|
912
|
-
# @api public
|
913
|
-
#
|
914
|
-
def http_post(options={},&block)
|
915
|
-
response = http_request(options.merge(:method => :post))
|
916
|
-
|
917
|
-
yield response if block_given?
|
918
|
-
return response
|
919
|
-
end
|
920
|
-
|
921
|
-
#
|
922
|
-
# Performs an HTTP Post request and returns the Response Headers.
|
923
|
-
#
|
924
|
-
# @param [Hash] options
|
925
|
-
# Additional options.
|
926
|
-
#
|
927
|
-
# @option options [Hash, String] :form_data
|
928
|
-
# The form data to send with the HTTP Post request.
|
929
|
-
#
|
930
|
-
# @return [Hash{String => Array<String>}]
|
931
|
-
# The headers of the HTTP response.
|
932
|
-
#
|
933
|
-
# @see #http_post
|
934
|
-
#
|
935
|
-
# @since 0.2.0
|
936
|
-
#
|
937
|
-
# @api public
|
938
|
-
#
|
939
|
-
def http_post_headers(options={})
|
940
|
-
headers = {}
|
941
|
-
|
942
|
-
http_post(options).each_header do |name,value|
|
943
|
-
headers[HTTP.header_name(name)] = value
|
944
|
-
end
|
945
|
-
|
946
|
-
return headers
|
947
|
-
end
|
948
|
-
|
949
|
-
#
|
950
|
-
# Performs an HTTP Post request and returns the Response Body.
|
951
|
-
#
|
952
|
-
# @param [Hash] options
|
953
|
-
# Additional options.
|
954
|
-
#
|
955
|
-
# @option options [Hash, String] :form_data
|
956
|
-
# The form data to send with the HTTP Post request.
|
957
|
-
#
|
958
|
-
# @return [String]
|
959
|
-
# The body of the HTTP response.
|
960
|
-
#
|
961
|
-
# @see #http_post
|
962
|
-
#
|
963
|
-
# @api public
|
964
|
-
#
|
965
|
-
def http_post_body(options={})
|
966
|
-
http_post(options).body
|
967
|
-
end
|
968
|
-
|
969
|
-
#
|
970
|
-
# Performs an HTTP PUT request.
|
971
|
-
#
|
972
|
-
# @param [Hash] options
|
973
|
-
# Additional options.
|
974
|
-
#
|
975
|
-
# @option options [String] :body
|
976
|
-
# The body for the request.
|
977
|
-
#
|
978
|
-
# @option options [Hash, String] :form_data
|
979
|
-
# The form data to send with the HTTP PUT request.
|
980
|
-
#
|
981
|
-
# @yield [response]
|
982
|
-
# If a block is given, it will be passed the response received from
|
983
|
-
# the request.
|
984
|
-
#
|
985
|
-
# @yieldparam [Net::HTTPResponse] response
|
986
|
-
# The HTTP response object.
|
987
|
-
#
|
988
|
-
# @return [Net::HTTPResponse]
|
989
|
-
# The response of the HTTP request.
|
990
|
-
#
|
991
|
-
# @see #http_request
|
992
|
-
#
|
993
|
-
# @since 0.4.0
|
994
|
-
#
|
995
|
-
# @api public
|
996
|
-
#
|
997
|
-
def http_put(options={})
|
998
|
-
response = http_request(options.merge(:method => :put))
|
999
|
-
|
1000
|
-
yield response if block_given?
|
1001
|
-
return response
|
1002
|
-
end
|
1003
|
-
|
1004
|
-
#
|
1005
|
-
# Performs an HTTP Propfind request.
|
1006
|
-
#
|
1007
|
-
# @param [Hash] options
|
1008
|
-
# Additional options.
|
1009
|
-
#
|
1010
|
-
# @yield [response]
|
1011
|
-
# If a block is given, it will be passed the response received from
|
1012
|
-
# the request.
|
1013
|
-
#
|
1014
|
-
# @yieldparam [Net::HTTPResponse] response
|
1015
|
-
# The HTTP response object.
|
1016
|
-
#
|
1017
|
-
# @return [Net::HTTPResponse]
|
1018
|
-
# The response of the HTTP request.
|
1019
|
-
#
|
1020
|
-
# @see #http_request
|
1021
|
-
#
|
1022
|
-
# @api public
|
1023
|
-
#
|
1024
|
-
def http_prop_find(options={},&block)
|
1025
|
-
original_headers = options[:headers]
|
1026
|
-
|
1027
|
-
# set the HTTP Depth header
|
1028
|
-
options[:headers] = {:depth => '0'}
|
1029
|
-
|
1030
|
-
if original_headers
|
1031
|
-
options[:header].merge!(original_headers)
|
1032
|
-
end
|
1033
|
-
|
1034
|
-
response = http_request(options.merge(:method => :propfind))
|
1035
|
-
|
1036
|
-
yield response if block_given?
|
1037
|
-
return response
|
1038
|
-
end
|
1039
|
-
|
1040
|
-
#
|
1041
|
-
# Performs an HTTP Proppatch request.
|
1042
|
-
#
|
1043
|
-
# @param [Hash] options
|
1044
|
-
# Additional options.
|
1045
|
-
#
|
1046
|
-
# @yield [response]
|
1047
|
-
# If a block is given, it will be passed the response received from
|
1048
|
-
# the request.
|
1049
|
-
#
|
1050
|
-
# @yieldparam [Net::HTTPResponse] response
|
1051
|
-
# The HTTP response object.
|
1052
|
-
#
|
1053
|
-
# @return [Net::HTTPResponse]
|
1054
|
-
# The response of the HTTP request.
|
1055
|
-
#
|
1056
|
-
# @see #http_request
|
1057
|
-
#
|
1058
|
-
# @api public
|
1059
|
-
#
|
1060
|
-
def http_prop_patch(options={},&block)
|
1061
|
-
response = http_request(options.merge(:method => :proppatch))
|
1062
|
-
|
1063
|
-
yield response if block_given?
|
1064
|
-
return response
|
1065
|
-
end
|
1066
|
-
|
1067
|
-
#
|
1068
|
-
# Performs an HTTP Trace request.
|
1069
|
-
#
|
1070
|
-
# @param [Hash] options
|
1071
|
-
# Additional options.
|
1072
|
-
#
|
1073
|
-
# @yield [response]
|
1074
|
-
# If a block is given, it will be passed the response received from
|
1075
|
-
# the request.
|
1076
|
-
#
|
1077
|
-
# @yieldparam [Net::HTTPResponse] response
|
1078
|
-
# The HTTP response object.
|
1079
|
-
#
|
1080
|
-
# @return [Net::HTTPResponse]
|
1081
|
-
# The response of the HTTP request.
|
1082
|
-
#
|
1083
|
-
# @see #http_request
|
1084
|
-
#
|
1085
|
-
# @api public
|
1086
|
-
#
|
1087
|
-
def http_trace(options={},&block)
|
1088
|
-
response = http_request(options.merge(:method => :trace))
|
1089
|
-
|
1090
|
-
yield response if block_given?
|
1091
|
-
return response
|
1092
|
-
end
|
1093
|
-
|
1094
|
-
#
|
1095
|
-
# Performs an HTTP Unlock request.
|
1096
|
-
#
|
1097
|
-
# @param [Hash] options
|
1098
|
-
# Additional options.
|
1099
|
-
#
|
1100
|
-
# @yield [response]
|
1101
|
-
# If a block is given, it will be passed the response received from
|
1102
|
-
# the request.
|
1103
|
-
#
|
1104
|
-
# @yieldparam [Net::HTTPResponse] response
|
1105
|
-
# The HTTP response object.
|
1106
|
-
#
|
1107
|
-
# @return [Net::HTTPResponse]
|
1108
|
-
# The response of the HTTP request.
|
1109
|
-
#
|
1110
|
-
# @see #http_request
|
1111
|
-
#
|
1112
|
-
# @api public
|
1113
|
-
#
|
1114
|
-
def http_unlock(options={},&block)
|
1115
|
-
response = http_request(options.merge(:method => :unlock))
|
1116
|
-
|
1117
|
-
yield response if block_given?
|
1118
|
-
return response
|
1119
|
-
end
|
1120
|
-
end
|
1121
|
-
end
|
1122
|
-
end
|