TsgcHTTPServer › 속성 › ParseParams

ParseParams 속성

모든 요청의 쿼리 문자열과 form-urlencoded 본문을 ARequestInfo.Params로 파싱합니다.

구문

property ParseParams: Boolean read GetParseParams write SetParseParams;

기본값

True

설명

ParseParams가 True이면(기본값), 하위 Indy HTTP 서버는 요청의 쿼리 문자열을 디코딩하고, application/x-www-form-urlencoded POST 본문의 경우 폼 필드까지 디코딩하여, OnCommandGet / OnCommandOther 내부의 ARequestInfo.Params를 통해 모든 이름/값 쌍을 사용할 수 있게 합니다. 예를 들어 서버가 주로 원시 JSON이나 바이너리 본문을 ARequestInfo.PostStream에서 직접 읽고 추가 파싱이 낭비가 되는 경우, 이 파싱 단계를 건너뛰려면 False로 설정하십시오.

예제


oServer := TsgcHTTPServer.Create(nil);
oServer.ParseParams := true;

procedure OnCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo;
  AResponseInfo: TIdHTTPResponseInfo);
begin
  AResponseInfo.ContentText := 'name=' + ARequestInfo.Params.Values['name'];
end;

속성으로 돌아가기