# XMLRPC::CGIServer (Class)

In: | xmlrpc/server.rb
Parent: | BasicServer

## Methods

new new serve

## Public Class methods

new(*a)

[Source]

    # File xmlrpc/server.rb, line 437
      def CGIServer.new(*a)
        @@obj = super(*a) if @@obj.nil?
        @@obj
      end

new(*a)

[Source]

    # File xmlrpc/server.rb, line 442
      def initialize(*a)
        super(*a)
      end

## Public Instance methods

serve()

[Source]

    # File xmlrpc/server.rb, line 446
      def serve
        catch(:exit_serve) {
          length = ENV['CONTENT_LENGTH'].to_i

          http_error(405, "Method Not Allowed") unless ENV['REQUEST_METHOD'] == "POST"
          http_error(400, "Bad Request")        unless ENV['CONTENT_TYPE'] == "text/xml"
          http_error(411, "Length Required")    unless length > 0

          # TODO: do we need a call to binmode?

          $stdin.binmode if $stdin.respond_to? :binmode
          data = $stdin.read(length)

          http_error(400, "Bad Request")        if data.nil? or data.size != length

          http_write(process(data), "Content-type" => "text/xml")
        }
      end

[Validate]