Class: Raptor::HttpParser
- Inherits:
-
Object
- Object
- Raptor::HttpParser
- Defined in:
- ext/raptor_http/raptor_http.c
Instance Method Summary collapse
- #body ⇒ Object
- #chunked? ⇒ Boolean
- #content_length ⇒ Object
- #execute(req_hash, buffer, start) ⇒ Object
- #finished? ⇒ Boolean
- #has_body? ⇒ Boolean
- #nread ⇒ Object
- #reset ⇒ Object
Instance Method Details
#body ⇒ Object
1313 1314 1315 1316 1317 |
# File 'ext/raptor_http/raptor_http.c', line 1313
static VALUE parser_body(VALUE self) {
raptor_parser *parser;
TypedData_Get_Struct(self, raptor_parser, &parser_type, parser);
return parser->body;
}
|
#chunked? ⇒ Boolean
1288 1289 1290 1291 1292 |
# File 'ext/raptor_http/raptor_http.c', line 1288
static VALUE parser_chunked_p(VALUE self) {
raptor_parser *parser;
TypedData_Get_Struct(self, raptor_parser, &parser_type, parser);
return raptor_parser_is_chunked(parser) ? Qtrue : Qfalse;
}
|
#content_length ⇒ Object
1294 1295 1296 1297 1298 |
# File 'ext/raptor_http/raptor_http.c', line 1294
static VALUE parser_content_length(VALUE self) {
raptor_parser *parser;
TypedData_Get_Struct(self, raptor_parser, &parser_type, parser);
return SIZET2NUM(raptor_parser_content_length(parser));
}
|
#execute(req_hash, buffer, start) ⇒ Object
1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 |
# File 'ext/raptor_http/raptor_http.c', line 1257
static VALUE parser_execute(VALUE self, VALUE req_hash, VALUE buffer, VALUE start) {
raptor_parser *parser;
TypedData_Get_Struct(self, raptor_parser, &parser_type, parser);
Check_Type(buffer, T_STRING);
parser->request = req_hash;
size_t from = NUM2SIZET(start);
const char *data = RSTRING_PTR(buffer);
size_t len = RSTRING_LEN(buffer);
if (from >= len)
rb_raise(eHttpParserError, "start is after buffer end");
raptor_parser_execute(parser, data + from, len - from);
return SIZET2NUM(parser->nread);
}
|
#finished? ⇒ Boolean
1276 1277 1278 1279 1280 |
# File 'ext/raptor_http/raptor_http.c', line 1276
static VALUE parser_finished_p(VALUE self) {
raptor_parser *parser;
TypedData_Get_Struct(self, raptor_parser, &parser_type, parser);
return raptor_parser_finished(parser) ? Qtrue : Qfalse;
}
|
#has_body? ⇒ Boolean
1282 1283 1284 1285 1286 |
# File 'ext/raptor_http/raptor_http.c', line 1282
static VALUE parser_has_body_p(VALUE self) {
raptor_parser *parser;
TypedData_Get_Struct(self, raptor_parser, &parser_type, parser);
return raptor_parser_has_body(parser) ? Qtrue : Qfalse;
}
|
#nread ⇒ Object
1300 1301 1302 1303 1304 |
# File 'ext/raptor_http/raptor_http.c', line 1300
static VALUE parser_nread(VALUE self) {
raptor_parser *parser;
TypedData_Get_Struct(self, raptor_parser, &parser_type, parser);
return SIZET2NUM(parser->nread);
}
|
#reset ⇒ Object
1306 1307 1308 1309 1310 1311 |
# File 'ext/raptor_http/raptor_http.c', line 1306
static VALUE parser_reset(VALUE self) {
raptor_parser *parser;
TypedData_Get_Struct(self, raptor_parser, &parser_type, parser);
raptor_parser_init(parser);
return Qnil;
}
|