387: def process_body
388:
389:
390:
391: if @bytes_remaining.nil?
392: on_error "no content length specified"
393: @state = :invalid
394: end
395:
396: if @data.size < @bytes_remaining
397: @bytes_remaining -= @data.size
398: on_body_data @data.read
399: return false
400: end
401:
402: on_body_data @data.read(@bytes_remaining)
403: @bytes_remaining = 0
404:
405: if @data.empty?
406: on_request_complete
407: @state = :finished
408: else
409: on_error "garbage at end of body"
410: @state = :invalid
411: end
412:
413: false
414: end