Sane fix from upstream to fix the problem with connecting to UTF8 capable
ftp sites.
This commit is contained in:
parent
228e47bd87
commit
46f473bcfb
2 changed files with 61 additions and 16 deletions
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: distinfo,v 1.47 2009/09/16 07:13:20 hasso Exp $
|
||||
$NetBSD: distinfo,v 1.48 2009/09/16 11:34:23 hasso Exp $
|
||||
|
||||
SHA1 (lftp-4.0.0.tar.bz2) = 908397b581a68e6206ade4f798a68d8390aebf42
|
||||
RMD160 (lftp-4.0.0.tar.bz2) = 7ca6ee013733180bc3b45db13dda1b1eb2cd9acc
|
||||
|
@ -11,4 +11,4 @@ SHA1 (patch-ae) = 3ee418b94cc1afb7b2db5bc550fd966d346368a4
|
|||
SHA1 (patch-af) = 69c414ab28cbdfb86e4981fb7eaa7985b8384838
|
||||
SHA1 (patch-ag) = 9eda126e106cee0cae6be691ad8bece921c9c0a9
|
||||
SHA1 (patch-ah) = 0fe8a0d179cca0d747d5b43e0db1617d22e0cc3a
|
||||
SHA1 (patch-ai) = 6c791df94400c74475de977daf38078080209231
|
||||
SHA1 (patch-ai) = cd6720e86c8809fe1606c534519ce2797afc84c9
|
||||
|
|
|
@ -1,20 +1,65 @@
|
|||
$NetBSD: patch-ai,v 1.1 2009/09/16 07:13:20 hasso Exp $
|
||||
$NetBSD: patch-ai,v 1.2 2009/09/16 11:34:23 hasso Exp $
|
||||
|
||||
--- src/buffer.cc.orig 2009-09-16 09:56:27 +0300
|
||||
+++ src/buffer.cc 2009-09-16 09:57:15 +0300
|
||||
@@ -313,6 +313,7 @@ DataRecoder::~DataRecoder()
|
||||
--- src/buffer.cc.orig
|
||||
+++ src/buffer.cc
|
||||
@@ -247,11 +247,6 @@ void DataTranslator::AppendTranslated(Bu
|
||||
#ifdef HAVE_ICONV
|
||||
void DataRecoder::PutTranslated(Buffer *target,const char *put_buf,int size)
|
||||
{
|
||||
- if(!backend_translate)
|
||||
- {
|
||||
- target->Put(put_buf,size);
|
||||
- return;
|
||||
- }
|
||||
bool from_untranslated=false;
|
||||
if(Size()>0)
|
||||
{
|
||||
@@ -261,6 +256,13 @@ void DataRecoder::PutTranslated(Buffer *
|
||||
}
|
||||
if(size<=0)
|
||||
return;
|
||||
+ if(!backend_translate)
|
||||
+ {
|
||||
+ target->Put(put_buf,size);
|
||||
+ if(from_untranslated)
|
||||
+ Skip(size);
|
||||
+ return;
|
||||
+ }
|
||||
size_t put_size=size;
|
||||
|
||||
int size_coeff=6;
|
||||
@@ -313,20 +315,23 @@ DataRecoder::~DataRecoder()
|
||||
}
|
||||
DataRecoder::DataRecoder(const char *from_code,const char *to_code,bool translit)
|
||||
{
|
||||
+#if !defined(__NetBSD__) && !defined(__DragonFly__)
|
||||
if(translit)
|
||||
{
|
||||
const char *add="//TRANSLIT";
|
||||
@@ -320,6 +321,7 @@ DataRecoder::DataRecoder(const char *fro
|
||||
strcat(tmp_enc,add);
|
||||
to_code=tmp_enc;
|
||||
- if(translit)
|
||||
- {
|
||||
- const char *add="//TRANSLIT";
|
||||
- char *tmp_enc=alloca_strdup2(to_code,strlen(add));
|
||||
- strcat(tmp_enc,add);
|
||||
- to_code=tmp_enc;
|
||||
+ backend_translate=0;
|
||||
+
|
||||
+ if(translit) {
|
||||
+ const char *to_code_translit=xstring::cat(to_code,"//TRANSLIT",NULL);
|
||||
+ backend_translate=iconv_open(to_code_translit,from_code);
|
||||
+ if(backend_translate!=(iconv_t)-1)
|
||||
+ return;
|
||||
+ backend_translate=0;
|
||||
}
|
||||
+#endif
|
||||
+
|
||||
backend_translate=iconv_open(to_code,from_code);
|
||||
if(backend_translate==(iconv_t)-1)
|
||||
{
|
||||
- if(backend_translate==(iconv_t)-1)
|
||||
- {
|
||||
- Log::global->Format(0,"iconv_open(%s,%s) failed: %s\n",
|
||||
+ if(backend_translate!=(iconv_t)-1)
|
||||
+ return;
|
||||
+
|
||||
+ Log::global->Format(0,"iconv_open(%s,%s) failed: %s\n",
|
||||
to_code,from_code,strerror(errno));
|
||||
- backend_translate=0;
|
||||
- }
|
||||
+ backend_translate=0;
|
||||
}
|
||||
|
||||
void DirectedBuffer::SetTranslation(const char *enc,bool translit)
|
||||
|
|
Loading…
Reference in a new issue