WebSetEncoding Function

Action

Compresses the data of the next WebUrl* or WebPage* function with the gzip or zlib (deflate) algorithm.

Include file

WebAPI.bdh

Syntax

WebSetEncoding( in nEncodingKind : number );
Parameter Description
nEncodingKind

Can be one of following values:

  • WEB_ENCODING_NONE
  • WEB_ENCODING_GZIP
  • WEB_ENCODING_ZLIB

Example

dcltrans
  transaction TmyTrans1
  var sData : string;
  begin
    WebHeaderAdd("Content-Encoding", "gzip");
    WebSetEncoding(WEB_ENCODING_GZIP);
    WebPagePost("http://demo.borland.com/TestSite/rawData2Html.asp", 
                "Zip This Text With GZIP Before Sending To Server"); 

    WebHeaderAdd("Content-Encoding", "deflate");
    WebSetEncoding(WEB_ENCODING_ZLIB);
    WebPagePost("http://demo.borland.com/TestSite/rawData2Html.asp", 
                "Zip This Text With ZLIB Before Sending To Server");
                
    sData := "Zip This Text With GZIP Before Sending To Server";
    WebHeaderAdd("Content-Encoding", "gzip");
    WebSetEncoding(WEB_ENCODING_GZIP);
    WebUrlPostBin("http://demo.borland.com/TestSite/rawData2Html.asp", 
                  sData, binlen(sData), "text", 0.0);

    sData := "Zip This Text With ZLIB Before Sending To Server";
    WebHeaderAdd("Content-Encoding", "deflate");
    WebSetEncoding(WEB_ENCODING_ZLIB);