hprose 1.4.9 → 1.4.10

Sign up to get free protection for your applications and to get access to all the features.
data/lib/hprose/client.rb CHANGED
@@ -14,7 +14,7 @@
14
14
  # #
15
15
  # hprose client for ruby #
16
16
  # #
17
- # LastModified: Mar 11, 2014 #
17
+ # LastModified: Mar 19, 2014 #
18
18
  # Author: Ma Bingyao <andot@hprose.com> #
19
19
  # #
20
20
  ############################################################
@@ -113,12 +113,12 @@ module Hprose
113
113
  writer.write_boolean(true) if byref
114
114
  end
115
115
  stream.putc(TagEnd)
116
- data = @filter.output_filter(stream.string)
116
+ data = @filter.output_filter(stream.string, self)
117
117
  stream.close
118
118
  return data
119
119
  end
120
120
  def do_input(data, args, resultMode)
121
- data = @filter.input_filter(data)
121
+ data = @filter.input_filter(data, self)
122
122
  raise Exception.exception("Wrong Response: \r\n#{data}") if data.nil? or data.empty? or data[data.size - 1].ord != TagEnd
123
123
  return data if resultMode == RawWithEndTag
124
124
  return data.chop! if resultMode == Raw
data/lib/hprose/common.rb CHANGED
@@ -14,7 +14,7 @@
14
14
  # #
15
15
  # hprose common library for ruby #
16
16
  # #
17
- # LastModified: Dec 2, 2012 #
17
+ # LastModified: Mar 19, 2014 #
18
18
  # Author: Ma Bingyao <andot@hprose.com> #
19
19
  # #
20
20
  ############################################################
@@ -30,10 +30,10 @@ module Hprose
30
30
  end
31
31
 
32
32
  class Filter
33
- def input_filter(data)
33
+ def input_filter(data, context)
34
34
  return data
35
35
  end
36
- def output_filter(data)
36
+ def output_filter(data, context)
37
37
  return data
38
38
  end
39
39
  end
@@ -14,7 +14,7 @@
14
14
  # #
15
15
  # hprose http service for ruby #
16
16
  # #
17
- # LastModified: Mar 12, 2014 #
17
+ # LastModified: Mar 19, 2014 #
18
18
  # Author: Ma Bingyao <andot@hprose.com> #
19
19
  # #
20
20
  ############################################################
@@ -85,7 +85,7 @@ module Hprose
85
85
  body = ''
86
86
  begin
87
87
  if (context['REQUEST_METHOD'] == 'GET') and @get then
88
- body = do_function_list
88
+ body = do_function_list(context)
89
89
  elsif (context['REQUEST_METHOD'] == 'POST') then
90
90
  body = handle(context['rack.input'].read, context)
91
91
  else
@@ -14,7 +14,7 @@
14
14
  # #
15
15
  # hprose service for ruby #
16
16
  # #
17
- # LastModified: Mar 12, 2014 #
17
+ # LastModified: Mar 19, 2014 #
18
18
  # Author: Ma Bingyao <andot@hprose.com> #
19
19
  # #
20
20
  ############################################################
@@ -238,8 +238,8 @@ module Hprose
238
238
  add_functions(methods, aliases, resultMode, simple)
239
239
  end
240
240
  protected
241
- def response_end(ostream)
242
- data = @filter.output_filter(ostream.string)
241
+ def response_end(ostream, context)
242
+ data = @filter.output_filter(ostream.string, context)
243
243
  ostream.close
244
244
  return data
245
245
  end
@@ -286,7 +286,7 @@ module Hprose
286
286
  ostream.putc(TagError)
287
287
  writer.write_string(error)
288
288
  ostream.putc(TagEnd)
289
- return response_end(ostream)
289
+ return response_end(ostream, context)
290
290
  end
291
291
  def do_invoke(istream, context)
292
292
  simpleReader = Reader.new(istream, true)
@@ -343,26 +343,26 @@ module Hprose
343
343
  end
344
344
  end while tag == TagCall
345
345
  ostream.putc(TagEnd)
346
- return response_end(ostream)
346
+ return response_end(ostream, context)
347
347
  end
348
- def do_function_list()
348
+ def do_function_list(context)
349
349
  ostream = StringIO.new
350
350
  writer = Writer.new(ostream, true)
351
351
  ostream.putc(TagFunctions)
352
352
  writer.write_list(@funcNames.values)
353
353
  ostream.putc(TagEnd)
354
- return response_end(ostream)
354
+ return response_end(ostream, context)
355
355
  end
356
356
  def handle(data, context)
357
357
  istream = nil
358
358
  begin
359
- data = @filter.input_filter(data)
359
+ data = @filter.input_filter(data, context)
360
360
  raise Exception.exception("Wrong Request: \r\n#{data}") if data.nil? or data.empty? or data[data.size - 1].ord != TagEnd
361
361
  istream = StringIO.new(data, 'rb')
362
362
  tag = istream.getbyte
363
363
  case tag
364
364
  when TagCall then return do_invoke(istream, context)
365
- when TagEnd then return do_function_list
365
+ when TagEnd then return do_function_list(context)
366
366
  else raise Exception.exception("Wrong Request: \r\n#{data}")
367
367
  end
368
368
  rescue ::Interrupt => e
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hprose
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.9
4
+ version: 1.4.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-12 00:00:00.000000000 Z
12
+ date: 2014-03-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! " Hprose is a High Performance Remote Object Service Engine.\n\n It
15
15
  is a modern, lightweight, cross-language, cross-platform, object-oriented, high