본문 바로가기
Application/Delphi Lecture

indy 를 이용한 웹서버 파일 크기 알기

by 현이빈이 2008. 8. 13.
반응형

Http.Head(URL);
dwFileSize := StrToInt(HTTP.Response.RawHeaders.Values['Content-Length'];


-----------------------------------------------------------------------------------



Memo1.Clear;
IdHTTP1.Head(URL);
Memo1.Lines.Add(IdHTTP1.Response.RawHeaders.Text);

이렇게 하면

Date: Tue, 06 Jul 2004 23:57:44 GMT
Server: Apache/1.3.27 (Unix) PHP/4.3.2
Last-Modified: Mon, 07 Jun 2004 08:43:47 GMT
ETag: "5dc037-8b5000-40c42ac3"
Accept-Ranges: bytes
Content-Length: 9129984
Connection: close
Content-Type: audio/mpeg

이렇게 결과가 나옵니다. 여기서
Content-Length: 9129984 여기를 추출해내면 간다하게됩니다. ^^

참고로 http의 전송명령 형식은
get, post, head, put이 있습니다.
일반적으로 get과 post를 많이 씁니다.
head는 server에서 get이나 post의 결과값중 header부분만을 전송해줍니다.
이방식이 이를 이용한거고요

반응형