hprose 1.4.8 → 1.4.9
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.
- data/lib/hprose/httpservice.rb +4 -1
- data/lib/hprose/service.rb +5 -5
- metadata +1 -1
data/lib/hprose/httpservice.rb
CHANGED
@@ -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
|
data/lib/hprose/service.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|