rhebok 0.8.3 → 0.8.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82469802f30b8a8f97eabdb2788ca97ad26e0c37
4
- data.tar.gz: ce03f4a2fc45f331ea3afc5d2513476ff85d65aa
3
+ metadata.gz: 63c847aca36084736ee20d2439a2a868f9cfdf09
4
+ data.tar.gz: 8a24d9b12665ace439784f2fe5d727da562a17b4
5
5
  SHA512:
6
- metadata.gz: b8003c3e601e61ae7c5340980bc2f504f72bd596fb7c9c9b288c27a7aa0a4e49df0f0bd9f2f05b133025f3be79ce50ce95aa7b4488c678a5614c7c1940269583
7
- data.tar.gz: f608aa9e2f220d276bc98ae3230ab751ea9962718d66cadeb4bc2eebaab012c184e0261de88df284beed5f17a71d93c577b909df03424cbd0688024ce9d8b7c0
6
+ metadata.gz: e77d3d23898445c851b65b945306c6fe19bdbe6af7332afa8578deca059e11d6204cb33aed2984492d9d05de2d0d682b89e4847bd831d2f958e0800b7bc8c942
7
+ data.tar.gz: 430031512ebf4a7a2054dabb651266738eef9ac6051a63b646f87a5b075d63a21ccfb263d2c67786091cf6d97cb9149f0f63b191f6062a0302f55571a5dd7f54
data/Changes CHANGED
@@ -1,3 +1,7 @@
1
+ 0.8.5 2015-01-26T02:23:08Z
2
+
3
+ - fix bug. send 0byte mark when using a non raw Array body
4
+
1
5
  0.8.3 2015-01-23T00:33:02Z
2
6
 
3
7
  - change default backlog to SOMAXCONN
@@ -708,7 +708,7 @@ VALUE rhe_close(VALUE self, VALUE fileno) {
708
708
  }
709
709
 
710
710
  static
711
- VALUE rhe_write_response(VALUE self, VALUE filenov, VALUE timeoutv, VALUE status_codev, VALUE headers, VALUE body, VALUE use_chunkedv) {
711
+ VALUE rhe_write_response(VALUE self, VALUE filenov, VALUE timeoutv, VALUE status_codev, VALUE headers, VALUE body, VALUE use_chunkedv, VALUE header_onlyv) {
712
712
  ssize_t hlen = 0;
713
713
  ssize_t blen = 0;
714
714
 
@@ -739,7 +739,13 @@ VALUE rhe_write_response(VALUE self, VALUE filenov, VALUE timeoutv, VALUE status
739
739
  double timeout = NUM2DBL(timeoutv);
740
740
  int status_code = NUM2INT(status_codev);
741
741
  int use_chunked = NUM2INT(use_chunkedv);
742
-
742
+ int header_only = NUM2INT(header_onlyv);
743
+
744
+ /* status_with_no_entity_body */
745
+ if ( status_code < 200 || status_code == 204 || status_code == 304 ) {
746
+ use_chunked = 0;
747
+ }
748
+
743
749
  harr = rb_ary_new();
744
750
  RB_GC_GUARD(harr);
745
751
  rb_hash_foreach(headers, header_to_array, harr);
@@ -870,7 +876,7 @@ VALUE rhe_write_response(VALUE self, VALUE filenov, VALUE timeoutv, VALUE status
870
876
  iovcnt++;
871
877
  }
872
878
  }
873
- if ( use_chunked ) {
879
+ if ( use_chunked && header_only == 0 ) {
874
880
  v[iovcnt].iov_base = "0\r\n\r\n";
875
881
  v[iovcnt].iov_len = sizeof("0\r\n\r\n") - 1;
876
882
  iovcnt++;
@@ -958,5 +964,5 @@ void Init_rhebok()
958
964
  rb_define_module_function(cRhebok, "write_timeout", rhe_write_timeout, 5);
959
965
  rb_define_module_function(cRhebok, "write_all", rhe_write_all, 4);
960
966
  rb_define_module_function(cRhebok, "close_rack", rhe_close, 1);
961
- rb_define_module_function(cRhebok, "write_response", rhe_write_response, 6);
967
+ rb_define_module_function(cRhebok, "write_response", rhe_write_response, 7);
962
968
  }
@@ -301,9 +301,9 @@ module Rack
301
301
  headers.key?("Content-Length") ? 0 : 1
302
302
 
303
303
  if body.instance_of?(Array)
304
- ::Rhebok.write_response(connection, @options[:Timeout], status_code.to_i, headers, body, use_chunked)
304
+ ::Rhebok.write_response(connection, @options[:Timeout], status_code.to_i, headers, body, use_chunked, 0)
305
305
  else
306
- ::Rhebok.write_response(connection, @options[:Timeout], status_code.to_i, headers, [], use_chunked)
306
+ ::Rhebok.write_response(connection, @options[:Timeout], status_code.to_i, headers, [], use_chunked, 1)
307
307
  body.each do |part|
308
308
  ret = nil
309
309
  if use_chunked == 1
@@ -1,3 +1,3 @@
1
1
  class Rhebok
2
- VERSION = "0.8.3"
2
+ VERSION = "0.8.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhebok
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Nagano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-22 00:00:00.000000000 Z
11
+ date: 2015-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler