/* rygel-http-get.c generated by valac 0.56.1, the Vala compiler
 * generated from rygel-http-get.vala, do not modify */

/*
 * Copyright (C) 2008-2010 Nokia Corporation.
 * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd.
 * Copyright (C) 2012 Intel Corporation.
 * Copyright (C) 2013 Cable Television Laboratories, Inc.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *                               <zeeshan.ali@nokia.com>
 *         Jorn Baayen <jorn.baayen@gmail.com>
 *         Jens Georg <jensg@openismus.com>
 *         Craig Pratt <craig@ecaspia.com>
 *         Parthiban Balasubramanian <P.Balasubramanian-contractor@cablelabs.com>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include "rygel-server.h"
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <libsoup/soup.h>
#include <glib/gi18n-lib.h>
#include <glib-object.h>
#include "rygel-core.h"
#include <gee.h>

#define RYGEL_HTTP_GET_TRANSFER_MODE_HEADER "transferMode.dlna.org"

enum  {
	RYGEL_HTTP_GET_0_PROPERTY,
	RYGEL_HTTP_GET_NUM_PROPERTIES
};
static GParamSpec* rygel_http_get_properties[RYGEL_HTTP_GET_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define RYGEL_TYPE_HTTP_MEDIA_RESOURCE_HANDLER (rygel_http_media_resource_handler_get_type ())
#define RYGEL_HTTP_MEDIA_RESOURCE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_HTTP_MEDIA_RESOURCE_HANDLER, RygelHTTPMediaResourceHandler))
#define RYGEL_HTTP_MEDIA_RESOURCE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_HTTP_MEDIA_RESOURCE_HANDLER, RygelHTTPMediaResourceHandlerClass))
#define RYGEL_IS_HTTP_MEDIA_RESOURCE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_HTTP_MEDIA_RESOURCE_HANDLER))
#define RYGEL_IS_HTTP_MEDIA_RESOURCE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_HTTP_MEDIA_RESOURCE_HANDLER))
#define RYGEL_HTTP_MEDIA_RESOURCE_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_HTTP_MEDIA_RESOURCE_HANDLER, RygelHTTPMediaResourceHandlerClass))

typedef struct _RygelHTTPMediaResourceHandler RygelHTTPMediaResourceHandler;
typedef struct _RygelHTTPMediaResourceHandlerClass RygelHTTPMediaResourceHandlerClass;

#define RYGEL_TYPE_HTTP_THUMBNAIL_HANDLER (rygel_http_thumbnail_handler_get_type ())
#define RYGEL_HTTP_THUMBNAIL_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_HTTP_THUMBNAIL_HANDLER, RygelHTTPThumbnailHandler))
#define RYGEL_HTTP_THUMBNAIL_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_HTTP_THUMBNAIL_HANDLER, RygelHTTPThumbnailHandlerClass))
#define RYGEL_IS_HTTP_THUMBNAIL_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_HTTP_THUMBNAIL_HANDLER))
#define RYGEL_IS_HTTP_THUMBNAIL_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_HTTP_THUMBNAIL_HANDLER))
#define RYGEL_HTTP_THUMBNAIL_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_HTTP_THUMBNAIL_HANDLER, RygelHTTPThumbnailHandlerClass))

typedef struct _RygelHTTPThumbnailHandler RygelHTTPThumbnailHandler;
typedef struct _RygelHTTPThumbnailHandlerClass RygelHTTPThumbnailHandlerClass;

#define RYGEL_TYPE_HTTP_SUBTITLE_HANDLER (rygel_http_subtitle_handler_get_type ())
#define RYGEL_HTTP_SUBTITLE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_HTTP_SUBTITLE_HANDLER, RygelHTTPSubtitleHandler))
#define RYGEL_HTTP_SUBTITLE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_HTTP_SUBTITLE_HANDLER, RygelHTTPSubtitleHandlerClass))
#define RYGEL_IS_HTTP_SUBTITLE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_HTTP_SUBTITLE_HANDLER))
#define RYGEL_IS_HTTP_SUBTITLE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_HTTP_SUBTITLE_HANDLER))
#define RYGEL_HTTP_SUBTITLE_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_HTTP_SUBTITLE_HANDLER, RygelHTTPSubtitleHandlerClass))

typedef struct _RygelHTTPSubtitleHandler RygelHTTPSubtitleHandler;
typedef struct _RygelHTTPSubtitleHandlerClass RygelHTTPSubtitleHandlerClass;
#define __vala_SoupMessageHeaders_free0(var) ((var == NULL) ? NULL : (var = (_vala_SoupMessageHeaders_free (var), NULL)))
typedef struct _RygelHttpGetHandleData RygelHttpGetHandleData;

#define RYGEL_TYPE_CLIENT_HACKS (rygel_client_hacks_get_type ())
#define RYGEL_CLIENT_HACKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_CLIENT_HACKS, RygelClientHacks))
#define RYGEL_CLIENT_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_CLIENT_HACKS, RygelClientHacksClass))
#define RYGEL_IS_CLIENT_HACKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_CLIENT_HACKS))
#define RYGEL_IS_CLIENT_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_CLIENT_HACKS))
#define RYGEL_CLIENT_HACKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_CLIENT_HACKS, RygelClientHacksClass))

typedef struct _RygelClientHacks RygelClientHacks;
typedef struct _RygelClientHacksClass RygelClientHacksClass;
typedef struct _RygelHttpGetFindItemData RygelHttpGetFindItemData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _rygel_play_speed_unref0(var) ((var == NULL) ? NULL : (var = (rygel_play_speed_unref (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
typedef struct _RygelHttpGetHandleItemRequestData RygelHttpGetHandleItemRequestData;

struct _RygelHttpGetHandleData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelHTTPGet* self;
	gboolean _tmp0_;
	SoupMessage* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gboolean _tmp5_;
	SoupMessage* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	GError* _tmp10_;
	gchar* cf_header;
	gchar* _tmp11_;
	gchar* cf_val;
	SoupMessage* _tmp12_;
	SoupMessageHeaders* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gboolean _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	GError* _tmp23_;
	GError* _tmp24_;
	RygelHTTPItemURI* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	RygelHTTPMediaResourceHandler* _tmp28_;
	RygelMediaObject* _tmp29_;
	RygelHTTPItemURI* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	GCancellable* _tmp33_;
	GCancellable* _tmp34_;
	RygelHTTPMediaResourceHandler* _tmp35_;
	RygelHTTPMediaResourceHandler* _tmp36_;
	RygelHTTPItemURI* _tmp37_;
	gint _tmp38_;
	gint _tmp39_;
	RygelHTTPThumbnailHandler* _tmp40_;
	RygelMediaObject* _tmp41_;
	RygelHTTPItemURI* _tmp42_;
	gint _tmp43_;
	gint _tmp44_;
	GCancellable* _tmp45_;
	GCancellable* _tmp46_;
	RygelHTTPThumbnailHandler* _tmp47_;
	RygelHTTPThumbnailHandler* _tmp48_;
	RygelHTTPItemURI* _tmp49_;
	gint _tmp50_;
	gint _tmp51_;
	RygelHTTPSubtitleHandler* _tmp52_;
	RygelMediaObject* _tmp53_;
	RygelHTTPItemURI* _tmp54_;
	gint _tmp55_;
	gint _tmp56_;
	GCancellable* _tmp57_;
	GCancellable* _tmp58_;
	RygelHTTPSubtitleHandler* _tmp59_;
	RygelHTTPSubtitleHandler* _tmp60_;
	RygelHTTPItemURI* _tmp61_;
	gchar* _tmp62_;
	gchar* _tmp63_;
	GError* _tmp64_;
	GError* _tmp65_;
	SoupMessageHeaders* headers;
	SoupMessage* _tmp66_;
	SoupMessageHeaders* _tmp67_;
	SoupMessageHeaders* _tmp68_;
	gchar* transfer_mode;
	SoupMessageHeaders* _tmp69_;
	const gchar* _tmp70_;
	gchar* _tmp71_;
	const gchar* _tmp72_;
	RygelHTTPGetHandler* _tmp73_;
	gchar* _tmp74_;
	RygelHTTPGetHandler* _tmp75_;
	const gchar* _tmp76_;
	gchar* msg;
	gchar* _tmp77_;
	const gchar* _tmp78_;
	const gchar* _tmp79_;
	RygelHTTPItemURI* _tmp80_;
	gchar* _tmp81_;
	gchar* _tmp82_;
	GError* _tmp83_;
	GError* _tmp84_;
	GError* _inner_error0_;
};

struct _RygelHttpGetFindItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelHTTPGet* self;
	RygelMediaObject* _tmp0_;
	RygelMediaFileItem* item;
	RygelMediaObject* _tmp1_;
	RygelMediaFileItem* _tmp2_;
	gboolean _tmp3_;
	RygelMediaFileItem* _tmp4_;
	RygelMediaFileItem* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	RygelMediaObject* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	GError* _tmp11_;
	RygelClientHacks* _tmp12_;
	RygelClientHacks* _tmp13_;
	RygelMediaObject* _tmp14_;
	GError* _inner_error0_;
};

struct _RygelHttpGetHandleItemRequestData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelHTTPGet* self;
	gboolean supports_time_seek;
	SoupMessage* _tmp0_;
	RygelHTTPGetHandler* _tmp1_;
	gboolean requested_time_seek;
	SoupMessage* _tmp2_;
	gboolean supports_byte_seek;
	SoupMessage* _tmp3_;
	RygelHTTPGetHandler* _tmp4_;
	gboolean requested_byte_seek;
	SoupMessage* _tmp5_;
	gboolean supports_cleartext_seek;
	SoupMessage* _tmp6_;
	RygelHTTPGetHandler* _tmp7_;
	gboolean requested_cleartext_seek;
	SoupMessage* _tmp8_;
	SoupMessageHeaders* response_headers;
	SoupMessage* _tmp9_;
	SoupMessageHeaders* _tmp10_;
	SoupMessageHeaders* _tmp11_;
	gchar* msg;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	RygelHTTPItemURI* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	GError* _tmp17_;
	GError* _tmp18_;
	gchar* _vala1_msg;
	gchar* _tmp19_;
	const gchar* _tmp20_;
	RygelHTTPItemURI* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	GError* _tmp24_;
	GError* _tmp25_;
	gchar* _vala2_msg;
	gchar* _tmp26_;
	const gchar* _tmp27_;
	RygelHTTPItemURI* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	GError* _tmp31_;
	GError* _tmp32_;
	gchar* _vala3_msg;
	gchar* _tmp33_;
	const gchar* _tmp34_;
	RygelHTTPItemURI* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	GError* _tmp38_;
	GError* _tmp39_;
	gboolean _tmp40_;
	gboolean _tmp41_;
	RygelPlaySpeedRequest* _tmp42_;
	RygelPlaySpeedRequest* _tmp43_;
	RygelPlaySpeedRequest* _tmp44_;
	RygelPlaySpeedRequest* _tmp45_;
	RygelPlaySpeed* _tmp46_;
	RygelPlaySpeed* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	RygelPlaySpeedRequest* _tmp50_;
	RygelPlaySpeed* _tmp51_;
	RygelPlaySpeed* _tmp52_;
	GError* _error_;
	SoupServer* _tmp53_;
	SoupMessage* _tmp54_;
	GError* _tmp55_;
	GError* _tmp56_;
	const gchar* _tmp57_;
	GError* _tmp58_;
	GError* _tmp59_;
	const gchar* _tmp60_;
	GError* _tmp61_;
	GError* _tmp62_;
	GError* _tmp63_;
	const gchar* _tmp64_;
	gboolean _tmp65_;
	RygelDTCPCleartextRequest* cleartext_seek;
	SoupMessage* _tmp66_;
	RygelHTTPGetHandler* _tmp67_;
	RygelDTCPCleartextRequest* _tmp68_;
	RygelDTCPCleartextRequest* _tmp69_;
	gint64 _tmp70_;
	gint64 _tmp71_;
	RygelDTCPCleartextRequest* _tmp72_;
	gint64 _tmp73_;
	gint64 _tmp74_;
	RygelDTCPCleartextRequest* _tmp75_;
	RygelHTTPSeekRequest* _tmp76_;
	gboolean _tmp77_;
	RygelHTTPByteSeekRequest* byte_seek;
	SoupMessage* _tmp78_;
	RygelHTTPGetHandler* _tmp79_;
	RygelHTTPByteSeekRequest* _tmp80_;
	RygelHTTPByteSeekRequest* _tmp81_;
	gint64 _tmp82_;
	gint64 _tmp83_;
	RygelHTTPByteSeekRequest* _tmp84_;
	gint64 _tmp85_;
	gint64 _tmp86_;
	RygelHTTPByteSeekRequest* _tmp87_;
	RygelHTTPSeekRequest* _tmp88_;
	gboolean _tmp89_;
	RygelPlaySpeed* _tmp90_;
	RygelPlaySpeedRequest* _tmp91_;
	RygelPlaySpeedRequest* _tmp92_;
	RygelPlaySpeed* _tmp93_;
	RygelPlaySpeed* _tmp94_;
	RygelPlaySpeed* speed;
	RygelPlaySpeed* _tmp95_;
	RygelHTTPTimeSeekRequest* time_seek;
	SoupMessage* _tmp96_;
	RygelHTTPGetHandler* _tmp97_;
	RygelPlaySpeed* _tmp98_;
	RygelHTTPTimeSeekRequest* _tmp99_;
	RygelHTTPTimeSeekRequest* _tmp100_;
	gchar* _tmp101_;
	gchar* _tmp102_;
	RygelHTTPTimeSeekRequest* _tmp103_;
	RygelHTTPSeekRequest* _tmp104_;
	GError* _vala1__error_;
	GError* _tmp105_;
	const gchar* _tmp106_;
	SoupServer* _tmp107_;
	SoupMessage* _tmp108_;
	GError* _tmp109_;
	GError* _tmp110_;
	const gchar* _tmp111_;
	RygelHTTPGetHandler* _tmp112_;
	SoupMessage* _tmp113_;
	SoupMessageHeaders* _tmp114_;
	RygelHTTPServer* _tmp115_;
	const gchar* _tmp116_;
	const gchar* _tmp117_;
	RygelHTTPResponse* response;
	RygelHTTPGetHandler* _tmp118_;
	RygelHTTPResponse* _tmp119_;
	GeeList* responses;
	RygelHTTPResponse* _tmp120_;
	GeeList* _tmp121_;
	GeeList* _tmp122_;
	GeeList* _response_elem_list;
	GeeList* _tmp123_;
	gint _response_elem_size;
	GeeList* _tmp124_;
	gint _tmp125_;
	gint _tmp126_;
	gint _response_elem_index;
	gint _tmp127_;
	gint _tmp128_;
	RygelHTTPResponseElement* response_elem;
	GeeList* _tmp129_;
	gpointer _tmp130_;
	RygelHTTPResponseElement* _tmp131_;
	GError* _vala2__error_;
	GError* _tmp132_;
	const gchar* _tmp133_;
	SoupServer* _tmp134_;
	SoupMessage* _tmp135_;
	GError* _tmp136_;
	GError* _tmp137_;
	const gchar* _tmp138_;
	gint64 response_size;
	SoupMessageHeaders* _tmp139_;
	SoupMessageHeaders* _tmp140_;
	gchar* _tmp141_;
	gchar* _tmp142_;
	gchar* _tmp143_;
	gchar* _tmp144_;
	RygelHTTPGetHandler* _tmp145_;
	SoupMessageHeaders* _tmp146_;
	gchar* _tmp147_;
	gchar* _tmp148_;
	gchar* _tmp149_;
	gchar* _tmp150_;
	SoupEncoding response_body_encoding;
	gboolean _tmp151_;
	RygelPlaySpeedRequest* _tmp152_;
	SoupMessage* _tmp153_;
	SoupMessage* _tmp154_;
	SoupMessageHeaders* _tmp155_;
	gboolean supports_playspeed;
	gboolean _tmp156_;
	SoupMessage* _tmp157_;
	GString* vary_header;
	SoupMessageHeaders* _tmp158_;
	const gchar* _tmp159_;
	GString* _tmp160_;
	GString* _tmp161_;
	GString* _tmp162_;
	GString* _tmp163_;
	GString* _tmp164_;
	GString* _tmp165_;
	GString* _tmp166_;
	SoupMessage* _tmp167_;
	SoupMessageHeaders* _tmp168_;
	GString* _tmp169_;
	const gchar* _tmp170_;
	gint response_code;
	SoupMessage* _tmp171_;
	SoupMessageHeaders* _tmp172_;
	const gchar* _tmp173_;
	SoupMessage* _tmp174_;
	SoupMessage* _tmp175_;
	SoupMessage* _tmp176_;
	SoupMessage* _tmp177_;
	SoupMessageHeaders* _tmp178_;
	SoupMessage* _tmp179_;
	SoupMessageHeaders* _tmp180_;
	SoupMessage* _tmp181_;
	gchar* _tmp182_;
	gchar* _tmp183_;
	gchar* _tmp184_;
	gboolean _tmp185_;
	SoupServer* _tmp186_;
	SoupMessage* _tmp187_;
	RygelHTTPResponse* _tmp188_;
	GError* _inner_error0_;
};

static gpointer rygel_http_get_parent_class = NULL;

static void rygel_http_get_real_handle_data_free (gpointer _data);
static void rygel_http_get_real_handle (RygelHTTPRequest* base,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_);
static gboolean rygel_http_get_real_handle_co (RygelHttpGetHandleData* _data_);
VALA_EXTERN GType rygel_http_media_resource_handler_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelHTTPMediaResourceHandler* rygel_http_media_resource_handler_new (RygelMediaObject* media_object,
                                                                      const gchar* media_resource_name,
                                                                      GCancellable* cancellable,
                                                                      GError** error);
VALA_EXTERN RygelHTTPMediaResourceHandler* rygel_http_media_resource_handler_construct (GType object_type,
                                                                            RygelMediaObject* media_object,
                                                                            const gchar* media_resource_name,
                                                                            GCancellable* cancellable,
                                                                            GError** error);
VALA_EXTERN GType rygel_http_thumbnail_handler_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelHTTPThumbnailHandler* rygel_http_thumbnail_handler_new (RygelMediaFileItem* media_item,
                                                             gint thumbnail_index,
                                                             GCancellable* cancellable,
                                                             GError** error);
VALA_EXTERN RygelHTTPThumbnailHandler* rygel_http_thumbnail_handler_construct (GType object_type,
                                                                   RygelMediaFileItem* media_item,
                                                                   gint thumbnail_index,
                                                                   GCancellable* cancellable,
                                                                   GError** error);
VALA_EXTERN GType rygel_http_subtitle_handler_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelHTTPSubtitleHandler* rygel_http_subtitle_handler_new (RygelMediaFileItem* media_item,
                                                           gint subtitle_index,
                                                           GCancellable* cancellable,
                                                           GError** error);
VALA_EXTERN RygelHTTPSubtitleHandler* rygel_http_subtitle_handler_construct (GType object_type,
                                                                 RygelMediaFileItem* media_item,
                                                                 gint subtitle_index,
                                                                 GCancellable* cancellable,
                                                                 GError** error);
static SoupMessageHeaders* _vala_SoupMessageHeaders_copy (SoupMessageHeaders* self);
static void _vala_SoupMessageHeaders_free (SoupMessageHeaders* self);
static void rygel_http_get_handle_item_request (RygelHTTPGet* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void rygel_http_get_handle_item_request_finish (RygelHTTPGet* self,
                                                GAsyncResult* _res_,
                                                GError** error);
static void rygel_http_get_handle_ready (GObject* source_object,
                                  GAsyncResult* _res_,
                                  gpointer _user_data_);
static void rygel_http_get_real_find_item_data_free (gpointer _data);
static void rygel_http_get_real_find_item (RygelHTTPRequest* base,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static gboolean rygel_http_get_real_find_item_co (RygelHttpGetFindItemData* _data_);
static void rygel_http_get_find_item_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_);
VALA_EXTERN GType rygel_client_hacks_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void rygel_client_hacks_apply (RygelClientHacks* self,
                               RygelMediaObject* object);
static void rygel_http_get_handle_item_request_data_free (gpointer _data);
static gboolean rygel_http_get_handle_item_request_co (RygelHttpGetHandleItemRequestData* _data_);
VALA_EXTERN gboolean rygel_play_speed_request_requested (RygelHTTPGet* request);
VALA_EXTERN RygelPlaySpeedRequest* rygel_play_speed_request_new_from_request (RygelHTTPGet* request,
                                                                  GError** error);
VALA_EXTERN RygelPlaySpeedRequest* rygel_play_speed_request_construct_from_request (GType object_type,
                                                                        RygelHTTPGet* request,
                                                                        GError** error);
VALA_EXTERN RygelHTTPTimeSeekRequest* rygel_http_time_seek_request_new (SoupMessage* message,
                                                            RygelHTTPGetHandler* handler,
                                                            RygelPlaySpeed* speed,
                                                            GError** error);
VALA_EXTERN RygelHTTPTimeSeekRequest* rygel_http_time_seek_request_construct (GType object_type,
                                                                  SoupMessage* message,
                                                                  RygelHTTPGetHandler* handler,
                                                                  RygelPlaySpeed* speed,
                                                                  GError** error);
static void __lambda18_ (RygelHTTPGet* self,
                  const gchar* name,
                  const gchar* value);
static void ___lambda18__soup_message_headers_foreach_func (const gchar* name,
                                                     const gchar* value,
                                                     gpointer self);
static void rygel_http_get_handle_item_request_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void rygel_http_get_finalize (GObject * obj);
static GType rygel_http_get_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

RygelHTTPGet*
rygel_http_get_construct (GType object_type,
                          RygelHTTPServer* http_server,
                          SoupServer* server,
                          SoupMessage* msg)
{
	RygelHTTPGet * self = NULL;
	g_return_val_if_fail (http_server != NULL, NULL);
	g_return_val_if_fail (server != NULL, NULL);
	g_return_val_if_fail (msg != NULL, NULL);
	self = (RygelHTTPGet*) rygel_http_request_construct (object_type, http_server, server, msg);
	return self;
}

RygelHTTPGet*
rygel_http_get_new (RygelHTTPServer* http_server,
                    SoupServer* server,
                    SoupMessage* msg)
{
	return rygel_http_get_construct (RYGEL_TYPE_HTTP_GET, http_server, server, msg);
}

static void
rygel_http_get_real_handle_data_free (gpointer _data)
{
	RygelHttpGetHandleData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelHttpGetHandleData, _data_);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
rygel_http_get_real_handle (RygelHTTPRequest* base,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_)
{
	RygelHTTPGet * self;
	RygelHttpGetHandleData* _data_;
	RygelHTTPGet* _tmp0_;
	self = (RygelHTTPGet*) base;
	_data_ = g_slice_new0 (RygelHttpGetHandleData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_http_get_real_handle_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_http_get_real_handle_co (_data_);
}

static void
rygel_http_get_handle_finish (RygelHTTPRequest* base,
                              GAsyncResult* _res_,
                              GError** error)
{
	RygelHttpGetHandleData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static SoupMessageHeaders*
_vala_SoupMessageHeaders_copy (SoupMessageHeaders* self)
{
	return g_boxed_copy (soup_message_headers_get_type (), self);
}

static gpointer
__vala_SoupMessageHeaders_copy0 (gpointer self)
{
	return self ? _vala_SoupMessageHeaders_copy (self) : NULL;
}

static void
_vala_SoupMessageHeaders_free (SoupMessageHeaders* self)
{
	g_boxed_free (soup_message_headers_get_type (), self);
}

static void
rygel_http_get_handle_ready (GObject* source_object,
                             GAsyncResult* _res_,
                             gpointer _user_data_)
{
	RygelHttpGetHandleData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_http_get_real_handle_co (_data_);
}

static gboolean
rygel_http_get_real_handle_co (RygelHttpGetHandleData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = ((RygelHTTPRequest*) _data_->self)->msg;
	g_object_get (_data_->_tmp1_, "method", &_data_->_tmp2_, NULL);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = g_strcmp0 (_data_->_tmp4_, "HEAD") == 0;
	_g_free0 (_data_->_tmp4_);
	if (_data_->_tmp5_) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp6_ = ((RygelHTTPRequest*) _data_->self)->msg;
		g_object_get (_data_->_tmp6_, "method", &_data_->_tmp7_, NULL);
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp0_ = g_strcmp0 (_data_->_tmp9_, "GET") == 0;
		_g_free0 (_data_->_tmp9_);
	}
	if (!_data_->_tmp0_) {
		_data_->_tmp10_ = g_error_new_literal (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_BAD_REQUEST, _ ("Invalid Request (only GET and HEAD supported)"));
		_data_->_inner_error0_ = _data_->_tmp10_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp11_ = g_strdup ("getcontentFeatures.dlna.org");
		_data_->cf_header = _data_->_tmp11_;
		_data_->_tmp12_ = ((RygelHTTPRequest*) _data_->self)->msg;
		_data_->_tmp13_ = _data_->_tmp12_->request_headers;
		_data_->_tmp14_ = _data_->cf_header;
		_data_->_tmp15_ = soup_message_headers_get_one (_data_->_tmp13_, _data_->_tmp14_);
		_data_->_tmp16_ = g_strdup (_data_->_tmp15_);
		_data_->cf_val = _data_->_tmp16_;
		_data_->_tmp18_ = _data_->cf_val;
		if (_data_->_tmp18_ != NULL) {
			_data_->_tmp19_ = _data_->cf_val;
			_data_->_tmp17_ = g_strcmp0 (_data_->_tmp19_, "1") != 0;
		} else {
			_data_->_tmp17_ = FALSE;
		}
		if (_data_->_tmp17_) {
			_data_->_tmp20_ = _data_->cf_header;
			_data_->_tmp21_ = g_strconcat (_data_->_tmp20_, " must be 1", NULL);
			_data_->_tmp22_ = _data_->_tmp21_;
			_data_->_tmp23_ = g_error_new_literal (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_BAD_REQUEST, _ (_data_->_tmp22_));
			_data_->_tmp24_ = _data_->_tmp23_;
			_g_free0 (_data_->_tmp22_);
			_data_->_inner_error0_ = _data_->_tmp24_;
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->cf_val);
			_g_free0 (_data_->cf_header);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_free0 (_data_->cf_val);
		_g_free0 (_data_->cf_header);
	}
	_data_->_tmp25_ = ((RygelHTTPRequest*) _data_->self)->uri;
	_data_->_tmp26_ = rygel_http_item_uri_get_resource_name (_data_->_tmp25_);
	_data_->_tmp27_ = _data_->_tmp26_;
	if (_data_->_tmp27_ != NULL) {
		_data_->_tmp29_ = ((RygelHTTPRequest*) _data_->self)->object;
		_data_->_tmp30_ = ((RygelHTTPRequest*) _data_->self)->uri;
		_data_->_tmp31_ = rygel_http_item_uri_get_resource_name (_data_->_tmp30_);
		_data_->_tmp32_ = _data_->_tmp31_;
		_data_->_tmp33_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
		_data_->_tmp34_ = _data_->_tmp33_;
		_data_->_tmp35_ = rygel_http_media_resource_handler_new (_data_->_tmp29_, _data_->_tmp32_, _data_->_tmp34_, &_data_->_inner_error0_);
		_data_->_tmp28_ = _data_->_tmp35_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp36_ = _data_->_tmp28_;
		_data_->_tmp28_ = NULL;
		_g_object_unref0 (_data_->self->handler);
		_data_->self->handler = (RygelHTTPGetHandler*) _data_->_tmp36_;
		_g_object_unref0 (_data_->_tmp28_);
	} else {
		_data_->_tmp37_ = ((RygelHTTPRequest*) _data_->self)->uri;
		_data_->_tmp38_ = rygel_http_item_uri_get_thumbnail_index (_data_->_tmp37_);
		_data_->_tmp39_ = _data_->_tmp38_;
		if (_data_->_tmp39_ >= 0) {
			_data_->_tmp41_ = ((RygelHTTPRequest*) _data_->self)->object;
			_data_->_tmp42_ = ((RygelHTTPRequest*) _data_->self)->uri;
			_data_->_tmp43_ = rygel_http_item_uri_get_thumbnail_index (_data_->_tmp42_);
			_data_->_tmp44_ = _data_->_tmp43_;
			_data_->_tmp45_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
			_data_->_tmp46_ = _data_->_tmp45_;
			_data_->_tmp47_ = rygel_http_thumbnail_handler_new (RYGEL_IS_MEDIA_FILE_ITEM (_data_->_tmp41_) ? ((RygelMediaFileItem*) _data_->_tmp41_) : NULL, _data_->_tmp44_, _data_->_tmp46_, &_data_->_inner_error0_);
			_data_->_tmp40_ = _data_->_tmp47_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp48_ = _data_->_tmp40_;
			_data_->_tmp40_ = NULL;
			_g_object_unref0 (_data_->self->handler);
			_data_->self->handler = (RygelHTTPGetHandler*) _data_->_tmp48_;
			_g_object_unref0 (_data_->_tmp40_);
		} else {
			_data_->_tmp49_ = ((RygelHTTPRequest*) _data_->self)->uri;
			_data_->_tmp50_ = rygel_http_item_uri_get_subtitle_index (_data_->_tmp49_);
			_data_->_tmp51_ = _data_->_tmp50_;
			if (_data_->_tmp51_ >= 0) {
				_data_->_tmp53_ = ((RygelHTTPRequest*) _data_->self)->object;
				_data_->_tmp54_ = ((RygelHTTPRequest*) _data_->self)->uri;
				_data_->_tmp55_ = rygel_http_item_uri_get_subtitle_index (_data_->_tmp54_);
				_data_->_tmp56_ = _data_->_tmp55_;
				_data_->_tmp57_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
				_data_->_tmp58_ = _data_->_tmp57_;
				_data_->_tmp59_ = rygel_http_subtitle_handler_new (RYGEL_IS_MEDIA_FILE_ITEM (_data_->_tmp53_) ? ((RygelMediaFileItem*) _data_->_tmp53_) : NULL, _data_->_tmp56_, _data_->_tmp58_, &_data_->_inner_error0_);
				_data_->_tmp52_ = _data_->_tmp59_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp60_ = _data_->_tmp52_;
				_data_->_tmp52_ = NULL;
				_g_object_unref0 (_data_->self->handler);
				_data_->self->handler = (RygelHTTPGetHandler*) _data_->_tmp60_;
				_g_object_unref0 (_data_->_tmp52_);
			} else {
				_data_->_tmp61_ = ((RygelHTTPRequest*) _data_->self)->uri;
				_data_->_tmp62_ = rygel_http_item_uri_to_string (_data_->_tmp61_);
				_data_->_tmp63_ = _data_->_tmp62_;
				_data_->_tmp64_ = g_error_new (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_NOT_FOUND, "No handler found for '%s'", _data_->_tmp63_);
				_data_->_tmp65_ = _data_->_tmp64_;
				_g_free0 (_data_->_tmp63_);
				_data_->_inner_error0_ = _data_->_tmp65_;
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
	}
	{
		_data_->_tmp66_ = ((RygelHTTPRequest*) _data_->self)->msg;
		_data_->_tmp67_ = _data_->_tmp66_->request_headers;
		_data_->_tmp68_ = __vala_SoupMessageHeaders_copy0 (_data_->_tmp67_);
		_data_->headers = _data_->_tmp68_;
		_data_->_tmp69_ = _data_->headers;
		_data_->_tmp70_ = soup_message_headers_get_one (_data_->_tmp69_, RYGEL_HTTP_GET_TRANSFER_MODE_HEADER);
		_data_->_tmp71_ = g_strdup (_data_->_tmp70_);
		_data_->transfer_mode = _data_->_tmp71_;
		_data_->_tmp72_ = _data_->transfer_mode;
		if (_data_->_tmp72_ == NULL) {
			_data_->_tmp73_ = _data_->self->handler;
			_data_->_tmp74_ = rygel_http_get_handler_get_default_transfer_mode (_data_->_tmp73_);
			_g_free0 (_data_->transfer_mode);
			_data_->transfer_mode = _data_->_tmp74_;
		}
		_data_->_tmp75_ = _data_->self->handler;
		_data_->_tmp76_ = _data_->transfer_mode;
		if (!rygel_http_get_handler_supports_transfer_mode (_data_->_tmp75_, _data_->_tmp76_)) {
			_data_->_tmp77_ = g_strdup ("%s transfer mode not supported for '%s'");
			_data_->msg = _data_->_tmp77_;
			_data_->_tmp78_ = _data_->msg;
			_data_->_tmp79_ = _data_->transfer_mode;
			_data_->_tmp80_ = ((RygelHTTPRequest*) _data_->self)->uri;
			_data_->_tmp81_ = rygel_http_item_uri_to_string (_data_->_tmp80_);
			_data_->_tmp82_ = _data_->_tmp81_;
			_data_->_tmp83_ = g_error_new (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_UNACCEPTABLE, _data_->_tmp78_, _data_->_tmp79_, _data_->_tmp82_);
			_data_->_tmp84_ = _data_->_tmp83_;
			_g_free0 (_data_->_tmp82_);
			_data_->_inner_error0_ = _data_->_tmp84_;
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->msg);
			_g_free0 (_data_->transfer_mode);
			__vala_SoupMessageHeaders_free0 (_data_->headers);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_free0 (_data_->transfer_mode);
		__vala_SoupMessageHeaders_free0 (_data_->headers);
	}
	_data_->_state_ = 1;
	rygel_http_get_handle_item_request (_data_->self, rygel_http_get_handle_ready, _data_);
	return FALSE;
	_state_1:
	rygel_http_get_handle_item_request_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
rygel_http_get_real_find_item_data_free (gpointer _data)
{
	RygelHttpGetFindItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelHttpGetFindItemData, _data_);
}

static void
rygel_http_get_real_find_item (RygelHTTPRequest* base,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	RygelHTTPGet * self;
	RygelHttpGetFindItemData* _data_;
	RygelHTTPGet* _tmp0_;
	self = (RygelHTTPGet*) base;
	_data_ = g_slice_new0 (RygelHttpGetFindItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_http_get_real_find_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_http_get_real_find_item_co (_data_);
}

static void
rygel_http_get_find_item_finish (RygelHTTPRequest* base,
                                 GAsyncResult* _res_,
                                 GError** error)
{
	RygelHttpGetFindItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
rygel_http_get_find_item_ready (GObject* source_object,
                                GAsyncResult* _res_,
                                gpointer _user_data_)
{
	RygelHttpGetFindItemData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_http_get_real_find_item_co (_data_);
}

static gboolean
rygel_http_get_real_find_item_co (RygelHttpGetFindItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	RYGEL_HTTP_REQUEST_CLASS (rygel_http_get_parent_class)->find_item (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, RYGEL_TYPE_HTTP_REQUEST, RygelHTTPRequest), rygel_http_get_find_item_ready, _data_);
	return FALSE;
	_state_1:
	RYGEL_HTTP_REQUEST_CLASS (rygel_http_get_parent_class)->find_item_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, RYGEL_TYPE_HTTP_REQUEST, RygelHTTPRequest), _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp0_ = ((RygelHTTPRequest*) _data_->self)->object;
	if (RYGEL_IS_MEDIA_CONTAINER (_data_->_tmp0_)) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = ((RygelHTTPRequest*) _data_->self)->object;
	_data_->_tmp2_ = _g_object_ref0 (RYGEL_IS_MEDIA_FILE_ITEM (_data_->_tmp1_) ? ((RygelMediaFileItem*) _data_->_tmp1_) : NULL);
	_data_->item = _data_->_tmp2_;
	_data_->_tmp4_ = _data_->item;
	if (_data_->_tmp4_ != NULL) {
		_data_->_tmp5_ = _data_->item;
		_data_->_tmp6_ = rygel_media_file_item_get_place_holder (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp3_ = _data_->_tmp7_;
	} else {
		_data_->_tmp3_ = FALSE;
	}
	if (_data_->_tmp3_) {
		_data_->_tmp8_ = ((RygelHTTPRequest*) _data_->self)->object;
		_data_->_tmp9_ = rygel_media_object_get_id (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp11_ = g_error_new (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_NOT_FOUND, "Item '%s' is empty", _data_->_tmp10_);
		_data_->_inner_error0_ = _data_->_tmp11_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->item);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp12_ = ((RygelHTTPRequest*) _data_->self)->hack;
	if (_data_->_tmp12_ != NULL) {
		_data_->_tmp13_ = ((RygelHTTPRequest*) _data_->self)->hack;
		_data_->_tmp14_ = ((RygelHTTPRequest*) _data_->self)->object;
		rygel_client_hacks_apply (_data_->_tmp13_, _data_->_tmp14_);
	}
	_g_object_unref0 (_data_->item);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
rygel_http_get_handle_item_request_data_free (gpointer _data)
{
	RygelHttpGetHandleItemRequestData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelHttpGetHandleItemRequestData, _data_);
}

static void
rygel_http_get_handle_item_request (RygelHTTPGet* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	RygelHttpGetHandleItemRequestData* _data_;
	RygelHTTPGet* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (RygelHttpGetHandleItemRequestData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_http_get_handle_item_request_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_http_get_handle_item_request_co (_data_);
}

static void
rygel_http_get_handle_item_request_finish (RygelHTTPGet* self,
                                           GAsyncResult* _res_,
                                           GError** error)
{
	RygelHttpGetHandleItemRequestData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

static gpointer
_rygel_play_speed_ref0 (gpointer self)
{
	return self ? rygel_play_speed_ref (self) : NULL;
}

static void
__lambda18_ (RygelHTTPGet* self,
             const gchar* name,
             const gchar* value)
{
	g_return_if_fail (name != NULL);
	g_return_if_fail (value != NULL);
	g_debug ("rygel-http-get.vala:353:     %s : %s", name, value);
}

static void
___lambda18__soup_message_headers_foreach_func (const gchar* name,
                                                const gchar* value,
                                                gpointer self)
{
	__lambda18_ ((RygelHTTPGet*) self, name, value);
}

static void
rygel_http_get_handle_item_request_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	RygelHttpGetHandleItemRequestData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_http_get_handle_item_request_co (_data_);
}

static gboolean
rygel_http_get_handle_item_request_co (RygelHttpGetHandleItemRequestData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = ((RygelHTTPRequest*) _data_->self)->msg;
	_data_->_tmp1_ = _data_->self->handler;
	_data_->supports_time_seek = rygel_http_time_seek_request_supported (_data_->_tmp0_, _data_->_tmp1_);
	_data_->_tmp2_ = ((RygelHTTPRequest*) _data_->self)->msg;
	_data_->requested_time_seek = rygel_http_time_seek_request_requested (_data_->_tmp2_);
	_data_->_tmp3_ = ((RygelHTTPRequest*) _data_->self)->msg;
	_data_->_tmp4_ = _data_->self->handler;
	_data_->supports_byte_seek = rygel_http_byte_seek_request_supported (_data_->_tmp3_, _data_->_tmp4_);
	_data_->_tmp5_ = ((RygelHTTPRequest*) _data_->self)->msg;
	_data_->requested_byte_seek = rygel_http_byte_seek_request_requested (_data_->_tmp5_);
	_data_->_tmp6_ = ((RygelHTTPRequest*) _data_->self)->msg;
	_data_->_tmp7_ = _data_->self->handler;
	_data_->supports_cleartext_seek = rygel_dtcp_cleartext_request_supported (_data_->_tmp6_, _data_->_tmp7_);
	_data_->_tmp8_ = ((RygelHTTPRequest*) _data_->self)->msg;
	_data_->requested_cleartext_seek = rygel_dtcp_cleartext_request_requested (_data_->_tmp8_);
	_data_->_tmp9_ = ((RygelHTTPRequest*) _data_->self)->msg;
	_data_->_tmp10_ = _data_->_tmp9_->response_headers;
	_data_->_tmp11_ = __vala_SoupMessageHeaders_copy0 (_data_->_tmp10_);
	_data_->response_headers = _data_->_tmp11_;
	if (_data_->requested_cleartext_seek) {
		if (!_data_->supports_cleartext_seek) {
			_data_->_tmp12_ = g_strdup ("Cleartext seek not supported for %s");
			_data_->msg = _data_->_tmp12_;
			_data_->_tmp13_ = _data_->msg;
			_data_->_tmp14_ = ((RygelHTTPRequest*) _data_->self)->uri;
			_data_->_tmp15_ = rygel_http_item_uri_to_string (_data_->_tmp14_);
			_data_->_tmp16_ = _data_->_tmp15_;
			_data_->_tmp17_ = g_error_new (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_UNACCEPTABLE, _data_->_tmp13_, _data_->_tmp16_);
			_data_->_tmp18_ = _data_->_tmp17_;
			_g_free0 (_data_->_tmp16_);
			_data_->_inner_error0_ = _data_->_tmp18_;
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->msg);
			__vala_SoupMessageHeaders_free0 (_data_->response_headers);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		if (_data_->requested_byte_seek) {
			_data_->_tmp19_ = g_strdup ("Both Cleartext and Range seek requested for %s");
			_data_->_vala1_msg = _data_->_tmp19_;
			_data_->_tmp20_ = _data_->_vala1_msg;
			_data_->_tmp21_ = ((RygelHTTPRequest*) _data_->self)->uri;
			_data_->_tmp22_ = rygel_http_item_uri_to_string (_data_->_tmp21_);
			_data_->_tmp23_ = _data_->_tmp22_;
			_data_->_tmp24_ = g_error_new (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_UNACCEPTABLE, _data_->_tmp20_, _data_->_tmp23_);
			_data_->_tmp25_ = _data_->_tmp24_;
			_g_free0 (_data_->_tmp23_);
			_data_->_inner_error0_ = _data_->_tmp25_;
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->_vala1_msg);
			__vala_SoupMessageHeaders_free0 (_data_->response_headers);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	} else {
		if (_data_->requested_byte_seek) {
			if (!_data_->supports_byte_seek) {
				_data_->_tmp26_ = g_strdup ("Byte seek not supported for %s");
				_data_->_vala2_msg = _data_->_tmp26_;
				_data_->_tmp27_ = _data_->_vala2_msg;
				_data_->_tmp28_ = ((RygelHTTPRequest*) _data_->self)->uri;
				_data_->_tmp29_ = rygel_http_item_uri_to_string (_data_->_tmp28_);
				_data_->_tmp30_ = _data_->_tmp29_;
				_data_->_tmp31_ = g_error_new (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_UNACCEPTABLE, _data_->_tmp27_, _data_->_tmp30_);
				_data_->_tmp32_ = _data_->_tmp31_;
				_g_free0 (_data_->_tmp30_);
				_data_->_inner_error0_ = _data_->_tmp32_;
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_free0 (_data_->_vala2_msg);
				__vala_SoupMessageHeaders_free0 (_data_->response_headers);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		} else {
			if (_data_->requested_time_seek) {
				if (!_data_->supports_time_seek) {
					_data_->_tmp33_ = g_strdup ("Time seek not supported for %s");
					_data_->_vala3_msg = _data_->_tmp33_;
					_data_->_tmp34_ = _data_->_vala3_msg;
					_data_->_tmp35_ = ((RygelHTTPRequest*) _data_->self)->uri;
					_data_->_tmp36_ = rygel_http_item_uri_to_string (_data_->_tmp35_);
					_data_->_tmp37_ = _data_->_tmp36_;
					_data_->_tmp38_ = g_error_new (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_UNACCEPTABLE, _data_->_tmp34_, _data_->_tmp37_);
					_data_->_tmp39_ = _data_->_tmp38_;
					_g_free0 (_data_->_tmp37_);
					_data_->_inner_error0_ = _data_->_tmp39_;
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_free0 (_data_->_vala3_msg);
					__vala_SoupMessageHeaders_free0 (_data_->response_headers);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
			}
		}
	}
	{
		if (_data_->requested_byte_seek) {
			_data_->_tmp41_ = TRUE;
		} else {
			_data_->_tmp41_ = _data_->requested_cleartext_seek;
		}
		if (!_data_->_tmp41_) {
			_data_->_tmp40_ = rygel_play_speed_request_requested (_data_->self);
		} else {
			_data_->_tmp40_ = FALSE;
		}
		if (_data_->_tmp40_) {
			_data_->_tmp43_ = rygel_play_speed_request_new_from_request (_data_->self, &_data_->_inner_error0_);
			_data_->_tmp42_ = _data_->_tmp43_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				if (_data_->_inner_error0_->domain == RYGEL_PLAY_SPEED_ERROR) {
					goto __catch0_rygel_play_speed_error;
				}
				__vala_SoupMessageHeaders_free0 (_data_->response_headers);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
				g_clear_error (&_data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp44_ = _data_->_tmp42_;
			_data_->_tmp42_ = NULL;
			_g_object_unref0 (_data_->self->speed_request);
			_data_->self->speed_request = _data_->_tmp44_;
			_data_->_tmp45_ = _data_->self->speed_request;
			_data_->_tmp46_ = rygel_play_speed_request_get_speed (_data_->_tmp45_);
			_data_->_tmp47_ = _data_->_tmp46_;
			_data_->_tmp48_ = rygel_play_speed_to_string (_data_->_tmp47_);
			_data_->_tmp49_ = _data_->_tmp48_;
			g_debug ("rygel-http-get.vala:171: Processing playspeed %s", _data_->_tmp49_);
			_g_free0 (_data_->_tmp49_);
			_data_->_tmp50_ = _data_->self->speed_request;
			_data_->_tmp51_ = rygel_play_speed_request_get_speed (_data_->_tmp50_);
			_data_->_tmp52_ = _data_->_tmp51_;
			if (rygel_play_speed_is_normal_rate (_data_->_tmp52_)) {
				_g_object_unref0 (_data_->self->speed_request);
				_data_->self->speed_request = NULL;
			}
			_g_object_unref0 (_data_->_tmp42_);
		} else {
			_g_object_unref0 (_data_->self->speed_request);
			_data_->self->speed_request = NULL;
		}
	}
	goto __finally0;
	__catch0_rygel_play_speed_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp53_ = ((RygelHTTPRequest*) _data_->self)->server;
		_data_->_tmp54_ = ((RygelHTTPRequest*) _data_->self)->msg;
		soup_server_unpause_message (_data_->_tmp53_, _data_->_tmp54_);
		_data_->_tmp55_ = _data_->_error_;
		if (g_error_matches (_data_->_tmp55_, RYGEL_PLAY_SPEED_ERROR, RYGEL_PLAY_SPEED_ERROR_INVALID_SPEED_FORMAT)) {
			_data_->_tmp56_ = _data_->_error_;
			_data_->_tmp57_ = _data_->_tmp56_->message;
			rygel_http_request_end ((RygelHTTPRequest*) _data_->self, (guint) SOUP_STATUS_BAD_REQUEST, _data_->_tmp57_);
		} else {
			_data_->_tmp58_ = _data_->_error_;
			if (g_error_matches (_data_->_tmp58_, RYGEL_PLAY_SPEED_ERROR, RYGEL_PLAY_SPEED_ERROR_SPEED_NOT_PRESENT)) {
				_data_->_tmp59_ = _data_->_error_;
				_data_->_tmp60_ = _data_->_tmp59_->message;
				rygel_http_request_end ((RygelHTTPRequest*) _data_->self, (guint) SOUP_STATUS_NOT_ACCEPTABLE, _data_->_tmp60_);
			} else {
				_data_->_tmp61_ = _data_->_error_;
				_data_->_tmp62_ = _g_error_copy0 (_data_->_tmp61_);
				_data_->_inner_error0_ = _data_->_tmp62_;
				_g_error_free0 (_data_->_error_);
				goto __finally0;
			}
		}
		_data_->_tmp63_ = _data_->_error_;
		_data_->_tmp64_ = _data_->_tmp63_->message;
		g_warning ("rygel-http-get.vala:191: Error processing PlaySpeed: %s", _data_->_tmp64_);
		_g_error_free0 (_data_->_error_);
		__vala_SoupMessageHeaders_free0 (_data_->response_headers);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		__vala_SoupMessageHeaders_free0 (_data_->response_headers);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		if (_data_->supports_cleartext_seek) {
			_data_->_tmp65_ = _data_->requested_cleartext_seek;
		} else {
			_data_->_tmp65_ = FALSE;
		}
		if (_data_->_tmp65_) {
			_data_->_tmp66_ = ((RygelHTTPRequest*) _data_->self)->msg;
			_data_->_tmp67_ = _data_->self->handler;
			_data_->_tmp68_ = rygel_dtcp_cleartext_request_new (_data_->_tmp66_, _data_->_tmp67_, &_data_->_inner_error0_);
			_data_->cleartext_seek = _data_->_tmp68_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				if (_data_->_inner_error0_->domain == RYGEL_HTTP_SEEK_REQUEST_ERROR) {
					goto __catch1_rygel_http_seek_request_error;
				}
				goto __finally1;
			}
			_data_->_tmp69_ = _data_->cleartext_seek;
			_data_->_tmp70_ = rygel_dtcp_cleartext_request_get_start_byte (_data_->_tmp69_);
			_data_->_tmp71_ = _data_->_tmp70_;
			_data_->_tmp72_ = _data_->cleartext_seek;
			_data_->_tmp73_ = rygel_dtcp_cleartext_request_get_end_byte (_data_->_tmp72_);
			_data_->_tmp74_ = _data_->_tmp73_;
			g_debug ("rygel-http-get.vala:200: Processing DTCP cleartext byte range request " \
"(bytes %lld to %lld)", _data_->_tmp71_, _data_->_tmp74_);
			_data_->_tmp75_ = _data_->cleartext_seek;
			_data_->_tmp76_ = _g_object_ref0 ((RygelHTTPSeekRequest*) _data_->_tmp75_);
			_g_object_unref0 (_data_->self->seek);
			_data_->self->seek = _data_->_tmp76_;
			_g_object_unref0 (_data_->cleartext_seek);
		} else {
			if (_data_->supports_byte_seek) {
				_data_->_tmp77_ = _data_->requested_byte_seek;
			} else {
				_data_->_tmp77_ = FALSE;
			}
			if (_data_->_tmp77_) {
				_data_->_tmp78_ = ((RygelHTTPRequest*) _data_->self)->msg;
				_data_->_tmp79_ = _data_->self->handler;
				_data_->_tmp80_ = rygel_http_byte_seek_request_new (_data_->_tmp78_, _data_->_tmp79_, &_data_->_inner_error0_);
				_data_->byte_seek = _data_->_tmp80_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					if (_data_->_inner_error0_->domain == RYGEL_HTTP_SEEK_REQUEST_ERROR) {
						goto __catch1_rygel_http_seek_request_error;
					}
					goto __finally1;
				}
				_data_->_tmp81_ = _data_->byte_seek;
				_data_->_tmp82_ = rygel_http_byte_seek_request_get_start_byte (_data_->_tmp81_);
				_data_->_tmp83_ = _data_->_tmp82_;
				_data_->_tmp84_ = _data_->byte_seek;
				_data_->_tmp85_ = rygel_http_byte_seek_request_get_end_byte (_data_->_tmp84_);
				_data_->_tmp86_ = _data_->_tmp85_;
				g_debug ("rygel-http-get.vala:205: Processing byte range request (bytes %lld to " \
"%lld)", _data_->_tmp83_, _data_->_tmp86_);
				_data_->_tmp87_ = _data_->byte_seek;
				_data_->_tmp88_ = _g_object_ref0 ((RygelHTTPSeekRequest*) _data_->_tmp87_);
				_g_object_unref0 (_data_->self->seek);
				_data_->self->seek = _data_->_tmp88_;
				_g_object_unref0 (_data_->byte_seek);
			} else {
				if (_data_->supports_time_seek) {
					_data_->_tmp89_ = _data_->requested_time_seek;
				} else {
					_data_->_tmp89_ = FALSE;
				}
				if (_data_->_tmp89_) {
					_data_->_tmp91_ = _data_->self->speed_request;
					if (_data_->_tmp91_ == NULL) {
						_data_->_tmp90_ = NULL;
					} else {
						_data_->_tmp92_ = _data_->self->speed_request;
						_data_->_tmp93_ = rygel_play_speed_request_get_speed (_data_->_tmp92_);
						_data_->_tmp94_ = _data_->_tmp93_;
						_data_->_tmp90_ = _data_->_tmp94_;
					}
					_data_->_tmp95_ = _rygel_play_speed_ref0 (_data_->_tmp90_);
					_data_->speed = _data_->_tmp95_;
					_data_->_tmp96_ = ((RygelHTTPRequest*) _data_->self)->msg;
					_data_->_tmp97_ = _data_->self->handler;
					_data_->_tmp98_ = _data_->speed;
					_data_->_tmp99_ = rygel_http_time_seek_request_new (_data_->_tmp96_, _data_->_tmp97_, _data_->_tmp98_, &_data_->_inner_error0_);
					_data_->time_seek = _data_->_tmp99_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						_rygel_play_speed_unref0 (_data_->speed);
						if (_data_->_inner_error0_->domain == RYGEL_HTTP_SEEK_REQUEST_ERROR) {
							goto __catch1_rygel_http_seek_request_error;
						}
						__vala_SoupMessageHeaders_free0 (_data_->response_headers);
						g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
						g_clear_error (&_data_->_inner_error0_);
						g_object_unref (_data_->_async_result);
						return FALSE;
					}
					_data_->_tmp100_ = _data_->time_seek;
					_data_->_tmp101_ = rygel_http_time_seek_request_to_string (_data_->_tmp100_);
					_data_->_tmp102_ = _data_->_tmp101_;
					g_debug ("rygel-http-get.vala:214: Processing time seek %s", _data_->_tmp102_);
					_g_free0 (_data_->_tmp102_);
					_data_->_tmp103_ = _data_->time_seek;
					_data_->_tmp104_ = _g_object_ref0 ((RygelHTTPSeekRequest*) _data_->_tmp103_);
					_g_object_unref0 (_data_->self->seek);
					_data_->self->seek = _data_->_tmp104_;
					_g_object_unref0 (_data_->time_seek);
					_rygel_play_speed_unref0 (_data_->speed);
				} else {
					_g_object_unref0 (_data_->self->seek);
					_data_->self->seek = NULL;
				}
			}
		}
	}
	goto __finally1;
	__catch1_rygel_http_seek_request_error:
	{
		_data_->_vala1__error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp105_ = _data_->_vala1__error_;
		_data_->_tmp106_ = _data_->_tmp105_->message;
		g_warning ("rygel-http-get.vala:220: Caught HTTPSeekRequestError: %s", _data_->_tmp106_);
		_data_->_tmp107_ = ((RygelHTTPRequest*) _data_->self)->server;
		_data_->_tmp108_ = ((RygelHTTPRequest*) _data_->self)->msg;
		soup_server_unpause_message (_data_->_tmp107_, _data_->_tmp108_);
		_data_->_tmp109_ = _data_->_vala1__error_;
		_data_->_tmp110_ = _data_->_vala1__error_;
		_data_->_tmp111_ = _data_->_tmp110_->message;
		rygel_http_request_end ((RygelHTTPRequest*) _data_->self, (guint) _data_->_tmp109_->code, _data_->_tmp111_);
		_g_error_free0 (_data_->_vala1__error_);
		__vala_SoupMessageHeaders_free0 (_data_->response_headers);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally1:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		__vala_SoupMessageHeaders_free0 (_data_->response_headers);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp112_ = _data_->self->handler;
	rygel_http_get_handler_add_response_headers (_data_->_tmp112_, _data_->self, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		__vala_SoupMessageHeaders_free0 (_data_->response_headers);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp113_ = ((RygelHTTPRequest*) _data_->self)->msg;
	_data_->_tmp114_ = _data_->_tmp113_->response_headers;
	_data_->_tmp115_ = ((RygelHTTPRequest*) _data_->self)->http_server;
	_data_->_tmp116_ = rygel_http_server_get_server_name (_data_->_tmp115_);
	_data_->_tmp117_ = _data_->_tmp116_;
	soup_message_headers_append (_data_->_tmp114_, "Server", _data_->_tmp117_);
	_data_->_tmp118_ = _data_->self->handler;
	_data_->_tmp119_ = rygel_http_get_handler_render_body (_data_->_tmp118_, _data_->self, &_data_->_inner_error0_);
	_data_->response = _data_->_tmp119_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		__vala_SoupMessageHeaders_free0 (_data_->response_headers);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp120_ = _data_->response;
		_data_->_tmp121_ = rygel_http_response_preroll (_data_->_tmp120_, &_data_->_inner_error0_);
		_data_->responses = _data_->_tmp121_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			if (_data_->_inner_error0_->domain == RYGEL_HTTP_SEEK_REQUEST_ERROR) {
				goto __catch2_rygel_http_seek_request_error;
			}
			goto __finally2;
		}
		_data_->_tmp122_ = _data_->responses;
		if (_data_->_tmp122_ != NULL) {
			{
				_data_->_tmp123_ = _data_->responses;
				_data_->_response_elem_list = _data_->_tmp123_;
				_data_->_tmp124_ = _data_->_response_elem_list;
				_data_->_tmp125_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp124_);
				_data_->_tmp126_ = _data_->_tmp125_;
				_data_->_response_elem_size = _data_->_tmp126_;
				_data_->_response_elem_index = -1;
				while (TRUE) {
					_data_->_response_elem_index = _data_->_response_elem_index + 1;
					_data_->_tmp127_ = _data_->_response_elem_index;
					_data_->_tmp128_ = _data_->_response_elem_size;
					if (!(_data_->_tmp127_ < _data_->_tmp128_)) {
						break;
					}
					_data_->_tmp129_ = _data_->_response_elem_list;
					_data_->_tmp130_ = gee_list_get (_data_->_tmp129_, _data_->_response_elem_index);
					_data_->response_elem = (RygelHTTPResponseElement*) _data_->_tmp130_;
					_data_->_tmp131_ = _data_->response_elem;
					rygel_http_response_element_add_response_headers (_data_->_tmp131_, (RygelHTTPRequest*) _data_->self);
					_g_object_unref0 (_data_->response_elem);
				}
			}
		}
		_g_object_unref0 (_data_->responses);
	}
	goto __finally2;
	__catch2_rygel_http_seek_request_error:
	{
		_data_->_vala2__error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp132_ = _data_->_vala2__error_;
		_data_->_tmp133_ = _data_->_tmp132_->message;
		g_warning ("rygel-http-get.vala:246: Caught HTTPSeekRequestError on preroll: %s", _data_->_tmp133_);
		_data_->_tmp134_ = ((RygelHTTPRequest*) _data_->self)->server;
		_data_->_tmp135_ = ((RygelHTTPRequest*) _data_->self)->msg;
		soup_server_unpause_message (_data_->_tmp134_, _data_->_tmp135_);
		_data_->_tmp136_ = _data_->_vala2__error_;
		_data_->_tmp137_ = _data_->_vala2__error_;
		_data_->_tmp138_ = _data_->_tmp137_->message;
		rygel_http_request_end ((RygelHTTPRequest*) _data_->self, (guint) _data_->_tmp136_->code, _data_->_tmp138_);
		_g_error_free0 (_data_->_vala2__error_);
		_g_object_unref0 (_data_->response);
		__vala_SoupMessageHeaders_free0 (_data_->response_headers);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally2:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->response);
		__vala_SoupMessageHeaders_free0 (_data_->response_headers);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp139_ = _data_->response_headers;
		_data_->response_size = soup_message_headers_get_content_length (_data_->_tmp139_);
		if (_data_->response_size > ((gint64) 0)) {
			_data_->_tmp140_ = _data_->response_headers;
			soup_message_headers_set_content_length (_data_->_tmp140_, _data_->response_size);
			_data_->_tmp141_ = g_strdup_printf ("%" G_GINT64_FORMAT, _data_->response_size);
			_data_->_tmp142_ = _data_->_tmp141_;
			_data_->_tmp143_ = g_strconcat ("Response size set via response element: size ", _data_->_tmp142_, NULL);
			_data_->_tmp144_ = _data_->_tmp143_;
			g_debug ("rygel-http-get.vala:264: %s", _data_->_tmp144_);
			_g_free0 (_data_->_tmp144_);
			_g_free0 (_data_->_tmp142_);
		} else {
			_data_->_tmp145_ = _data_->self->handler;
			_data_->response_size = rygel_http_get_handler_get_resource_size (_data_->_tmp145_);
			if (_data_->response_size > ((gint64) 0)) {
				_data_->_tmp146_ = _data_->response_headers;
				soup_message_headers_set_content_length (_data_->_tmp146_, _data_->response_size);
				_data_->_tmp147_ = g_strdup_printf ("%" G_GINT64_FORMAT, _data_->response_size);
				_data_->_tmp148_ = _data_->_tmp147_;
				_data_->_tmp149_ = g_strconcat ("Response size set via response element: size ", _data_->_tmp148_, NULL);
				_data_->_tmp150_ = _data_->_tmp149_;
				g_debug ("rygel-http-get.vala:271: %s", _data_->_tmp150_);
				_g_free0 (_data_->_tmp150_);
				_g_free0 (_data_->_tmp148_);
			} else {
				g_debug ("rygel-http-get.vala:274: Response size unknown");
			}
		}
	}
	{
		_data_->_tmp152_ = _data_->self->speed_request;
		if (_data_->_tmp152_ != NULL) {
			_data_->_tmp153_ = ((RygelHTTPRequest*) _data_->self)->msg;
			_data_->_tmp151_ = soup_message_get_http_version (_data_->_tmp153_) != SOUP_HTTP_1_0;
		} else {
			_data_->_tmp151_ = FALSE;
		}
		if (_data_->_tmp151_) {
			_data_->response_body_encoding = SOUP_ENCODING_CHUNKED;
			g_debug ("rygel-http-get.vala:289: Response encoding set to CHUNKED");
		} else {
			if (_data_->response_size > ((gint64) 0)) {
				_data_->response_body_encoding = SOUP_ENCODING_CONTENT_LENGTH;
				g_debug ("rygel-http-get.vala:293: Response encoding set to CONTENT-LENGTH");
			} else {
				_data_->_tmp154_ = ((RygelHTTPRequest*) _data_->self)->msg;
				if (soup_message_get_http_version (_data_->_tmp154_) == SOUP_HTTP_1_0) {
					_data_->response_body_encoding = SOUP_ENCODING_EOF;
					g_debug ("rygel-http-get.vala:298: Response encoding set to EOF");
				} else {
					_data_->response_body_encoding = SOUP_ENCODING_CHUNKED;
					g_debug ("rygel-http-get.vala:301: Response encoding set to CHUNKED");
				}
			}
		}
		_data_->_tmp155_ = _data_->response_headers;
		soup_message_headers_set_encoding (_data_->_tmp155_, _data_->response_body_encoding);
	}
	{
		_data_->supports_playspeed = rygel_play_speed_request_supported (_data_->self);
		if (_data_->supports_time_seek) {
			_data_->_tmp156_ = TRUE;
		} else {
			_data_->_tmp156_ = _data_->supports_playspeed;
		}
		if (_data_->_tmp156_) {
			_data_->_tmp157_ = ((RygelHTTPRequest*) _data_->self)->msg;
			if (soup_message_get_http_version (_data_->_tmp157_) != SOUP_HTTP_1_0) {
				_data_->_tmp158_ = _data_->response_headers;
				_data_->_tmp159_ = soup_message_headers_get_list (_data_->_tmp158_, "Vary");
				_data_->_tmp160_ = g_string_new (_data_->_tmp159_);
				_data_->vary_header = _data_->_tmp160_;
				if (_data_->supports_time_seek) {
					_data_->_tmp161_ = _data_->vary_header;
					if (_data_->_tmp161_->len > ((gssize) 0)) {
						_data_->_tmp162_ = _data_->vary_header;
						g_string_append (_data_->_tmp162_, ",");
					}
					_data_->_tmp163_ = _data_->vary_header;
					g_string_append (_data_->_tmp163_, RYGEL_HTTP_TIME_SEEK_REQUEST_TIMESEEKRANGE_HEADER);
				}
				if (_data_->supports_playspeed) {
					_data_->_tmp164_ = _data_->vary_header;
					if (_data_->_tmp164_->len > ((gssize) 0)) {
						_data_->_tmp165_ = _data_->vary_header;
						g_string_append (_data_->_tmp165_, ",");
					}
					_data_->_tmp166_ = _data_->vary_header;
					g_string_append (_data_->_tmp166_, RYGEL_PLAY_SPEED_REQUEST_PLAYSPEED_HEADER);
				}
				_data_->_tmp167_ = ((RygelHTTPRequest*) _data_->self)->msg;
				_data_->_tmp168_ = _data_->_tmp167_->response_headers;
				_data_->_tmp169_ = _data_->vary_header;
				_data_->_tmp170_ = _data_->_tmp169_->str;
				soup_message_headers_replace (_data_->_tmp168_, "Vary", _data_->_tmp170_);
				_g_string_free0 (_data_->vary_header);
			}
		}
	}
	{
		_data_->_tmp171_ = ((RygelHTTPRequest*) _data_->self)->msg;
		_data_->_tmp172_ = _data_->_tmp171_->response_headers;
		_data_->_tmp173_ = soup_message_headers_get_one (_data_->_tmp172_, "Content-Range");
		if (_data_->_tmp173_ != NULL) {
			_data_->response_code = (gint) SOUP_STATUS_PARTIAL_CONTENT;
		} else {
			_data_->response_code = (gint) SOUP_STATUS_OK;
		}
		_data_->_tmp174_ = ((RygelHTTPRequest*) _data_->self)->msg;
		soup_message_set_status (_data_->_tmp174_, (guint) _data_->response_code);
	}
	_data_->_tmp175_ = ((RygelHTTPRequest*) _data_->self)->msg;
	if (soup_message_get_http_version (_data_->_tmp175_) == SOUP_HTTP_1_0) {
		_data_->_tmp176_ = ((RygelHTTPRequest*) _data_->self)->msg;
		soup_message_set_http_version (_data_->_tmp176_, SOUP_HTTP_1_1);
		_data_->_tmp177_ = ((RygelHTTPRequest*) _data_->self)->msg;
		_data_->_tmp178_ = _data_->_tmp177_->response_headers;
		soup_message_headers_append (_data_->_tmp178_, "Connection", "close");
	}
	g_debug ("rygel-http-get.vala:351: Following HTTP headers appended to response:");
	_data_->_tmp179_ = ((RygelHTTPRequest*) _data_->self)->msg;
	_data_->_tmp180_ = _data_->_tmp179_->response_headers;
	soup_message_headers_foreach (_data_->_tmp180_, ___lambda18__soup_message_headers_foreach_func, _data_->self);
	_data_->_tmp181_ = ((RygelHTTPRequest*) _data_->self)->msg;
	g_object_get (_data_->_tmp181_, "method", &_data_->_tmp182_, NULL);
	_data_->_tmp183_ = _data_->_tmp182_;
	_data_->_tmp184_ = _data_->_tmp183_;
	_data_->_tmp185_ = g_strcmp0 (_data_->_tmp184_, "HEAD") == 0;
	_g_free0 (_data_->_tmp184_);
	if (_data_->_tmp185_) {
		_data_->_tmp186_ = ((RygelHTTPRequest*) _data_->self)->server;
		_data_->_tmp187_ = ((RygelHTTPRequest*) _data_->self)->msg;
		soup_server_unpause_message (_data_->_tmp186_, _data_->_tmp187_);
		_g_object_unref0 (_data_->response);
		__vala_SoupMessageHeaders_free0 (_data_->response_headers);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp188_ = _data_->response;
	_data_->_state_ = 1;
	rygel_state_machine_run ((RygelStateMachine*) _data_->_tmp188_, rygel_http_get_handle_item_request_ready, _data_);
	return FALSE;
	_state_1:
	rygel_state_machine_run_finish ((RygelStateMachine*) _data_->_tmp188_, _data_->_res_);
	rygel_http_request_end ((RygelHTTPRequest*) _data_->self, (guint) SOUP_STATUS_NONE, NULL);
	_g_object_unref0 (_data_->response);
	__vala_SoupMessageHeaders_free0 (_data_->response_headers);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
rygel_http_get_class_init (RygelHTTPGetClass * klass,
                           gpointer klass_data)
{
	rygel_http_get_parent_class = g_type_class_peek_parent (klass);
	((RygelHTTPRequestClass *) klass)->handle = (void (*) (RygelHTTPRequest*, GAsyncReadyCallback, gpointer)) rygel_http_get_real_handle;
	((RygelHTTPRequestClass *) klass)->handle_finish = (void (*) (RygelHTTPRequest*, GAsyncResult*, GError**)) rygel_http_get_handle_finish;
	((RygelHTTPRequestClass *) klass)->find_item = (void (*) (RygelHTTPRequest*, GAsyncReadyCallback, gpointer)) rygel_http_get_real_find_item;
	((RygelHTTPRequestClass *) klass)->find_item_finish = (void (*) (RygelHTTPRequest*, GAsyncResult*, GError**)) rygel_http_get_find_item_finish;
	G_OBJECT_CLASS (klass)->finalize = rygel_http_get_finalize;
}

static void
rygel_http_get_instance_init (RygelHTTPGet * self,
                              gpointer klass)
{
}

static void
rygel_http_get_finalize (GObject * obj)
{
	RygelHTTPGet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_HTTP_GET, RygelHTTPGet);
	_g_object_unref0 (self->seek);
	_g_object_unref0 (self->speed_request);
	_g_object_unref0 (self->handler);
	G_OBJECT_CLASS (rygel_http_get_parent_class)->finalize (obj);
}

/**
 * Responsible for handling HTTP GET & HEAD client requests.
 */
static GType
rygel_http_get_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RygelHTTPGetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_http_get_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelHTTPGet), 0, (GInstanceInitFunc) rygel_http_get_instance_init, NULL };
	GType rygel_http_get_type_id;
	rygel_http_get_type_id = g_type_register_static (RYGEL_TYPE_HTTP_REQUEST, "RygelHTTPGet", &g_define_type_info, 0);
	return rygel_http_get_type_id;
}

GType
rygel_http_get_get_type (void)
{
	static volatile gsize rygel_http_get_type_id__once = 0;
	if (g_once_init_enter (&rygel_http_get_type_id__once)) {
		GType rygel_http_get_type_id;
		rygel_http_get_type_id = rygel_http_get_get_type_once ();
		g_once_init_leave (&rygel_http_get_type_id__once, rygel_http_get_type_id);
	}
	return rygel_http_get_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

