end
bodies=AMF.getint(req) # Read number of bodies
- render :content_type => "application/x-amf", :text => proc { |response, output|
+
+ self.status = :ok
+ self.content_type = Mime::AMF
+ self.response_body = proc { |response, output|
a,b=bodies.divmod(256)
output.write 0.chr+0.chr+0.chr+0.chr+a.chr+b.chr
bodies.times do # Read each body
end
bodies=AMF.getint(req) # Read number of bodies
- render :content_type => "application/x-amf", :text => proc { |response, output|
+
+ self.status = :ok
+ self.content_type = Mime::AMF
+ self.response_body = proc { |response, output|
a,b=bodies.divmod(256)
output.write 0.chr+0.chr+0.chr+0.chr+a.chr+b.chr
bodies.times do # Read each body
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
+Mime::Type.register "application/x-amf", :amf
# The result is a hash of message_ref => data.
# The attribute @amf_result is initialised to this hash.
def amf_parse_response
- if @response.body.class.to_s == 'Proc'
- res = StringIO.new()
- @response.body.call @response, res
- req = StringIO.new(res.string)
- else
- req = StringIO.new(@response.body)
- end
+ req = StringIO.new(@response.body)
+
req.read(2) # version
# parse through any headers