bossan 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/bossan/bossan_ext.c +9 -25
- data/lib/bossan/version.rb +1 -1
- metadata +1 -1
data/ext/bossan/bossan_ext.c
CHANGED
@@ -50,7 +50,7 @@
|
|
50
50
|
|
51
51
|
#define MSG_413 ("HTTP/1.0 413 Request Entity Too Large\r\nContent-Type: text/html\r\nServer: " SERVER "\r\n\r\n<html><head><title>Request Entity Too Large</title></head><body><p>Request Entity Too Large.</p></body></html>")
|
52
52
|
|
53
|
-
#define SERVER "bossan/0.1.
|
53
|
+
#define SERVER "bossan/0.1.8"
|
54
54
|
|
55
55
|
VALUE server; // Bossan
|
56
56
|
|
@@ -96,6 +96,8 @@ static VALUE i_new;
|
|
96
96
|
static VALUE i_key;
|
97
97
|
static VALUE i_each;
|
98
98
|
static VALUE i_close;
|
99
|
+
static VALUE i_write;
|
100
|
+
static VALUE i_seek;
|
99
101
|
|
100
102
|
static const char *server_name = "127.0.0.1";
|
101
103
|
static short server_port = 8000;
|
@@ -538,26 +540,6 @@ write_headers(client_t *client)
|
|
538
540
|
}
|
539
541
|
|
540
542
|
|
541
|
-
/* static int */
|
542
|
-
/* write_sendfile(int out_fd, int in_fd, size_t count) */
|
543
|
-
/* { */
|
544
|
-
/* int size = (int)count; */
|
545
|
-
|
546
|
-
/* if (size == 0) { */
|
547
|
-
/* struct stat info; */
|
548
|
-
/* if (fstat(in_fd, &info) == -1){ */
|
549
|
-
/* // TODO: */
|
550
|
-
/* // raise exception from errno */
|
551
|
-
/* /\* rb_raise(); *\/ */
|
552
|
-
/* /\* write_error_log(__FILE__, __LINE__); *\/ */
|
553
|
-
/* return -1; */
|
554
|
-
/* } */
|
555
|
-
/* size = info.st_size - lseek(in_fd, 0, SEEK_CUR); */
|
556
|
-
/* } */
|
557
|
-
/* return sendfile(out_fd, in_fd, NULL, count); */
|
558
|
-
/* } */
|
559
|
-
|
560
|
-
|
561
543
|
static void
|
562
544
|
close_response(client_t *client)
|
563
545
|
{
|
@@ -746,7 +728,7 @@ write_body2mem(client_t *client, const char *buffer, size_t buffer_len)
|
|
746
728
|
VALUE obj;
|
747
729
|
/* printf("body2mem called\n"); */
|
748
730
|
|
749
|
-
rb_funcall((VALUE)client->body,
|
731
|
+
rb_funcall((VALUE)client->body, i_write, 1, rb_str_new(buffer, buffer_len));
|
750
732
|
client->body_readed += buffer_len;
|
751
733
|
#ifdef DEBUG
|
752
734
|
printf("write_body2mem %d bytes \n", buffer_len);
|
@@ -1514,15 +1496,13 @@ prepare_call_rack(client_t *client)
|
|
1514
1496
|
char *val;
|
1515
1497
|
|
1516
1498
|
if(client->body_type == BODY_TYPE_BUFFER) {
|
1517
|
-
|
1518
|
-
rb_p( rb_funcall((VALUE)client->body, rb_intern("seek"), 1, INT2NUM(0)) );
|
1499
|
+
rb_funcall((VALUE)client->body, i_seek, 1, INT2NUM(0));
|
1519
1500
|
rb_hash_aset(client->environ, rack_input, (VALUE)client->body);
|
1520
1501
|
} else {
|
1521
1502
|
object = rb_str_new2("");
|
1522
1503
|
input = rb_funcall(StringIO, i_new, 1, object);
|
1523
1504
|
rb_gc_register_address(&input);
|
1524
1505
|
rb_hash_aset(client->environ, rack_input, input);
|
1525
|
-
/* client->body = object; */
|
1526
1506
|
client->body = input;
|
1527
1507
|
}
|
1528
1508
|
|
@@ -1985,6 +1965,8 @@ Init_bossan_ext(void)
|
|
1985
1965
|
rb_gc_register_address(&i_key);
|
1986
1966
|
rb_gc_register_address(&i_each);
|
1987
1967
|
rb_gc_register_address(&i_close);
|
1968
|
+
rb_gc_register_address(&i_write);
|
1969
|
+
rb_gc_register_address(&i_seek);
|
1988
1970
|
|
1989
1971
|
rb_gc_register_address(&rack_app); //rack app
|
1990
1972
|
|
@@ -1994,6 +1976,8 @@ Init_bossan_ext(void)
|
|
1994
1976
|
i_key = rb_intern("key?");
|
1995
1977
|
i_each = rb_intern("each");
|
1996
1978
|
i_close = rb_intern("close");
|
1979
|
+
i_write = rb_intern("write");
|
1980
|
+
i_seek = rb_intern("seek");
|
1997
1981
|
|
1998
1982
|
server = rb_define_module("Bossan");
|
1999
1983
|
rb_gc_register_address(&server);
|
data/lib/bossan/version.rb
CHANGED