Clipper On Line • Ver Tópico - Correção upload usando hbtip

Correção upload usando hbtip

Projeto Harbour - Compilador de código aberto compatível com o Clipper.

Moderador: Moderadores

 

Correção upload usando hbtip

Mensagempor Itamar M. Lins Jr. » 24 Fev 2014 09:55

Hello,

While testing TIPClientHTTP to POST some data to a Web Server, I found a problem... If I POST text/plain data, it work fine as expected. But if I try to send a binary file, it will fail. Looking at TIP source, right at PostMultiPart method of TIPClientHTTP class, I found that the file reading method does not work with binary files.

The cBuf := FReadStr(nFile, @cBuf, nBuf) will fail only and when the read file is a binary one (pdf, zip, images, etc). Since FReadStr stops at CHR(0), it is not right for this kind of method, because the user can read any kind of file... am I right? This bug exists in xHarbour too.

In Harbour
contrib\hbtip\httpcli.prg

In xHarbour
source\tip\httpcln.prg

Best Regards

Alexandre Alencar
Aspec Informática

2014-02-21 16:23 UTC+0100 Viktor Szakáts (vszakats users.noreply.github.com)
  * contrib/hbtip/httpcli.prg
    ! TIPClientHTTP():PostMultiPart() fixed to not RTE on various wrong
      input parameters passed via TIPClientHTTP():Attach()
    ! TIPClientHTTP():PostMultiPart() changed to use filename parsing
      core APIs instead of using local, non-portable implementation
    % TIPClientHTTP():PostMultiPart() optimizations (larger buffer, string
      building, loop, FOpen() mode, etc)
    ! TIPClientHTTP():PostMultiPart() fixed to always read in binary
      mode (callers' responsibility to configure mime-type correctly).
      See: https://groups.google.com/forum/#!topic/harbour-users/wOsubO8oifk
    ; (build tested only)


Penso que é uma importante correção.
Inclusive esse bug, conforme relatado tem no xHarbour também.

Saudações,
Itamar M. Lins Jr.
Avatar de usuário

Itamar M. Lins Jr.
Colaborador

Colaborador
 
Mensagens: 6927
Data de registro: 30 Mai 2007 11:31
Cidade/Estado: Ilheus Bahia
Curtiu: 309 vezes
Mens.Curtidas: 503 vezes



Retornar para Harbour

Quem está online

Usuários vendo este fórum: Nenhum usuário registrado online e 8 visitantes


Ola Amigo, espero que meu site e forum tem lhe beneficiado, com exemplos e dicas de programacao.
Entao divulgue o link da Doacao abaixo para seus amigos e redes sociais ou faça uma doacao para o site forum...
MUITO OBRIGADO PELA SUA DOACAO!
Faça uma doação para o forum
cron
v
Olá visitante, seja bem-vindo ao Fórum Clipper On Line!
Efetue o seu login ou faça o seu Registro