def recv_data(sock, msg_len):
    """Receives data from HTTP connection

    Parameters:
        sock (socket): HTTP socket connection
        msg_len (int): Length of the message to receive

    Returns:
        str: The message

    """

    data = b''
    # Read the message data
    while len(data) < msg_len:
        packet = sock.recv(msg_len - len(data))
        if not packet:
            return None
        data += packet

    # Return undecoded message data
    return data