From ef17f9a4277e587c586307550029e3a912fdcf95 Mon Sep 17 00:00:00 2001 From: Bill C Riemers Date: Mon, 16 Jun 2008 11:46:47 -0400 Subject: [PATCH] access_http: do not close the stream when seeking out of range MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit + minor simplifications Signed-off-by: Rémi Denis-Courmont --- modules/access/http.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/access/http.c b/modules/access/http.c index 2b7768ab6b..f7a2995d5a 100644 --- a/modules/access/http.c +++ b/modules/access/http.c @@ -881,6 +881,17 @@ static int Seek( access_t *p_access, int64_t i_pos ) Disconnect( p_access ); + if( p_access->info.i_size + && (uint64_t)i_pos >= (uint64_t)p_access->info.i_size ) { + msg_Err( p_access, "seek to far" ); + int retval = Seek( p_access, p_access->info.i_size - 1 ); + if( retval == VLC_SUCCESS ) { + uint8_t p_buffer[2]; + Read( p_access, p_buffer, 1); + p_access->info.b_eof = false; + } + return retval; + } if( Connect( p_access, i_pos ) ) { msg_Err( p_access, "seek failed" ); -- 2.39.5