function pugpig_set_custom_post_headers()
{
    pugpig_remove_wordpress_headers();
    global $post;
    if (isset($post) && is_single()) {
        pugpig_set_cache_headers(pugpig_get_page_modified($post), pugpig_get_content_ttl());
    }
    // Set the headers for upstream auth
    $x_entitlement = pugpig_get_post_entitlement_header($post);
    if (!empty($x_entitlement)) {
        header('X-Pugpig-Entitlement: ' . $x_entitlement);
    }
}
function package_edition_package_list($edition)
{
    $edition_tag = pugpig_get_full_edition_key($edition);
    $wp_ud_arr = wp_upload_dir();
    if ($edition->post_status == 'publish') {
        $cdn = get_option('pugpig_opt_cdn_domain');
    } else {
        $cdn = '';
    }
    $xml = _package_edition_package_list_xml(PUGPIG_MANIFESTPATH . 'packages/', $edition_tag, pugpig_strip_domain($wp_ud_arr['baseurl']) . '/pugpig-api/packages/', $cdn, 'string', '*', PUGPIG_ATOM_FILE_NAME);
    if (is_null($xml)) {
        header('HTTP/1.0 404 Not Found');
        echo "This page does not exist. Maybe edition {$edition_tag} has no packages.";
        exit;
    }
    pugpig_remove_wordpress_headers();
    $modified = get_edition_package_timestamp($edition->ID);
    if ($edition->post_status != 'publish') {
        header('X-Pugpig-Status: unpublished');
        pugpig_set_cache_headers($modified, 0);
    } else {
        header('X-Pugpig-Status: published');
        pugpig_set_cache_headers($modified, pugpig_get_feed_ttl());
    }
    $x_entitlement = pugpig_get_edition_entitlement_header($edition);
    if (!empty($x_entitlement)) {
        header('X-Pugpig-Entitlement: ' . $x_entitlement);
    }
    header('Content-Type: application/pugpigpkg+xml; charset=utf-8');
    header('Content-Disposition: inline');
    print $xml;
    return NULL;
}