Class: TestServer::StreamingController
Instance Method Summary
collapse
Methods included from WebHelper
#configure_caching, #encode, #generate_eicar, #generate_random_string, #generate_string
Instance Method Details
#eicar ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/test_server/streaming_controller.rb', line 23
def eicar
generate_eicar.each do |c|
response.stream.write(
encode(params) { c }
)
sleep(params[:wait].to_f / 1_000.0)
end
response.stream.close
end
|
#index ⇒ Object
9
10
|
# File 'app/controllers/test_server/streaming_controller.rb', line 9
def index
end
|
#plain ⇒ Object
12
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/test_server/streaming_controller.rb', line 12
def plain
params[:count].to_i.times do |n|
response.stream.write(
encode(params) { "#{n + 1}: data" }
)
sleep(params[:wait].to_f / 1_000.0)
end
response.stream.close
end
|
#random ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
|
# File 'app/controllers/test_server/streaming_controller.rb', line 35
def random
params[:count].to_i.times do |n|
response.stream.write(
encode(params) { generate_random_string(1) }
)
sleep(params[:wait].to_f / 1_000.0)
end
response.stream.close
end
|