sfml3.rb

Class: SFML::HttpRequest

Inherits:
Object
  • Object
show all
Defined in:
ext/network/http.c,
ext/network/http.c

Overview

An HTTP request to send via Http#send_request.

Instance Method Summary collapse

Constructor Details

#new ⇒ HttpRequest

Creates a new HTTP request.



176
177
178
# File 'ext/network/http.c', line 176

static VALUE HttpRequest_initialize(VALUE self) {
    return self;
}

Instance Method Details

#body=(value) ⇒ String

Sets the request body, used by POST/PUT requests; ignored for GET/HEAD.

Returns:

  • (String) —

    value



240
241
242
243
# File 'ext/network/http.c', line 240

static VALUE HttpRequest_set_body(VALUE self, VALUE rb_body) {
    sfHttpRequest_setBody(Get_HttpRequest_Struct(self), StringValueCStr(rb_body));
    return rb_body;
}

#method=(value) ⇒ Symbol, Integer

value is an HttpMethod name or value.

Returns:

  • (Symbol, Integer) —

    value



202
203
204
205
# File 'ext/network/http.c', line 202

static VALUE HttpRequest_set_method(VALUE self, VALUE rb_method) {
    sfHttpRequest_setMethod(Get_HttpRequest_Struct(self), http_method_from_rb(rb_method));
    return rb_method;
}

#set_field(field, value) ⇒ String

Sets the value of a header field, e.g. "Content-Type". Field names are case-insensitive. A few fields (Content-Length, Connection, User-Agent, Host) are managed automatically and overwritten before sending.

Returns:

  • (String) —

    value



189
190
191
192
193
# File 'ext/network/http.c', line 189

static VALUE HttpRequest_set_field(VALUE self, VALUE rb_field, VALUE rb_value) {
    sfHttpRequest_setField(Get_HttpRequest_Struct(self), StringValueCStr(rb_field),
                           StringValueCStr(rb_value));
    return rb_value;
}

#set_http_version(major, minor) ⇒ Array

Sets the HTTP protocol version used by the request.

Returns:

  • (Array)

Returns:

  • (Array(Integer, Integer)) —

    [major, minor]



226
227
228
229
230
231
# File 'ext/network/http.c', line 226

static VALUE HttpRequest_set_http_version(VALUE self, VALUE rb_major, VALUE rb_minor) {
    sfHttpRequest_setHttpVersion(Get_HttpRequest_Struct(self), (unsigned int)NUM2INT(rb_major),
                                 (unsigned int)NUM2INT(rb_minor));

    return rb_ary_new_from_args(2, rb_major, rb_minor);
}

#uri=(value) ⇒ String

Sets the request URI, e.g. "/index.html".

Returns:

  • (String) —

    value



214
215
216
217
# File 'ext/network/http.c', line 214

static VALUE HttpRequest_set_uri(VALUE self, VALUE rb_uri) {
    sfHttpRequest_setUri(Get_HttpRequest_Struct(self), StringValueCStr(rb_uri));
    return rb_uri;
}