# File lib/protocols/header_and_content.rb, line 46
46:             def receive_line line
47:                 case @hc_mode
48:                 when :discard_blanks
49:                     unless line == ""
50:                         @hc_mode = :headers
51:                         receive_line line
52:                     end
53:                 when :headers
54:                     if line == ""
55:                         raise "unrecognized state" unless @hc_headers.length > 0
56:                         if respond_to?(:receive_headers)
57:                             receive_headers @hc_headers
58:                         end
59:                         # @hc_content_length will be nil, not 0, if there was no content-length header.
60:                         if @hc_content_length.to_i > 0
61:                             set_binary_mode @hc_content_length
62:                         else
63:                             dispatch_request
64:                         end
65:                     else
66:                         @hc_headers << line
67:                         if ContentLengthPattern =~ line
68:                             # There are some attacks that rely on sending multiple content-length
69:                             # headers. This is a crude protection, but needs to become tunable.
70:                             raise "extraneous content-length header" if @hc_content_length
71:                             @hc_content_length = $1.to_i
72:                         end
73:                         if @hc_headers.length == 1 and respond_to?(:receive_first_header_line)
74:                             receive_first_header_line line
75:                         end
76:                     end
77:                 else
78:                     raise "internal error, unsupported mode"
79:                 end
80:             end