    # File lib/phusion_passenger/message_channel.rb, line 151
            def read_hash
                    buffer = new_buffer
                    if !@io.read(HEADER_SIZE, buffer)
                            return nil
                    end
                    while buffer.size < HEADER_SIZE
                            tmp = @io.read(HEADER_SIZE - buffer.size)
                            if tmp.empty?
                                    return nil
                            else
                                    buffer << tmp
                            end
                    end

                    chunk_size = buffer.unpack(UINT16_PACK_FORMAT)[0]
                    if !@io.read(chunk_size, buffer)
                            return nil
                    end
                    while buffer.size < chunk_size
                            tmp = @io.read(chunk_size - buffer.size)
                            if tmp.empty?
                                    return nil
                            else
                                    buffer << tmp
                            end
                    end

                    result = {}
                    offset = 0
                    delimiter_pos = buffer.index(DELIMITER, offset)
                    while !delimiter_pos.nil?
                            if delimiter_pos == 0
                                    name = ""
                            else
                                    name = buffer[offset .. delimiter_pos - 1]
                            end

                            offset = delimiter_pos + 1
                            delimiter_pos = buffer.index(DELIMITER, offset)
                            if delimiter_pos.nil?
                                    raise InvalidHashError
                            elsif delimiter_pos == 0
                                    value = ""
                            else
                                    value = buffer[offset .. delimiter_pos - 1]
                            end

                            result[name] = value
                            offset = delimiter_pos + 1
                            delimiter_pos = buffer.index(DELIMITER, offset)
                    end
                    return result
            rescue Errno::ECONNRESET
                    return nil
            end