From 6c943736098d4d6fbbaefcf558c5c16a060219e6 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 11 Aug 2006 11:04:38 +0000 Subject: Added http.c from 1.4. Added support for estream and gnutls. --- common/estream.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'common/estream.c') diff --git a/common/estream.c b/common/estream.c index c2030371b..c523f09b1 100644 --- a/common/estream.c +++ b/common/estream.c @@ -559,7 +559,7 @@ static es_cookie_io_functions_t estream_functions_mem = es_func_mem_read, es_func_mem_write, es_func_mem_seek, - es_func_mem_destroy, + es_func_mem_destroy }; /* Implementation of fd I/O. */ @@ -1402,16 +1402,19 @@ es_writen (estream_t ES__RESTRICT stream, if (! (stream->flags & ES_FLAG_WRITING)) { /* Switching to writing mode -> discard input data and seek to - position at which reading has stopped. */ - - err = es_seek (stream, 0, SEEK_CUR, NULL); - if (err) - { - if (errno == ESPIPE) - err = 0; - else - goto out; - } + position at which reading has stopped. We can do this only + if a seek function has been registered. */ + if (stream->intern->func_seek) + { + err = es_seek (stream, 0, SEEK_CUR, NULL); + if (err) + { + if (errno == ESPIPE) + err = 0; + else + goto out; + } + } } switch (stream->intern->strategy) -- cgit v1.2.3