Closed ysair closed 1 year ago
call HttpGet('http://.....', nil, false, @status);
function HttpGet(const aURI: SockString; const inHeaders: SockString; outHeaders: PSockString; forceNotSocket: boolean; outStatus: PInteger): SockString; ... result := HttpGet(URI.Server,URI.Port,URI.Address,inHeaders,outHeaders,URI.Layer) else //lose outStatus ...
fix:
function HttpGet(const server, port: SockString; const url: SockString; const inHeaders: SockString; outHeaders: PSockString=nil; aLayer: TCrtSocketLayer = cslTCP; outStatus: PInteger=nil): SockString; overload; ... implementation ... function HttpGet(const server, port: SockString; const url: SockString; const inHeaders: SockString; outHeaders: PSockString; aLayer: TCrtSocketLayer; outStatus: PInteger): SockString; var Http: THttpClientSocket; status : Integer; begin result := ''; Http := OpenHttp(server,port,false,aLayer); if Http<>nil then try status := Http.Get(url,0,inHeaders); if outStatus <> nil then outStatus^ := status; if status in [STATUS_SUCCESS..STATUS_PARTIALCONTENT] then begin result := Http.Content; if outHeaders<>nil then outHeaders^ := Http.HeaderGetText; end; finally Http.Free; end; end; function HttpGet(const aURI: SockString; const inHeaders: SockString; outHeaders: PSockString; forceNotSocket: boolean; outStatus: PInteger): SockString; ... result := HttpGet(URI.Server,URI.Port,URI.Address,inHeaders,outHeaders,URI.Layer, outStatus) else ...
call HttpGet('http://.....', nil, false, @status);
fix: