ruby-lsapi 1.11 → 1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/ext/lsapi/lsapilib.c +1 -1
  2. data/ext/lsapi/lsruby.c +14 -5
  3. metadata +2 -2
data/ext/lsapi/lsapilib.c CHANGED
@@ -835,7 +835,7 @@ int LSAPI_ReadReqBody_r( LSAPI_Request * pReq, char * pBuf, int bufLen )
835
835
  pBuf += len;
836
836
  bufLen -= len;
837
837
  }
838
- else if ( len < 0 )
838
+ else if ( len <= 0 )
839
839
  if ( !total)
840
840
  return -1;
841
841
  }
data/ext/lsapi/lsruby.c CHANGED
@@ -577,6 +577,8 @@ static VALUE lsapi_getc( VALUE self )
577
577
  rb_raise(rb_eSecurityError, "Insecure: operation on untainted IO");
578
578
  }
579
579
  ch = LSAPI_ReqBodyGetChar_r( &g_req );
580
+ if ( ch == EOF )
581
+ return Qnil;
580
582
  return INT2NUM( ch );
581
583
  }
582
584
 
@@ -590,6 +592,8 @@ static VALUE lsapi_gets( VALUE self )
590
592
  {
591
593
  rb_raise(rb_eSecurityError, "Insecure: operation on untainted IO");
592
594
  }
595
+ if ( LSAPI_GetReqBodyRemain_r( &g_req ) <= 0 )
596
+ return Qnil;
593
597
  str = rb_str_buf_new( 1024 );
594
598
  OBJ_TAINT(str);
595
599
  while( !getLF )
@@ -606,7 +610,7 @@ static VALUE lsapi_gets( VALUE self )
606
610
  static VALUE lsapi_read(int argc, VALUE *argv, VALUE self)
607
611
  {
608
612
  VALUE str;
609
- lsapi_data *data;
613
+ //lsapi_data *data;
610
614
  int n;
611
615
  int remain;
612
616
  char buff[8192];
@@ -616,9 +620,9 @@ static VALUE lsapi_read(int argc, VALUE *argv, VALUE self)
616
620
  rb_raise(rb_eSecurityError, "Insecure: operation on untainted IO");
617
621
  }
618
622
 
619
- Data_Get_Struct(self, lsapi_data, data);
623
+ //Data_Get_Struct(self, lsapi_data, data);
620
624
 
621
- remain = LSAPI_GetReqBodyRemain();
625
+ remain = LSAPI_GetReqBodyRemain_r( &g_req );
622
626
  if ( remain <= 0 )
623
627
  return Qnil;
624
628
  if (argc != 0)
@@ -631,7 +635,7 @@ static VALUE lsapi_read(int argc, VALUE *argv, VALUE self)
631
635
  OBJ_TAINT(str);
632
636
  while( remain > 0 )
633
637
  {
634
- n = LSAPI_ReadReqBody_r(data->req, buff,
638
+ n = LSAPI_ReadReqBody_r(&g_req, buff,
635
639
  (remain > 8192)?8192:remain );
636
640
  if ( n > 0 )
637
641
  {
@@ -730,7 +734,12 @@ void Init_lsapi()
730
734
  s_ppid = getppid();
731
735
  else
732
736
  ruby_unsetenv( "LSAPI_PPID_NO_CHECK" );
733
- if ( getenv( "RAILS_ROOT" )||getenv( "RAILS_ENV" ) )
737
+ p = getenv( "RAILS_ROOT" );
738
+ if ( p )
739
+ {
740
+ chdir( p );
741
+ }
742
+ if ( p || getenv( "RAILS_ENV" ) )
734
743
  s_fn_add_env = add_env_rails;
735
744
 
736
745
  orig_stdin = rb_stdin;
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: ruby-lsapi
5
5
  version: !ruby/object:Gem::Version
6
- version: "1.11"
7
- date: 2006-10-05 00:00:00 -04:00
6
+ version: "1.12"
7
+ date: 2007-01-08 00:00:00 -05:00
8
8
  summary: A ruby extension for fast communication with LiteSpeed Web Server.
9
9
  require_paths:
10
10
  - lib