Visual Basic - Compresion GZIP con Inet

Life is soft - evento anual de software empresarial
 
Vista:

Compresion GZIP con Inet

Publicado por Fernando Borda (2 intervenciones) el 22/02/2008 11:20:10
Hola, tengo un problema cuando uso compresion gzip en el control Microsoft Internet Transfer Control (Inet). Por ejemplo...para realizar una peticion GET a una web (sin compresion gzip) hago lo siguiente:
____________________________________________
Private Sub Command1_Click()
Inet1.Execute "http://www.google.com.ar", "GET"
End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)
Select Case State
Case icResponseReceived ' 12
Dim vtData As Variant ' Variable de datos.
Dim strData As String: strData = ""
Dim bDone As Boolean: bDone = False
' Obtiene el primer bloque.
vtData = Inet1.GetChunk(1024, icString)
DoEvents
Do While Not bDone
strData = strData & vtData
DoEvents
' Obtiene el bloque siguiente.
vtData = Inet1.GetChunk(1024, icString)
If Len(vtData) = 0 Then
bDone = True
End If
Loop

txtData.Text = strData
End Select
End Sub
____________________________________________

Ahí anda todo bien, pero para hacer que funcione con compresion gzip lo hago asi:

En lugar de
Inet1.Execute "http://www.google.com.ar", "GET"

Pongo el encabezado "Accept-Encoding: gzip,deflate"
Inet1.Execute "http://www.google.com.ar", "GET", "", "Content-Type: application/x-www-form-urlencoded" & vbCrLf & "Accept-Language: en-us" & vbCrLf & "Accept-Encoding: gzip, deflate" & vbCrLf & "User-Agent: Mozilla/4.0 (compatiable; MSIE 6.0; Windows NT 5.1; yie6; www.ASPSimply.com; .NET CLR 1.0.3705)"

Osea que la peticion es:
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Content-Type: application/x-www-form-urlencoded
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatiable; MSIE 6.0; Windows NT 5.1; yie6; www.ASPSimply.com; .NET CLR 1.0.3705)
Host: www.google.com.ar
Cache-Control: no-cache

Hasta ahi funciona perfecto, me devuelve los datos comprimidos, aca viene el error:

Cuando quiero leer el dato
vtData = Inet1.GetChunk(1024, icString)
Me sale el error 13 "El tipo no coincide"

Alguna solucion?
Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder