ruby-lsapi 3.4 → 3.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.
Files changed (3) hide show
  1. data/ext/lsapi/lsapilib.c +3 -1
  2. data/ext/lsapi/lsruby.c +16 -1
  3. metadata +6 -6
data/ext/lsapi/lsapilib.c CHANGED
@@ -602,7 +602,9 @@ int LSAPI_Init(void)
602
602
  #if defined(SIGXFSZ) && defined(SIG_IGN)
603
603
  signal(SIGXFSZ, SIG_IGN);
604
604
  #endif
605
-
605
+ /* let STDOUT function as STDERR,
606
+ just in case writing to STDOUT directly */
607
+ dup2( 2, 1 );
606
608
  if ( LSAPI_InitRequest( &g_req, LSAPI_SOCK_FILENO ) == -1 )
607
609
  return -1;
608
610
  g_inited = 1;
data/ext/lsapi/lsruby.c CHANGED
@@ -50,6 +50,7 @@ static lsapi_data * s_req_data;
50
50
 
51
51
  static VALUE s_req_stderr = Qnil;
52
52
  static lsapi_data * s_stderr_data;
53
+ static pid_t s_pid = 0;
53
54
 
54
55
  /*
55
56
  static void lsapi_ruby_setenv(const char *name, const char *value)
@@ -170,11 +171,19 @@ static void setup_cgi_env( lsapi_data * data )
170
171
 
171
172
  static VALUE lsapi_s_accept( VALUE self )
172
173
  {
173
-
174
+ int pid;
174
175
  if ( LSAPI_Prefork_Accept_r( &g_req ) == -1 )
175
176
  return Qnil;
176
177
  else
177
178
  {
179
+
180
+ pid = getpid();
181
+ if ( pid != s_pid )
182
+ {
183
+ s_pid = pid;
184
+ rb_funcall( Qnil, rb_intern( "srand" ), 0 );
185
+ }
186
+
178
187
  setup_cgi_env( s_req_data );
179
188
  return s_req;
180
189
  }
@@ -523,6 +532,8 @@ void Init_lsapi()
523
532
 
524
533
  LSAPI_Init_Env_Parameters( rb_thread_select );
525
534
 
535
+ s_pid = getpid();
536
+
526
537
  p = getenv( "RAILS_ROOT" );
527
538
  if ( p )
528
539
  {
@@ -570,6 +581,10 @@ void Init_lsapi()
570
581
  rb_define_method(cLSAPI, "getc", lsapi_getc, 0);
571
582
  /* rb_define_method(cLSAPI, "ungetc", lsapi_ungetc, 1); */
572
583
  rb_define_method(cLSAPI, "gets", lsapi_gets, 0);
584
+
585
+ //TEST: adding readline function to make irb happy?
586
+ /*rb_define_method(cLSAPI, "readline", lsapi_gets, 0); */
587
+
573
588
  rb_define_method(cLSAPI, "read", lsapi_read, -1);
574
589
  rb_define_method(cLSAPI, "eof", lsapi_eof, 0);
575
590
  rb_define_method(cLSAPI, "eof?", lsapi_eof, 0);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsapi
3
3
  version: !ruby/object:Gem::Version
4
- version: "3.4"
4
+ version: "3.5"
5
5
  platform: ruby
6
6
  authors:
7
7
  - LiteSpeed Technologies Inc.
@@ -9,12 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-23 00:00:00 -04:00
12
+ date: 2009-05-14 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
16
  description:
17
- email:
17
+ email: info@litespeedtech.com
18
18
  executables: []
19
19
 
20
20
  extensions:
@@ -39,7 +39,7 @@ files:
39
39
  - scripts/lsruby_runner.rb
40
40
  - setup.rb
41
41
  has_rdoc: false
42
- homepage:
42
+ homepage: http://www.litespeedtech.com/
43
43
  post_install_message:
44
44
  rdoc_options: []
45
45
 
@@ -59,8 +59,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  version:
60
60
  requirements: []
61
61
 
62
- rubyforge_project:
63
- rubygems_version: 1.1.1
62
+ rubyforge_project: ruby-lsapi
63
+ rubygems_version: 1.3.1
64
64
  signing_key:
65
65
  specification_version: 2
66
66
  summary: A ruby extension for fast communication with LiteSpeed Web Server.