52: def set_response(response, result, status = 200)
53:
54:
55:
56: if status < 300
57: unless result.is_a?(File)
58: response.start(status) { |head, body| body.write(result) }
59: else
60: response.start(status) { |head, body| }
61: response.send_status(result.stat.size)
62: response.send_header
63: response.send_file(result.path)
64: end
65: else
66: begin
67: response.start(status,false,result) { |head, body| body.write(result) }
68: rescue ArgumentError
69: response.start(status) { |head, body| body.write(result) }
70: end
71: end
72: end