/* rygel-http-get.c generated by valac 0.56.19, 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 <glib-object.h>
#include <libsoup/soup.h>
#include <glib/gi18n-lib.h>
#include "rygel-core.h"
#include <gee.h>

#define RYGEL_HTTP_GET_TRANSFER_MODE_HEADER "transferMode.dlna.org"
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

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 _soup_message_headers_unref0(var) ((var == NULL) ? NULL : (var = (soup_message_headers_unref (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_;
	SoupServerMessage* _tmp1_;
	const gchar* _tmp2_;
	SoupServerMessage* _tmp3_;
	const gchar* _tmp4_;
	GError* _tmp5_;
	gchar* cf_header;
	gchar* _tmp6_;
	gchar* cf_val;
	SoupServerMessage* _tmp7_;
	SoupMessageHeaders* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gboolean _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	GError* _tmp18_;
	GError* _tmp19_;
	RygelHTTPItemURI* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	RygelHTTPMediaResourceHandler* _tmp23_;
	RygelMediaObject* _tmp24_;
	RygelHTTPItemURI* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	GCancellable* _tmp28_;
	GCancellable* _tmp29_;
	RygelHTTPMediaResourceHandler* _tmp30_;
	RygelHTTPMediaResourceHandler* _tmp31_;
	RygelHTTPItemURI* _tmp32_;
	gint _tmp33_;
	gint _tmp34_;
	RygelHTTPThumbnailHandler* _tmp35_;
	RygelMediaObject* _tmp36_;
	RygelHTTPItemURI* _tmp37_;
	gint _tmp38_;
	gint _tmp39_;
	GCancellable* _tmp40_;
	GCancellable* _tmp41_;
	RygelHTTPThumbnailHandler* _tmp42_;
	RygelHTTPThumbnailHandler* _tmp43_;
	RygelHTTPItemURI* _tmp44_;
	gint _tmp45_;
	gint _tmp46_;
	RygelHTTPSubtitleHandler* _tmp47_;
	RygelMediaObject* _tmp48_;
	RygelHTTPItemURI* _tmp49_;
	gint _tmp50_;
	gint _tmp51_;
	GCancellable* _tmp52_;
	GCancellable* _tmp53_;
	RygelHTTPSubtitleHandler* _tmp54_;
	RygelHTTPSubtitleHandler* _tmp55_;
	RygelHTTPItemURI* _tmp56_;
	gchar* _tmp57_;
	gchar* _tmp58_;
	GError* _tmp59_;
	GError* _tmp60_;
	SoupMessageHeaders* headers;
	SoupServerMessage* _tmp61_;
	SoupMessageHeaders* _tmp62_;
	SoupMessageHeaders* _tmp63_;
	gchar* transfer_mode;
	SoupMessageHeaders* _tmp64_;
	const gchar* _tmp65_;
	gchar* _tmp66_;
	const gchar* _tmp67_;
	RygelHTTPGetHandler* _tmp68_;
	gchar* _tmp69_;
	RygelHTTPGetHandler* _tmp70_;
	const gchar* _tmp71_;
	gchar* msg;
	gchar* _tmp72_;
	const gchar* _tmp73_;
	const gchar* _tmp74_;
	RygelHTTPItemURI* _tmp75_;
	gchar* _tmp76_;
	gchar* _tmp77_;
	GError* _tmp78_;
	GError* _tmp79_;
	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;
	SoupServerMessage* _tmp0_;
	RygelHTTPGetHandler* _tmp1_;
	gboolean requested_time_seek;
	SoupServerMessage* _tmp2_;
	gboolean supports_byte_seek;
	SoupServerMessage* _tmp3_;
	RygelHTTPGetHandler* _tmp4_;
	gboolean requested_byte_seek;
	SoupServerMessage* _tmp5_;
	gboolean supports_cleartext_seek;
	SoupServerMessage* _tmp6_;
	RygelHTTPGetHandler* _tmp7_;
	gboolean requested_cleartext_seek;
	SoupServerMessage* _tmp8_;
	SoupMessageHeaders* response_headers;
	SoupServerMessage* _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_;
	SoupServerMessage* _tmp53_;
	GError* _tmp54_;
	GError* _tmp55_;
	const gchar* _tmp56_;
	GError* _tmp57_;
	GError* _tmp58_;
	const gchar* _tmp59_;
	GError* _tmp60_;
	GError* _tmp61_;
	GError* _tmp62_;
	const gchar* _tmp63_;
	gboolean _tmp64_;
	RygelDTCPCleartextRequest* cleartext_seek;
	SoupServerMessage* _tmp65_;
	RygelHTTPGetHandler* _tmp66_;
	RygelDTCPCleartextRequest* _tmp67_;
	RygelDTCPCleartextRequest* _tmp68_;
	gint64 _tmp69_;
	gint64 _tmp70_;
	RygelDTCPCleartextRequest* _tmp71_;
	gint64 _tmp72_;
	gint64 _tmp73_;
	RygelDTCPCleartextRequest* _tmp74_;
	RygelHTTPSeekRequest* _tmp75_;
	gboolean _tmp76_;
	RygelHTTPByteSeekRequest* byte_seek;
	SoupServerMessage* _tmp77_;
	RygelHTTPGetHandler* _tmp78_;
	RygelHTTPByteSeekRequest* _tmp79_;
	RygelHTTPByteSeekRequest* _tmp80_;
	gint64 _tmp81_;
	gint64 _tmp82_;
	RygelHTTPByteSeekRequest* _tmp83_;
	gint64 _tmp84_;
	gint64 _tmp85_;
	RygelHTTPByteSeekRequest* _tmp86_;
	RygelHTTPSeekRequest* _tmp87_;
	gboolean _tmp88_;
	RygelPlaySpeed* _tmp89_;
	RygelPlaySpeedRequest* _tmp90_;
	RygelPlaySpeedRequest* _tmp91_;
	RygelPlaySpeed* _tmp92_;
	RygelPlaySpeed* _tmp93_;
	RygelPlaySpeed* speed;
	RygelPlaySpeed* _tmp94_;
	RygelHTTPTimeSeekRequest* time_seek;
	SoupServerMessage* _tmp95_;
	RygelHTTPGetHandler* _tmp96_;
	RygelPlaySpeed* _tmp97_;
	RygelHTTPTimeSeekRequest* _tmp98_;
	RygelHTTPTimeSeekRequest* _tmp99_;
	gchar* _tmp100_;
	gchar* _tmp101_;
	RygelHTTPTimeSeekRequest* _tmp102_;
	RygelHTTPSeekRequest* _tmp103_;
	GError* _vala1__error_;
	GError* _tmp104_;
	const gchar* _tmp105_;
	SoupServerMessage* _tmp106_;
	GError* _tmp107_;
	GError* _tmp108_;
	const gchar* _tmp109_;
	RygelHTTPGetHandler* _tmp110_;
	SoupServerMessage* _tmp111_;
	SoupMessageHeaders* _tmp112_;
	RygelHTTPServer* _tmp113_;
	const gchar* _tmp114_;
	const gchar* _tmp115_;
	RygelHTTPResponse* response;
	RygelHTTPGetHandler* _tmp116_;
	RygelHTTPResponse* _tmp117_;
	GeeList* responses;
	RygelHTTPResponse* _tmp118_;
	GeeList* _tmp119_;
	GeeList* _tmp120_;
	GeeList* _response_elem_list;
	GeeList* _tmp121_;
	gint _response_elem_size;
	GeeList* _tmp122_;
	gint _tmp123_;
	gint _tmp124_;
	gint _response_elem_index;
	gint _tmp125_;
	gint _tmp126_;
	RygelHTTPResponseElement* response_elem;
	GeeList* _tmp127_;
	gpointer _tmp128_;
	RygelHTTPResponseElement* _tmp129_;
	GError* _vala2__error_;
	GError* _tmp130_;
	const gchar* _tmp131_;
	SoupServerMessage* _tmp132_;
	GError* _tmp133_;
	GError* _tmp134_;
	const gchar* _tmp135_;
	gint64 response_size;
	SoupMessageHeaders* _tmp136_;
	SoupMessageHeaders* _tmp137_;
	gchar* _tmp138_;
	gchar* _tmp139_;
	gchar* _tmp140_;
	gchar* _tmp141_;
	RygelHTTPGetHandler* _tmp142_;
	SoupMessageHeaders* _tmp143_;
	gchar* _tmp144_;
	gchar* _tmp145_;
	gchar* _tmp146_;
	gchar* _tmp147_;
	SoupEncoding response_body_encoding;
	gboolean _tmp148_;
	RygelPlaySpeedRequest* _tmp149_;
	SoupServerMessage* _tmp150_;
	SoupServerMessage* _tmp151_;
	SoupMessageHeaders* _tmp152_;
	gboolean supports_playspeed;
	gboolean _tmp153_;
	SoupServerMessage* _tmp154_;
	GString* vary_header;
	SoupMessageHeaders* _tmp155_;
	const gchar* _tmp156_;
	GString* _tmp157_;
	GString* _tmp158_;
	GString* _tmp159_;
	GString* _tmp160_;
	GString* _tmp161_;
	GString* _tmp162_;
	GString* _tmp163_;
	SoupServerMessage* _tmp164_;
	SoupMessageHeaders* _tmp165_;
	GString* _tmp166_;
	const gchar* _tmp167_;
	gint response_code;
	SoupServerMessage* _tmp168_;
	SoupMessageHeaders* _tmp169_;
	const gchar* _tmp170_;
	SoupServerMessage* _tmp171_;
	SoupServerMessage* _tmp172_;
	SoupServerMessage* _tmp173_;
	SoupServerMessage* _tmp174_;
	SoupMessageHeaders* _tmp175_;
	SoupServerMessage* _tmp176_;
	SoupMessageHeaders* _tmp177_;
	SoupServerMessage* _tmp178_;
	const gchar* _tmp179_;
	SoupServerMessage* _tmp180_;
	RygelHTTPResponse* _tmp181_;
	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 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 (SoupServerMessage* message,
                                                            RygelHTTPGetHandler* handler,
                                                            RygelPlaySpeed* speed,
                                                            GError** error);
VALA_EXTERN RygelHTTPTimeSeekRequest* rygel_http_time_seek_request_construct (GType object_type,
                                                                  SoupServerMessage* 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,
                          SoupServerMessage* 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,
                    SoupServerMessage* 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 gpointer
_soup_message_headers_ref0 (gpointer self)
{
	return self ? soup_message_headers_ref (self) : NULL;
}

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;
	_data_->_tmp2_ = soup_server_message_get_method (_data_->_tmp1_);
	if (g_strcmp0 (_data_->_tmp2_, "HEAD") == 0) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp3_ = ((RygelHTTPRequest*) _data_->self)->msg;
		_data_->_tmp4_ = soup_server_message_get_method (_data_->_tmp3_);
		_data_->_tmp0_ = g_strcmp0 (_data_->_tmp4_, "GET") == 0;
	}
	if (!_data_->_tmp0_) {
		_data_->_tmp5_ = 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_->_tmp5_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp6_ = g_strdup ("getcontentFeatures.dlna.org");
		_data_->cf_header = _data_->_tmp6_;
		_data_->_tmp7_ = ((RygelHTTPRequest*) _data_->self)->msg;
		_data_->_tmp8_ = soup_server_message_get_request_headers (_data_->_tmp7_);
		_data_->_tmp9_ = _data_->cf_header;
		_data_->_tmp10_ = soup_message_headers_get_one (_data_->_tmp8_, _data_->_tmp9_);
		_data_->_tmp11_ = g_strdup (_data_->_tmp10_);
		_data_->cf_val = _data_->_tmp11_;
		_data_->_tmp13_ = _data_->cf_val;
		if (_data_->_tmp13_ != NULL) {
			_data_->_tmp14_ = _data_->cf_val;
			_data_->_tmp12_ = g_strcmp0 (_data_->_tmp14_, "1") != 0;
		} else {
			_data_->_tmp12_ = FALSE;
		}
		if (_data_->_tmp12_) {
			_data_->_tmp15_ = _data_->cf_header;
			_data_->_tmp16_ = g_strconcat (_data_->_tmp15_, " must be 1", NULL);
			_data_->_tmp17_ = _data_->_tmp16_;
			_data_->_tmp18_ = g_error_new_literal (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_BAD_REQUEST, _ (_data_->_tmp17_));
			_data_->_tmp19_ = _data_->_tmp18_;
			_g_free0 (_data_->_tmp17_);
			_data_->_inner_error0_ = _data_->_tmp19_;
			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_->_tmp20_ = ((RygelHTTPRequest*) _data_->self)->uri;
	_data_->_tmp21_ = rygel_http_item_uri_get_resource_name (_data_->_tmp20_);
	_data_->_tmp22_ = _data_->_tmp21_;
	if (_data_->_tmp22_ != NULL) {
		_data_->_tmp24_ = ((RygelHTTPRequest*) _data_->self)->object;
		_data_->_tmp25_ = ((RygelHTTPRequest*) _data_->self)->uri;
		_data_->_tmp26_ = rygel_http_item_uri_get_resource_name (_data_->_tmp25_);
		_data_->_tmp27_ = _data_->_tmp26_;
		_data_->_tmp28_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
		_data_->_tmp29_ = _data_->_tmp28_;
		_data_->_tmp30_ = rygel_http_media_resource_handler_new (_data_->_tmp24_, _data_->_tmp27_, _data_->_tmp29_, &_data_->_inner_error0_);
		_data_->_tmp23_ = _data_->_tmp30_;
		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_->_tmp31_ = _data_->_tmp23_;
		_data_->_tmp23_ = NULL;
		_g_object_unref0 (_data_->self->handler);
		_data_->self->handler = (RygelHTTPGetHandler*) _data_->_tmp31_;
		_g_object_unref0 (_data_->_tmp23_);
	} else {
		_data_->_tmp32_ = ((RygelHTTPRequest*) _data_->self)->uri;
		_data_->_tmp33_ = rygel_http_item_uri_get_thumbnail_index (_data_->_tmp32_);
		_data_->_tmp34_ = _data_->_tmp33_;
		if (_data_->_tmp34_ >= 0) {
			_data_->_tmp36_ = ((RygelHTTPRequest*) _data_->self)->object;
			_data_->_tmp37_ = ((RygelHTTPRequest*) _data_->self)->uri;
			_data_->_tmp38_ = rygel_http_item_uri_get_thumbnail_index (_data_->_tmp37_);
			_data_->_tmp39_ = _data_->_tmp38_;
			_data_->_tmp40_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
			_data_->_tmp41_ = _data_->_tmp40_;
			_data_->_tmp42_ = rygel_http_thumbnail_handler_new (RYGEL_IS_MEDIA_FILE_ITEM (_data_->_tmp36_) ? ((RygelMediaFileItem*) _data_->_tmp36_) : NULL, _data_->_tmp39_, _data_->_tmp41_, &_data_->_inner_error0_);
			_data_->_tmp35_ = _data_->_tmp42_;
			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_->_tmp43_ = _data_->_tmp35_;
			_data_->_tmp35_ = NULL;
			_g_object_unref0 (_data_->self->handler);
			_data_->self->handler = (RygelHTTPGetHandler*) _data_->_tmp43_;
			_g_object_unref0 (_data_->_tmp35_);
		} else {
			_data_->_tmp44_ = ((RygelHTTPRequest*) _data_->self)->uri;
			_data_->_tmp45_ = rygel_http_item_uri_get_subtitle_index (_data_->_tmp44_);
			_data_->_tmp46_ = _data_->_tmp45_;
			if (_data_->_tmp46_ >= 0) {
				_data_->_tmp48_ = ((RygelHTTPRequest*) _data_->self)->object;
				_data_->_tmp49_ = ((RygelHTTPRequest*) _data_->self)->uri;
				_data_->_tmp50_ = rygel_http_item_uri_get_subtitle_index (_data_->_tmp49_);
				_data_->_tmp51_ = _data_->_tmp50_;
				_data_->_tmp52_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
				_data_->_tmp53_ = _data_->_tmp52_;
				_data_->_tmp54_ = rygel_http_subtitle_handler_new (RYGEL_IS_MEDIA_FILE_ITEM (_data_->_tmp48_) ? ((RygelMediaFileItem*) _data_->_tmp48_) : NULL, _data_->_tmp51_, _data_->_tmp53_, &_data_->_inner_error0_);
				_data_->_tmp47_ = _data_->_tmp54_;
				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_->_tmp55_ = _data_->_tmp47_;
				_data_->_tmp47_ = NULL;
				_g_object_unref0 (_data_->self->handler);
				_data_->self->handler = (RygelHTTPGetHandler*) _data_->_tmp55_;
				_g_object_unref0 (_data_->_tmp47_);
			} else {
				_data_->_tmp56_ = ((RygelHTTPRequest*) _data_->self)->uri;
				_data_->_tmp57_ = rygel_http_item_uri_to_string (_data_->_tmp56_);
				_data_->_tmp58_ = _data_->_tmp57_;
				_data_->_tmp59_ = g_error_new (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_NOT_FOUND, "No handler found for '%s'", _data_->_tmp58_);
				_data_->_tmp60_ = _data_->_tmp59_;
				_g_free0 (_data_->_tmp58_);
				_data_->_inner_error0_ = _data_->_tmp60_;
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
	}
	{
		_data_->_tmp61_ = ((RygelHTTPRequest*) _data_->self)->msg;
		_data_->_tmp62_ = soup_server_message_get_request_headers (_data_->_tmp61_);
		_data_->_tmp63_ = _soup_message_headers_ref0 (_data_->_tmp62_);
		_data_->headers = _data_->_tmp63_;
		_data_->_tmp64_ = _data_->headers;
		_data_->_tmp65_ = soup_message_headers_get_one (_data_->_tmp64_, RYGEL_HTTP_GET_TRANSFER_MODE_HEADER);
		_data_->_tmp66_ = g_strdup (_data_->_tmp65_);
		_data_->transfer_mode = _data_->_tmp66_;
		_data_->_tmp67_ = _data_->transfer_mode;
		if (_data_->_tmp67_ == NULL) {
			_data_->_tmp68_ = _data_->self->handler;
			_data_->_tmp69_ = rygel_http_get_handler_get_default_transfer_mode (_data_->_tmp68_);
			_g_free0 (_data_->transfer_mode);
			_data_->transfer_mode = _data_->_tmp69_;
		}
		_data_->_tmp70_ = _data_->self->handler;
		_data_->_tmp71_ = _data_->transfer_mode;
		if (!rygel_http_get_handler_supports_transfer_mode (_data_->_tmp70_, _data_->_tmp71_)) {
			_data_->_tmp72_ = g_strdup (_ ("%s transfer mode not supported for '%s'"));
			_data_->msg = _data_->_tmp72_;
			_data_->_tmp73_ = _data_->msg;
			_data_->_tmp74_ = _data_->transfer_mode;
			_data_->_tmp75_ = ((RygelHTTPRequest*) _data_->self)->uri;
			_data_->_tmp76_ = rygel_http_item_uri_to_string (_data_->_tmp75_);
			_data_->_tmp77_ = _data_->_tmp76_;
			_data_->_tmp78_ = g_error_new (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_UNACCEPTABLE, _data_->_tmp73_, _data_->_tmp74_, _data_->_tmp77_);
			_data_->_tmp79_ = _data_->_tmp78_;
			_g_free0 (_data_->_tmp77_);
			_data_->_inner_error0_ = _data_->_tmp79_;
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->msg);
			_g_free0 (_data_->transfer_mode);
			_soup_message_headers_unref0 (_data_->headers);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_free0 (_data_->transfer_mode);
		_soup_message_headers_unref0 (_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:354:     %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_ = soup_server_message_get_response_headers (_data_->_tmp9_);
	_data_->_tmp11_ = _soup_message_headers_ref0 (_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);
			_soup_message_headers_unref0 (_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);
			_soup_message_headers_unref0 (_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);
				_soup_message_headers_unref0 (_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);
					_soup_message_headers_unref0 (_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;
				}
				_soup_message_headers_unref0 (_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:172: 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)->msg;
		soup_server_message_unpause (_data_->_tmp53_);
		_data_->_tmp54_ = _data_->_error_;
		if (g_error_matches (_data_->_tmp54_, RYGEL_PLAY_SPEED_ERROR, RYGEL_PLAY_SPEED_ERROR_INVALID_SPEED_FORMAT)) {
			_data_->_tmp55_ = _data_->_error_;
			_data_->_tmp56_ = _data_->_tmp55_->message;
			rygel_http_request_end ((RygelHTTPRequest*) _data_->self, (guint) SOUP_STATUS_BAD_REQUEST, _data_->_tmp56_);
		} else {
			_data_->_tmp57_ = _data_->_error_;
			if (g_error_matches (_data_->_tmp57_, RYGEL_PLAY_SPEED_ERROR, RYGEL_PLAY_SPEED_ERROR_SPEED_NOT_PRESENT)) {
				_data_->_tmp58_ = _data_->_error_;
				_data_->_tmp59_ = _data_->_tmp58_->message;
				rygel_http_request_end ((RygelHTTPRequest*) _data_->self, (guint) SOUP_STATUS_NOT_ACCEPTABLE, _data_->_tmp59_);
			} else {
				_data_->_tmp60_ = _data_->_error_;
				_data_->_tmp61_ = _g_error_copy0 (_data_->_tmp60_);
				_data_->_inner_error0_ = _data_->_tmp61_;
				_g_error_free0 (_data_->_error_);
				goto __finally0;
			}
		}
		_data_->_tmp62_ = _data_->_error_;
		_data_->_tmp63_ = _data_->_tmp62_->message;
		g_warning ("rygel-http-get.vala:192: Error processing PlaySpeed: %s", _data_->_tmp63_);
		_g_error_free0 (_data_->_error_);
		_soup_message_headers_unref0 (_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_);
		_soup_message_headers_unref0 (_data_->response_headers);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		if (_data_->supports_cleartext_seek) {
			_data_->_tmp64_ = _data_->requested_cleartext_seek;
		} else {
			_data_->_tmp64_ = FALSE;
		}
		if (_data_->_tmp64_) {
			_data_->_tmp65_ = ((RygelHTTPRequest*) _data_->self)->msg;
			_data_->_tmp66_ = _data_->self->handler;
			_data_->_tmp67_ = rygel_dtcp_cleartext_request_new (_data_->_tmp65_, _data_->_tmp66_, &_data_->_inner_error0_);
			_data_->cleartext_seek = _data_->_tmp67_;
			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_->_tmp68_ = _data_->cleartext_seek;
			_data_->_tmp69_ = rygel_dtcp_cleartext_request_get_start_byte (_data_->_tmp68_);
			_data_->_tmp70_ = _data_->_tmp69_;
			_data_->_tmp71_ = _data_->cleartext_seek;
			_data_->_tmp72_ = rygel_dtcp_cleartext_request_get_end_byte (_data_->_tmp71_);
			_data_->_tmp73_ = _data_->_tmp72_;
			g_debug ("rygel-http-get.vala:201: Processing DTCP cleartext byte range request " \
"(bytes %lld to %lld)", _data_->_tmp70_, _data_->_tmp73_);
			_data_->_tmp74_ = _data_->cleartext_seek;
			_data_->_tmp75_ = _g_object_ref0 ((RygelHTTPSeekRequest*) _data_->_tmp74_);
			_g_object_unref0 (_data_->self->seek);
			_data_->self->seek = _data_->_tmp75_;
			_g_object_unref0 (_data_->cleartext_seek);
		} else {
			if (_data_->supports_byte_seek) {
				_data_->_tmp76_ = _data_->requested_byte_seek;
			} else {
				_data_->_tmp76_ = FALSE;
			}
			if (_data_->_tmp76_) {
				_data_->_tmp77_ = ((RygelHTTPRequest*) _data_->self)->msg;
				_data_->_tmp78_ = _data_->self->handler;
				_data_->_tmp79_ = rygel_http_byte_seek_request_new (_data_->_tmp77_, _data_->_tmp78_, &_data_->_inner_error0_);
				_data_->byte_seek = _data_->_tmp79_;
				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_->_tmp80_ = _data_->byte_seek;
				_data_->_tmp81_ = rygel_http_byte_seek_request_get_start_byte (_data_->_tmp80_);
				_data_->_tmp82_ = _data_->_tmp81_;
				_data_->_tmp83_ = _data_->byte_seek;
				_data_->_tmp84_ = rygel_http_byte_seek_request_get_end_byte (_data_->_tmp83_);
				_data_->_tmp85_ = _data_->_tmp84_;
				g_debug ("rygel-http-get.vala:206: Processing byte range request (bytes %lld to " \
"%lld)", _data_->_tmp82_, _data_->_tmp85_);
				_data_->_tmp86_ = _data_->byte_seek;
				_data_->_tmp87_ = _g_object_ref0 ((RygelHTTPSeekRequest*) _data_->_tmp86_);
				_g_object_unref0 (_data_->self->seek);
				_data_->self->seek = _data_->_tmp87_;
				_g_object_unref0 (_data_->byte_seek);
			} else {
				if (_data_->supports_time_seek) {
					_data_->_tmp88_ = _data_->requested_time_seek;
				} else {
					_data_->_tmp88_ = FALSE;
				}
				if (_data_->_tmp88_) {
					_data_->_tmp90_ = _data_->self->speed_request;
					if (_data_->_tmp90_ == NULL) {
						_data_->_tmp89_ = NULL;
					} else {
						_data_->_tmp91_ = _data_->self->speed_request;
						_data_->_tmp92_ = rygel_play_speed_request_get_speed (_data_->_tmp91_);
						_data_->_tmp93_ = _data_->_tmp92_;
						_data_->_tmp89_ = _data_->_tmp93_;
					}
					_data_->_tmp94_ = _rygel_play_speed_ref0 (_data_->_tmp89_);
					_data_->speed = _data_->_tmp94_;
					_data_->_tmp95_ = ((RygelHTTPRequest*) _data_->self)->msg;
					_data_->_tmp96_ = _data_->self->handler;
					_data_->_tmp97_ = _data_->speed;
					_data_->_tmp98_ = rygel_http_time_seek_request_new (_data_->_tmp95_, _data_->_tmp96_, _data_->_tmp97_, &_data_->_inner_error0_);
					_data_->time_seek = _data_->_tmp98_;
					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;
						}
						_soup_message_headers_unref0 (_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_->_tmp99_ = _data_->time_seek;
					_data_->_tmp100_ = rygel_http_time_seek_request_to_string (_data_->_tmp99_);
					_data_->_tmp101_ = _data_->_tmp100_;
					g_debug ("rygel-http-get.vala:215: Processing time seek %s", _data_->_tmp101_);
					_g_free0 (_data_->_tmp101_);
					_data_->_tmp102_ = _data_->time_seek;
					_data_->_tmp103_ = _g_object_ref0 ((RygelHTTPSeekRequest*) _data_->_tmp102_);
					_g_object_unref0 (_data_->self->seek);
					_data_->self->seek = _data_->_tmp103_;
					_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_->_tmp104_ = _data_->_vala1__error_;
		_data_->_tmp105_ = _data_->_tmp104_->message;
		g_warning ("rygel-http-get.vala:221: Caught HTTPSeekRequestError: %s", _data_->_tmp105_);
		_data_->_tmp106_ = ((RygelHTTPRequest*) _data_->self)->msg;
		soup_server_message_unpause (_data_->_tmp106_);
		_data_->_tmp107_ = _data_->_vala1__error_;
		_data_->_tmp108_ = _data_->_vala1__error_;
		_data_->_tmp109_ = _data_->_tmp108_->message;
		rygel_http_request_end ((RygelHTTPRequest*) _data_->self, (guint) _data_->_tmp107_->code, _data_->_tmp109_);
		_g_error_free0 (_data_->_vala1__error_);
		_soup_message_headers_unref0 (_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_);
		_soup_message_headers_unref0 (_data_->response_headers);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp110_ = _data_->self->handler;
	rygel_http_get_handler_add_response_headers (_data_->_tmp110_, _data_->self, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_soup_message_headers_unref0 (_data_->response_headers);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp111_ = ((RygelHTTPRequest*) _data_->self)->msg;
	_data_->_tmp112_ = soup_server_message_get_response_headers (_data_->_tmp111_);
	_data_->_tmp113_ = ((RygelHTTPRequest*) _data_->self)->http_server;
	_data_->_tmp114_ = rygel_http_server_get_server_name (_data_->_tmp113_);
	_data_->_tmp115_ = _data_->_tmp114_;
	soup_message_headers_append (_data_->_tmp112_, "Server", _data_->_tmp115_);
	_data_->_tmp116_ = _data_->self->handler;
	_data_->_tmp117_ = rygel_http_get_handler_render_body (_data_->_tmp116_, _data_->self, &_data_->_inner_error0_);
	_data_->response = _data_->_tmp117_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_soup_message_headers_unref0 (_data_->response_headers);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp118_ = _data_->response;
		_data_->_tmp119_ = rygel_http_response_preroll (_data_->_tmp118_, &_data_->_inner_error0_);
		_data_->responses = _data_->_tmp119_;
		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_->_tmp120_ = _data_->responses;
		if (_data_->_tmp120_ != NULL) {
			{
				_data_->_tmp121_ = _data_->responses;
				_data_->_response_elem_list = _data_->_tmp121_;
				_data_->_tmp122_ = _data_->_response_elem_list;
				_data_->_tmp123_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp122_);
				_data_->_tmp124_ = _data_->_tmp123_;
				_data_->_response_elem_size = _data_->_tmp124_;
				_data_->_response_elem_index = -1;
				while (TRUE) {
					_data_->_response_elem_index = _data_->_response_elem_index + 1;
					_data_->_tmp125_ = _data_->_response_elem_index;
					_data_->_tmp126_ = _data_->_response_elem_size;
					if (!(_data_->_tmp125_ < _data_->_tmp126_)) {
						break;
					}
					_data_->_tmp127_ = _data_->_response_elem_list;
					_data_->_tmp128_ = gee_list_get (_data_->_tmp127_, _data_->_response_elem_index);
					_data_->response_elem = (RygelHTTPResponseElement*) _data_->_tmp128_;
					_data_->_tmp129_ = _data_->response_elem;
					rygel_http_response_element_add_response_headers (_data_->_tmp129_, (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_->_tmp130_ = _data_->_vala2__error_;
		_data_->_tmp131_ = _data_->_tmp130_->message;
		g_warning ("rygel-http-get.vala:247: Caught HTTPSeekRequestError on preroll: %s", _data_->_tmp131_);
		_data_->_tmp132_ = ((RygelHTTPRequest*) _data_->self)->msg;
		soup_server_message_unpause (_data_->_tmp132_);
		_data_->_tmp133_ = _data_->_vala2__error_;
		_data_->_tmp134_ = _data_->_vala2__error_;
		_data_->_tmp135_ = _data_->_tmp134_->message;
		rygel_http_request_end ((RygelHTTPRequest*) _data_->self, (guint) _data_->_tmp133_->code, _data_->_tmp135_);
		_g_error_free0 (_data_->_vala2__error_);
		_g_object_unref0 (_data_->response);
		_soup_message_headers_unref0 (_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);
		_soup_message_headers_unref0 (_data_->response_headers);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp136_ = _data_->response_headers;
		_data_->response_size = soup_message_headers_get_content_length (_data_->_tmp136_);
		if (_data_->response_size > ((gint64) 0)) {
			_data_->_tmp137_ = _data_->response_headers;
			soup_message_headers_set_content_length (_data_->_tmp137_, _data_->response_size);
			_data_->_tmp138_ = g_strdup_printf ("%" G_GINT64_FORMAT, _data_->response_size);
			_data_->_tmp139_ = _data_->_tmp138_;
			_data_->_tmp140_ = g_strconcat ("Response size set via response element: size ", _data_->_tmp139_, NULL);
			_data_->_tmp141_ = _data_->_tmp140_;
			g_debug ("rygel-http-get.vala:265: %s", _data_->_tmp141_);
			_g_free0 (_data_->_tmp141_);
			_g_free0 (_data_->_tmp139_);
		} else {
			_data_->_tmp142_ = _data_->self->handler;
			_data_->response_size = rygel_http_get_handler_get_resource_size (_data_->_tmp142_);
			if (_data_->response_size > ((gint64) 0)) {
				_data_->_tmp143_ = _data_->response_headers;
				soup_message_headers_set_content_length (_data_->_tmp143_, _data_->response_size);
				_data_->_tmp144_ = g_strdup_printf ("%" G_GINT64_FORMAT, _data_->response_size);
				_data_->_tmp145_ = _data_->_tmp144_;
				_data_->_tmp146_ = g_strconcat ("Response size set via response element: size ", _data_->_tmp145_, NULL);
				_data_->_tmp147_ = _data_->_tmp146_;
				g_debug ("rygel-http-get.vala:272: %s", _data_->_tmp147_);
				_g_free0 (_data_->_tmp147_);
				_g_free0 (_data_->_tmp145_);
			} else {
				g_debug ("rygel-http-get.vala:275: Response size unknown");
			}
		}
	}
	{
		_data_->_tmp149_ = _data_->self->speed_request;
		if (_data_->_tmp149_ != NULL) {
			_data_->_tmp150_ = ((RygelHTTPRequest*) _data_->self)->msg;
			_data_->_tmp148_ = soup_server_message_get_http_version (_data_->_tmp150_) != SOUP_HTTP_1_0;
		} else {
			_data_->_tmp148_ = FALSE;
		}
		if (_data_->_tmp148_) {
			_data_->response_body_encoding = SOUP_ENCODING_CHUNKED;
			g_debug ("rygel-http-get.vala:290: 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:294: Response encoding set to CONTENT-LENGTH");
			} else {
				_data_->_tmp151_ = ((RygelHTTPRequest*) _data_->self)->msg;
				if (soup_server_message_get_http_version (_data_->_tmp151_) == SOUP_HTTP_1_0) {
					_data_->response_body_encoding = SOUP_ENCODING_EOF;
					g_debug ("rygel-http-get.vala:299: Response encoding set to EOF");
				} else {
					_data_->response_body_encoding = SOUP_ENCODING_CHUNKED;
					g_debug ("rygel-http-get.vala:302: Response encoding set to CHUNKED");
				}
			}
		}
		_data_->_tmp152_ = _data_->response_headers;
		soup_message_headers_set_encoding (_data_->_tmp152_, _data_->response_body_encoding);
	}
	{
		_data_->supports_playspeed = rygel_play_speed_request_supported (_data_->self);
		if (_data_->supports_time_seek) {
			_data_->_tmp153_ = TRUE;
		} else {
			_data_->_tmp153_ = _data_->supports_playspeed;
		}
		if (_data_->_tmp153_) {
			_data_->_tmp154_ = ((RygelHTTPRequest*) _data_->self)->msg;
			if (soup_server_message_get_http_version (_data_->_tmp154_) != SOUP_HTTP_1_0) {
				_data_->_tmp155_ = _data_->response_headers;
				_data_->_tmp156_ = soup_message_headers_get_list (_data_->_tmp155_, "Vary");
				_data_->_tmp157_ = g_string_new (_data_->_tmp156_);
				_data_->vary_header = _data_->_tmp157_;
				if (_data_->supports_time_seek) {
					_data_->_tmp158_ = _data_->vary_header;
					if (_data_->_tmp158_->len > ((gssize) 0)) {
						_data_->_tmp159_ = _data_->vary_header;
						g_string_append (_data_->_tmp159_, ",");
					}
					_data_->_tmp160_ = _data_->vary_header;
					g_string_append (_data_->_tmp160_, RYGEL_HTTP_TIME_SEEK_REQUEST_TIMESEEKRANGE_HEADER);
				}
				if (_data_->supports_playspeed) {
					_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_PLAY_SPEED_REQUEST_PLAYSPEED_HEADER);
				}
				_data_->_tmp164_ = ((RygelHTTPRequest*) _data_->self)->msg;
				_data_->_tmp165_ = soup_server_message_get_response_headers (_data_->_tmp164_);
				_data_->_tmp166_ = _data_->vary_header;
				_data_->_tmp167_ = _data_->_tmp166_->str;
				soup_message_headers_replace (_data_->_tmp165_, "Vary", _data_->_tmp167_);
				_g_string_free0 (_data_->vary_header);
			}
		}
	}
	{
		_data_->_tmp168_ = ((RygelHTTPRequest*) _data_->self)->msg;
		_data_->_tmp169_ = soup_server_message_get_response_headers (_data_->_tmp168_);
		_data_->_tmp170_ = soup_message_headers_get_one (_data_->_tmp169_, "Content-Range");
		if (_data_->_tmp170_ != NULL) {
			_data_->response_code = (gint) SOUP_STATUS_PARTIAL_CONTENT;
		} else {
			_data_->response_code = (gint) SOUP_STATUS_OK;
		}
		_data_->_tmp171_ = ((RygelHTTPRequest*) _data_->self)->msg;
		soup_server_message_set_status (_data_->_tmp171_, (guint) _data_->response_code, NULL);
	}
	_data_->_tmp172_ = ((RygelHTTPRequest*) _data_->self)->msg;
	if (soup_server_message_get_http_version (_data_->_tmp172_) == SOUP_HTTP_1_0) {
		_data_->_tmp173_ = ((RygelHTTPRequest*) _data_->self)->msg;
		soup_server_message_set_http_version (_data_->_tmp173_, SOUP_HTTP_1_1);
		_data_->_tmp174_ = ((RygelHTTPRequest*) _data_->self)->msg;
		_data_->_tmp175_ = soup_server_message_get_response_headers (_data_->_tmp174_);
		soup_message_headers_append (_data_->_tmp175_, "Connection", "close");
	}
	g_debug ("rygel-http-get.vala:352: Following HTTP headers appended to response:");
	_data_->_tmp176_ = ((RygelHTTPRequest*) _data_->self)->msg;
	_data_->_tmp177_ = soup_server_message_get_response_headers (_data_->_tmp176_);
	soup_message_headers_foreach (_data_->_tmp177_, ___lambda18__soup_message_headers_foreach_func, _data_->self);
	_data_->_tmp178_ = ((RygelHTTPRequest*) _data_->self)->msg;
	_data_->_tmp179_ = soup_server_message_get_method (_data_->_tmp178_);
	if (g_strcmp0 (_data_->_tmp179_, "HEAD") == 0) {
		_data_->_tmp180_ = ((RygelHTTPRequest*) _data_->self)->msg;
		soup_server_message_unpause (_data_->_tmp180_);
		_g_object_unref0 (_data_->response);
		_soup_message_headers_unref0 (_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_->_tmp181_ = _data_->response;
	_data_->_state_ = 1;
	rygel_state_machine_run ((RygelStateMachine*) _data_->_tmp181_, rygel_http_get_handle_item_request_ready, _data_);
	return FALSE;
	_state_1:
	rygel_state_machine_run_finish ((RygelStateMachine*) _data_->_tmp181_, _data_->_res_);
	rygel_http_request_end ((RygelHTTPRequest*) _data_->self, (guint) SOUP_STATUS_NONE, NULL);
	_g_object_unref0 (_data_->response);
	_soup_message_headers_unref0 (_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.
 */
 G_GNUC_NO_INLINE 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;
}

