Sha256: 17e0e57184613a80b99df70b6135765f33c28c757e5010c40c850387816f5729

Contents?: true

Size: 1.7 KB

Versions: 1

Compression:

Stored size: 1.7 KB

Contents

module Mooro
  module Plugin
    # A rudimentary HTTP server based off of gserver/xmlrpc.rb with
    # bits of WEBRICK sprinkled in where xmlrpc is incorrect
    # It serves more of a demonstration purpose although it can suit
    # small internal applications.
    module HTTP
      CRLF: ::String

      HTTP_PROTO: ::String

      SERVER_NAME: ::String

      DEFAULT_HEADER: Hash[String, String]

      STATUS_CODE_MAPPING: ::Hash[Integer, String]

      def serve: (TCPSocket io) -> void

      def request_handler: (Request request) -> Response

      private

      def parse_header: (TCPSocket io) -> Header?

      class Header < Hash[String, String]
        DEFAULT_HEADER: Hash[String, String]

        def to_s: () -> String

        private

        def export: () -> Header

        def http_time: (untyped time) -> String
      end

      class Request
        attr_reader data: IO
        attr_reader header: Header
        attr_reader method: String
        attr_reader path: String
        attr_reader proto: String

        def initialize: (IO data, Header header, String method, String path, String proto) -> void
        def self.[]: (IO data, Header header, String method, String path, String proto) -> Request
        def content_length: () -> Integer?
      end

      class Response
        attr_reader status_code: Integer
        attr_reader status_message: String
        attr_reader header: Header
        attr_reader body: String

        def initialize: (Integer status_code, ?String status_message, ?Header header, ?String body) -> void

        def self.[]: (Integer status_code, ?String status_message, ?Header header, ?String body) -> Response

        def to_s: () -> String
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mooro-0.1.0 sig/mooro/http.rbs