Class: Libevent::Http

Inherits:
Object
  • Object
show all
Defined in:
lib/libevent/http.rb,
ext/libevent_ext/http.c

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeObject



7
# File 'ext/libevent_ext/http.c', line 7

static VALUE t_initialize(VALUE self, VALUE object);

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base



4
5
6
# File 'lib/libevent/http.rb', line 4

def base
  @base
end

Instance Method Details

#add_virtual_hostObject



17
# File 'ext/libevent_ext/http.c', line 17

static VALUE t_add_virtual_host(VALUE self, VALUE domain, VALUE vhttp);

#bind_socketObject



9
# File 'ext/libevent_ext/http.c', line 9

static VALUE t_bind_socket(VALUE self, VALUE address, VALUE port);

#handler(&block) ⇒ Object

Set request handler for current http instance

Parameters:

  • block


18
19
20
# File 'lib/libevent/http.rb', line 18

def handler(&block)
  set_request_handler(block)
end

#set_request_handlerObject



11
# File 'ext/libevent_ext/http.c', line 11

static VALUE t_set_request_handler(VALUE self, VALUE handler);

#set_timeoutObject



13
# File 'ext/libevent_ext/http.c', line 13

static VALUE t_set_timeout(VALUE self, VALUE timeout);

#vhost(domain) {|http| ... } ⇒ Http

Create virtual http server

Parameters:

  • domain (String)

    a domain for virtual server

Yields:

  • (http)

Returns:

  • (Http)

    http instance



9
10
11
12
13
14
# File 'lib/libevent/http.rb', line 9

def vhost(domain)
  http = self.class.new(self.base)
  add_virtual_host(domain, http)
  yield(http) if block_given?
  http
end