I've been working up an INetLib application. The code, stripped to its 
essence (remove all error checking, error messages, waiting for events, 
etc), is below; as near as I can tell this is essentially identical to 
the sequence of commands found in the INetLow sample code.

But here's what happens:

1) With INetLow, which uses inetCompressionTypeNone, I can enter 
www.google.com and get back "expected" results which look like this: 
"<html><head><title>GoogleSearch</title><meta name..."

2) If I use inetCompressionTypeNone in the code below, I get back 
gibberish bytes, unrecognizable as English.

3) If I use inetCompressionTypeBitPacked in the code below, I get back 
English, but missing all the HTML code. The first bytes that come back 
are "Google Search", missing the "<html><head><title>...</title> etc. The 
rest of the page is similarly stripped, and missing bytes as well.

4) If I use a different web site (one of our own), I get the same result 
- all HTML code stripped out, and I'm missing some bytes, maybe I get the 
first 30 bytes of "real" content and then it skips a bunch and then I get 
the last 100 bytes or so of "real" content (again, missing all the HTML). 
Changing the "inclHeader" from true to false in the code below doesn't 
make a difference.

What is going on here? 

err = SysLibFind("INet.lib", &iNetLibRefNum);
StrCopy(configName.name,inetCfgNameCTPDefault);
INetLibConfigIndexFromName(iNetLibRefNum,&configName,&IFInstance);
INetLibOpen(iNetLibRefNum,IFInstance,0,0,0,&iNetH);
convAlgorithm=inetCompressionTypeBitPacked; //inetCompressionTypeNone;
INetLibSettingSet(iNetLibRefNum,iNetH,inetSettingConvAlgorithm,&convAlgorit
hm,4);
INetLibSockOpen(iNetLibRefNum,iNetH,inetSchemeHTTP,&sockH);
StrCat(theMess,"GET");
StrCopy(c,"http://www.google.com");
INetLibSockHTTPReqCreate(iNetLibRefNum,sockH,(Byte*)theMess,(Byte*)c,0);
inclHeader=true;
INetLibSockHTTPAttrSet(iNetLibRefNum,sockH,inetHTTPAttrIncHTTP,0,(Byte*)&in
clHeader,4,0);
StrCopy(c,"");
postLen=StrLen(c);
INetLibSockHTTPReqSend(iNetLibRefNum,sockH,c,postLen,1000L);
cst=MemPtrNew(4096);
if (cst) MemSet(cst,4096,0);
b=(Byte*)cst;
actBytes=1;
while (actBytes!=0) {
    
INetLibSockRead(tempPrefsP->iNetLibRefNum,tempPrefsP->sockH,b,4095-StrLen(c
st),&actBytes,1000L);
    b+=actBytes;
}
FrmCustomAlert(infoAlert,cst,"","");
MemPtrFree(cst);
err=INetLibSockClose(iNetLibRefNum,sockH);

Steve Patt
President, Stevens Creek Software
  http://www.stevenscreek.com/palm
  Best PQA ("ePQA"), PalmSource 99
  Best Application ("PizzaScan"), Palm Developer's Conference 1998
  First printing software for the Palm - September, 1997



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to