Method: ActionController::Live::Buffer#write

Defined in:
actionpack/lib/action_controller/metal/live.rb

#write(string) ⇒ Object



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'actionpack/lib/action_controller/metal/live.rb', line 180

def write(string)
  unless @response.committed?
    @response.headers["Cache-Control"] ||= "no-cache"
    @response.delete_header "Content-Length"
  end

  super

  unless connected?
    @buf.clear

    unless @ignore_disconnect
      # Raise ClientDisconnected, which is a RuntimeError (not an IOError), because
      # that's more appropriate for something beyond the developer's control.
      raise ClientDisconnected, "client disconnected"
    end
  end
end