+static int OpenWithCookies( vlc_object_t *p_this, vlc_array_t *cookies )
+{
+ access_t *p_access = (access_t*)p_this;
+ access_sys_t *p_sys;
+ char *psz, *p;
+ /* Only forward an store cookies if the corresponding option is activated */
+ vlc_bool_t b_forward_cookies = var_CreateGetBool( p_access, "http-forward-cookies" );
+ vlc_array_t * saved_cookies = b_forward_cookies ? (cookies ?: vlc_array_new()) : NULL;
+
+ /* Set up p_access */
+ STANDARD_READ_ACCESS_INIT;
+#ifdef HAVE_ZLIB_H
+ p_access->pf_read = ReadCompressed;
+#endif
+ p_sys->fd = -1;
+ p_sys->b_proxy = VLC_FALSE;
+ p_sys->i_version = 1;
+ p_sys->b_seekable = VLC_TRUE;
+ p_sys->psz_mime = NULL;
+ p_sys->psz_pragma = NULL;
+ p_sys->b_mms = VLC_FALSE;
+ p_sys->b_icecast = VLC_FALSE;
+ p_sys->psz_location = NULL;
+ p_sys->psz_user_agent = NULL;
+ p_sys->b_pace_control = VLC_TRUE;
+ p_sys->b_ssl = VLC_FALSE;
+#ifdef HAVE_ZLIB_H
+ p_sys->b_compressed = VLC_FALSE;
+ /* 15 is the max windowBits, +32 to enable optional gzip decoding */
+ if( inflateInit2( &p_sys->inflate.stream, 32+15 ) != Z_OK )
+ msg_Warn( p_access, "Error during zlib initialisation: %s",
+ p_sys->inflate.stream.msg );
+ if( zlibCompileFlags() & (1<<17) )
+ msg_Warn( p_access, "Your zlib was compiled without gzip support." );
+ p_sys->inflate.p_buffer = NULL;
+#endif
+ p_sys->p_tls = NULL;
+ p_sys->p_vs = NULL;
+ p_sys->i_icy_meta = 0;
+ p_sys->psz_icy_name = NULL;
+ p_sys->psz_icy_genre = NULL;
+ p_sys->psz_icy_title = NULL;
+ p_sys->i_remaining = 0;
+
+ p_sys->cookies = saved_cookies;
+
+ /* Parse URI - remove spaces */
+ p = psz = strdup( p_access->psz_path );
+ while( (p = strchr( p, ' ' )) != NULL )
+ *p = '+';
+ vlc_UrlParse( &p_sys->url, psz, 0 );
+ free( psz );
+
+ if( p_sys->url.psz_host == NULL || *p_sys->url.psz_host == '\0' )