Skip to content

Commit ff134a5

Browse files
author
botanicus
committed
Working on test_response_limit, but first we have to fix the disconnect_timer.
1 parent 24c6fa1 commit ff134a5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/sockjs/session.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ def wait(response, interval = 0.1)
243243
end
244244
end
245245

246+
def max_permitted_content_length
247+
$DEBUG ? 4096 : 128_000
248+
end
249+
246250
def run_user_app(response)
247251
puts "~ Executing user's SockJS app"
248252
frame = self.process_buffer(false)
@@ -257,6 +261,11 @@ def init_periodic_timer(response, interval)
257261

258262
unless @received_messages.empty?
259263
run_user_app(response)
264+
265+
if @total_received_content_length <= max_permitted_content_length
266+
# Close the response without writing any closing frame.
267+
self.finish
268+
end
260269
end
261270
end
262271
end

0 commit comments

Comments
 (0)