hprose 1.4.8 → 1.4.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,6 +34,8 @@ module Hprose
34
34
  @client_access_policy_xml_file = nil
35
35
  @client_access_policy_xml_content = nil
36
36
  @on_send_header = nil
37
+ @last_modified = Date.today.strftime("%a, %d %b %Y %H:%M:%S GMT")
38
+ @etag = format('"%x:%x"', rand(2147483647), rand(2147483647))
37
39
  end
38
40
  attr_accessor :crossdomain
39
41
  attr_accessor :p3p
@@ -79,8 +81,9 @@ module Hprose
79
81
  return result if result
80
82
  end
81
83
  header = default_header(context)
84
+ statuscode = 200
85
+ body = ''
82
86
  begin
83
- statuscode = 200
84
87
  if (context['REQUEST_METHOD'] == 'GET') and @get then
85
88
  body = do_function_list
86
89
  elsif (context['REQUEST_METHOD'] == 'POST') then
@@ -295,7 +295,6 @@ module Hprose
295
295
  aliasname = name.downcase
296
296
  args = []
297
297
  byref = false
298
- result = nil
299
298
  tag = simpleReader.check_tags([TagList, TagCall, TagEnd])
300
299
  if tag == TagList then
301
300
  reader = Reader.new(istream)
@@ -324,8 +323,7 @@ module Hprose
324
323
  fire_after_invoke_event(name, args, byref, result, context)
325
324
  ostream = StringIO.new
326
325
  if resultMode == RawWithEndTag then
327
- ostream.write(result)
328
- return response_end(ostream)
326
+ return @filter.output_filter(result)
329
327
  elsif resultMode == Raw then
330
328
  ostream.write(result)
331
329
  else
@@ -337,14 +335,14 @@ module Hprose
337
335
  writer = Writer.new(ostream, simple)
338
336
  writer.serialize(result)
339
337
  if byref then
340
- writer.stream.putc(TagArgument)
338
+ ostream.putc(TagArgument)
341
339
  writer.reset
342
340
  writer.write_list(args)
343
341
  end
344
342
  end
345
343
  end
346
344
  end while tag == TagCall
347
- writer.stream.putc(TagEnd)
345
+ ostream.putc(TagEnd)
348
346
  return response_end(ostream)
349
347
  end
350
348
  def do_function_list()
@@ -356,6 +354,7 @@ module Hprose
356
354
  return response_end(ostream)
357
355
  end
358
356
  def handle(data, context)
357
+ istream = nil
359
358
  begin
360
359
  data = @filter.input_filter(data)
361
360
  raise Exception.exception("Wrong Request: \r\n#{data}") if data.nil? or data.empty? or data[data.size - 1].ord != TagEnd
@@ -366,6 +365,7 @@ module Hprose
366
365
  when TagEnd then return do_function_list
367
366
  else raise Exception.exception("Wrong Request: \r\n#{data}")
368
367
  end
368
+ rescue ::Interrupt => e
369
369
  rescue ::Exception => e
370
370
  return do_error(e, context)
371
371
  ensure
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.8
4
+ version: 1.4.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: