Difference between revisions of "Unit HTTP"

From Ultibo.org
Jump to: navigation, search
Line 1,120: Line 1,120:
  
  
'''HTTP buffer'''
+
'''HTTP helper classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>THTTPBuffer = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPBuffer|<code>THTTPBuffer = class(TObject)</code>]]
|-
+
| <code>constructor Create(ASize:LongWord);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FData:Pointer;</code>
+
| &nbsp;
+
|-
+
| <code>FSize:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FCount:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FStart:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetCount:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Count:LongWord read GetCount;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure Clear;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReadData:Char;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteData(AChar:Char):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReadLock(var ASize:LongWord):Pointer;</code>
+
| &nbsp;
+
|-
+
| <code>function ReadUnlock(ACount:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function WriteLock(var ASize:LongWord):Pointer;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteUnlock(ACount:LongWord):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
  
'''HTTP parameter'''
+
'''HTTP common classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>THTTPParam = class(TListObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>constructor Create(const AName:String);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FName:String;</code>
+
| &nbsp;
+
|-
+
| <code>FHash:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FValue:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Name:String read FName;</code>
+
| &nbsp;
+
|-
+
| <code>property Hash:LongWord read FHash;</code>
+
| &nbsp;
+
 
|-
 
|-
| <code>property Value:String read FValue write FValue;</code>
+
| [[THTTPParam|<code>THTTPParam = class(TListObject)</code>]]
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP parameters'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPParams = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPParams|<code>THTTPParams = class(TObject)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FParams:TLinkedObjList;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>procedure Clear;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetCount:Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp; 
+
|-
+
| <code>function GetParam(APrevious:THTTPParam):THTTPParam;</code>
+
| &nbsp;
+
|-
+
| <code>function FindParam(const AName:String):THTTPParam;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp; 
+
|-
+
| <code>function AddParam(const AName,AValue:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeleteParam(const AName:String):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div> 
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP header'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPHeader = class(TListObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPHeader|<code>THTTPHeader = class(TListObject)</code>]]
|-
+
| <code>constructor Create(const AName:String);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FName:String;</code>
+
| &nbsp;
+
|-
+
| <code>FHash:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FValues:TLinkedStringList;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Name:String read FName;</code>
+
| &nbsp;
+
|-
+
| <code>property Hash:LongWord read FHash;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetCount:Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp; 
+
|-
+
| <code>function GetValue(AIndex:Integer):String;</code>
+
| &nbsp;
+
|-
+
| <code>function SetValue(AIndex:Integer; const AValue:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function FindValue(const AValue:String):Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp; 
+
|-
+
| <code>function AddValue(const AValue:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeleteValue(const AValue:String):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP headers'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPHeaders = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPHeaders|<code>THTTPHeaders = class(TObject)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FHeaders:TLinkedObjList;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>procedure Clear;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetCount:Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetHeader(APrevious:THTTPHeader):THTTPHeader;</code>
+
| &nbsp;
+
|-
+
| <code>function FindHeader(const AName:String):THTTPHeader;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddHeader(const AName,AValue:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeleteHeader(const AName:String):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
  
'''HTTP client request'''
+
'''HTTP client classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>THTTPClientRequest = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPClientRequest|<code>THTTPClientRequest = class(TObject)</code>]]
|-
+
| <code>constructor Create(AClient:THTTPClient);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FFlags:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetLineSent:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function GetHeadersSent:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function GetContentSent:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FClient:THTTPClient;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>URL:String;</code>
+
| &nbsp;
+
|-
+
| <code>Method:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>Version:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>Params:THTTPParams;</code>
+
| &nbsp;
+
|-
+
| <code>Headers:THTTPHeaders;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>Protocol:String;</code>
+
| &nbsp;
+
|-
+
| <code>Host:String;</code>
+
| &nbsp;
+
|-
+
| <code>Port:String;</code>
+
| &nbsp;
+
|-
+
| <code>Path:String;</code>
+
| &nbsp;
+
|-
+
| <code>Query:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>ContentStream:TStream;</code>
+
| &nbsp;
+
|-
+
| <code>ContentString:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>RedirectCount:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Flags:LongWord read FFlags;</code>
+
| &nbsp;
+
|-
+
| <code>property Client:THTTPClient read FClient;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property LineSent:Boolean read GetLineSent;</code>
+
| &nbsp;
+
|-
+
| <code>property HeadersSent:Boolean read GetHeadersSent;</code>
+
| &nbsp;
+
|-
+
| <code>property ContentSent:Boolean read GetContentSent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function Close:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function Clear:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SetParam(const AName,AValue:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SetParamEx(const AName,AValue:String; AReplace:Boolean):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SetHeader(const AName,AValue:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SetHeaderEx(const AName,AValue:String; AReplace:Boolean):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function WriteRequest:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function WriteLine:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteHeaders:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteContentStream(AContent:TStream; ASize:LongWord; ACompleted:Boolean):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteContentString(const AContent:String; ASize:LongWord; ACompleted:Boolean):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP client response'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPClientResponse = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPClientResponse|<code>THTTPClientResponse = class(TObject)</code>]]
|-
+
| <code>constructor Create(AClient:THTTPClient);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FFlags:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetContentReceived:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetNoCache:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetNoCache(ANoCache:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>function GetConnectionClose:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetConnectionClose(AConnectionClose:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FClient:THTTPClient;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>Reason:String;</code>
+
| &nbsp;
+
|-
+
| <code>Status:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>Version:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>Headers:THTTPHeaders;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Flags:LongWord read FFlags;</code>
+
| &nbsp;
+
|-
+
| <code>property Client:THTTPClient read FClient;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp; 
+
|-
+
| <code>property ContentReceived:Boolean read GetContentReceived;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp; 
+
|-
+
| <code>property NoCache:Boolean read GetNoCache write SetNoCache;</code>
+
| &nbsp;
+
|-
+
| <code>property ConnectionClose:Boolean read GetConnectionClose write SetConnectionClose;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp; 
+
|-
+
| <code>function Clear:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetHeader(const AName:String):String;</code>
+
| &nbsp;
+
|-
+
| <code>function GetHeaderEx(const AName:String):TStringList;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindHeader(const AName,AValue:String):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReadContentStream(AContent:TStream; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReadContentString(var AContent:String; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP client'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPClient = class(TWinsock2TCPClient)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPClient|<code>THTTPClient = class(TWinsock2TCPClient)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FState:LongWord;</code>
+
| Internal request state
+
|-
+
| <code>FBuffer:THTTPBuffer;</code>
+
| Buffer for received data
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FRequest:THTTPClientRequest;</code>
+
| &nbsp;
+
|-
+
| <code>FResponse:THTTPClientResponse;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FTimeout:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FUserAgent:String;</code>
+
| &nbsp;
+
|-
+
| <code>FAllowRedirect:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>FMaxRedirects:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FKeepAlive:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>FKeepAliveTimeout:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FOnRedirect:THTTPRedirectEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnPassword:THTTPPasswordEvent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FHost:String;</code>
+
| &nbsp;
+
|-
+
| <code>FPort:String;</code>
+
| &nbsp;
+
|-
+
| <code>FUsername:String;</code>
+
| &nbsp;
+
|-
+
| <code>FPassword:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FProxyHost:String;</code>
+
| &nbsp;
+
|-
+
| <code>FProxyPort:String;</code>
+
| &nbsp;
+
|-
+
| <code>FProxyUsername:String;</code>
+
| &nbsp;
+
|-
+
| <code>FProxyPassword:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FURL:String;</code>
+
| &nbsp;
+
|-
+
| <code>FMethod:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FVersion:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FMimeType:String;</code>
+
| &nbsp;
+
|-
+
| <code>FRangeStart:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FRangeEnd:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FEncoding:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetTimeout(ATimeout:LongWord);</code>
+
| &nbsp;
+
|-
+
| <code>function GetUserAgent:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetUserAgent(const AUserAgent:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetAllowRedirect(AAllowRedirect:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetMaxRedirects(AMaxRedirects:LongWord);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetKeepAlive(AKeepAlive:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetKeepAliveTimeout(AKeepAliveTimeout:LongWord);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetHost:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetHost(const AHost:String);</code>
+
| &nbsp;
+
|-
+
| <code>function GetPort:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetPort(const APort:String);</code>
+
| &nbsp;
+
|-
+
| <code>function GetUsername:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetUsername(const AUsername:String);</code>
+
| &nbsp;
+
|-
+
| <code>function GetPassword:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetPassword(const APassword:String);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetProxyHost:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetProxyHost(const AProxyHost:String);</code>
+
| &nbsp;
+
|-
+
| <code>function GetProxyPort:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetProxyPort(const AProxyPort:String);</code>
+
| &nbsp;
+
|-
+
| <code>function GetProxyUsername:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetProxyUsername(const AProxyUsername:String);</code>
+
| &nbsp;
+
|-
+
| <code>function GetProxyPassword:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetProxyPassword(const AProxyPassword:String);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetURL:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetURL(const AURL:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetMethod(AMethod:LongWord);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetVersion(AVersion:LongWord);</code>
+
| &nbsp;
+
|-
+
| <code>function GetMimeType:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetMimeType(const AMimeType:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRangeStart(ARangeStart:LongWord);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRangeEnd(ARangeEnd:LongWord);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetEncoding(AEncoding:LongWord);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetResponseStatus:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>function GetResponseReason:String;</code>
+
| &nbsp;
+
|-
+
| <code>function GetResponseVersion:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>function GetResponseMimeType:String;</code>
+
| &nbsp;
+
|-
+
| <code>function GetResponseEncoding:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>function GetResponseContentSize:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function DoRedirect(const AURL:String; var ALocation:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DoPassword(var AUsername,APassword:String):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp; 
+
|-
+
| <code>function ReadResponseLine(AResponse:THTTPClientResponse):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReadResponseHeaders(AResponse:THTTPClientResponse):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReadResponseContentStream(AResponse:THTTPClientResponse; AContent:TStream; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReadResponseContentString(AResponse:THTTPClientResponse; var AContent:String; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp; 
+
|-
+
| <code>function WriteRequestLine(ARequest:THTTPClientRequest):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteRequestHeaders(ARequest:THTTPClientRequest):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteRequestContentStream(ARequest:THTTPClientRequest; AContent:TStream; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteRequestContentString(ARequest:THTTPClientRequest; const AContent:String; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Request:THTTPClientRequest read FRequest;</code>
+
| &nbsp;
+
|-
+
| <code>property Response:THTTPClientResponse read FResponse;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Timeout:LongWord read FTimeout write SetTimeout;</code>
+
| &nbsp;
+
|-
+
| <code>property UserAgent:String read GetUserAgent write SetUserAgent;</code>
+
| &nbsp;
+
|-
+
| <code>property AllowRedirect:Boolean read FAllowRedirect write SetAllowRedirect;</code>
+
| &nbsp;
+
|-
+
| <code>property MaxRedirects:LongWord read FMaxRedirects write SetMaxRedirects;</code>
+
| &nbsp;
+
|-
+
| <code>property KeepAlive:Boolean read FKeepAlive write SetKeepAlive;</code>
+
| &nbsp;
+
|-
+
| <code>property KeepAliveTimeout:LongWord read FKeepAliveTimeout write SetKeepAliveTimeout;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property OnRedirect:THTTPRedirectEvent read FOnRedirect write FOnRedirect;</code>
+
| &nbsp;
+
|-
+
| <code>property OnPassword:THTTPPasswordEvent read FOnPassword write FOnPassword;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Host:String read GetHost write SetHost;</code>
+
| &nbsp;
+
|-
+
| <code>property Port:String read GetPort write SetPort;</code>
+
| &nbsp;
+
|-
+
| <code>property Username:String read GetUsername write SetUsername;</code>
+
| &nbsp;
+
|-
+
| <code>property Password:String read GetPassword write SetPassword;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property ProxyHost:String read GetProxyHost write SetProxyHost;</code>
+
| &nbsp;
+
|-
+
| <code>property ProxyPort:String read GetProxyPort write SetProxyPort;</code>
+
| &nbsp;
+
|-
+
| <code>property ProxyUsername:String read GetProxyUsername write SetProxyUsername;</code>
+
| &nbsp;
+
|-
+
| <code>property ProxyPassword:String read GetProxyPassword write SetProxyPassword;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property RequestURL:String read GetURL write SetURL;</code>
+
| &nbsp;
+
|-
+
| <code>property RequestMethod:LongWord read FMethod write SetMethod;</code>
+
| &nbsp;
+
|-
+
| <code>property RequestVersion:LongWord read FVersion write SetVersion;</code>
+
| &nbsp;
+
|-
+
| <code>property RequestMimeType:String read GetMimeType write SetMimeType;</code>
+
| &nbsp;
+
|-
+
| <code>property RequestRangeStart:LongWord read FRangeStart write SetRangeStart;</code>
+
| &nbsp;
+
|-
+
| <code>property RequestRangeEnd:LongWord read FRangeEnd write SetRangeEnd;</code>
+
| &nbsp;
+
|-
+
| <code>property RequestEncoding:LongWord read FEncoding write SetEncoding;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property ResponseStatus:LongWord read GetResponseStatus;</code>
+
| &nbsp;
+
|-
+
| <code>property ResponseReason:String read GetResponseReason;</code>
+
| &nbsp;
+
|-
+
| <code>property ResponseVersion:LongWord read GetResponseVersion;</code>
+
| &nbsp;
+
|-
+
| <code>property ResponseMimeType:String read GetResponseMimeType;</code>
+
| &nbsp;
+
|-
+
| <code>property ResponseEncoding:LongWord read GetResponseEncoding;</code>
+
| &nbsp;
+
|-
+
| <code>property ResponseContentSize:LongWord read GetResponseContentSize;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function Head(const AURL:String):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetString(const AURL:String; var AContent:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function GetStream(const AURL:String; AContent:TStream):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function PostString(const AURL:String; var AContent:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function PostStream(const AURL:String; AContent:TStream):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp; 
+
|-
+
| <code>function SendRequest:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function CloseRequest(Close:Boolean):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ClearRequest:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function CancelRequest:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SetRequestParam(const AName,AValue:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SetRequestParamEx(const AName,AValue:String; AReplace:Boolean):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SetRequestHeader(const AName,AValue:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SetRequestHeaderEx(const AName,AValue:String; AReplace:Boolean):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SetRequestContentStream(AContent:TStream):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function AddRequestContentString(const AContent:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SetRequestContentString(const AContent:String):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetResponseHeader(const AName:String):String;</code>
+
| &nbsp;
+
|-
+
| <code>function GetResponseHeaderEx(const AName:String):TStringList;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetResponseContentStream(AContent:TStream; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function GetResponseContentString(var AContent:String; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
 
'''HTTP server request'''
 
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
'''HTTP server classes'''
  
<code>THTTPServerRequest = class(TObject)</code>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPServerRequest|<code>THTTPServerRequest = class(TObject)</code>]]
|-
+
| <code>constructor Create(AThread:TWinsock2TCPServerThread);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FFlags:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FThread:TWinsock2TCPServerThread;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetContentReceived:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FListener:THTTPListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>URL:String;</code>
+
| &nbsp;
+
|-
+
| <code>Method:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>Version:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>Params:THTTPParams;</code>
+
| &nbsp;
+
|-
+
| <code>Headers:THTTPHeaders;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>Protocol:String;</code>
+
| &nbsp;
+
|-
+
| <code>Host:String;</code>
+
| &nbsp;
+
|-
+
| <code>Port:String;</code>
+
| &nbsp;
+
|-
+
| <code>Path:String;</code>
+
| &nbsp;
+
|-
+
| <code>Query:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>BasePath:String;</code>
+
| The base path of the document or alias matched to this request
+
|-
+
| <code>BaseHost:String;</code>
+
| The base name of the host or alias matched to this request
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Flags:LongWord read FFlags;</code>
+
| &nbsp;
+
|-
+
| <code>property Thread:TWinsock2TCPServerThread read FThread;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property ContentReceived:Boolean read GetContentReceived;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetParam(const AName:String):String;</code>
+
| &nbsp;
+
|-
+
| <code>function GetHeader(const AName:String):String;</code>
+
| &nbsp;
+
|-
+
| <code>function GetHeaderEx(const AName:String):TStringList;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindHeader(const AName,AValue:String):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReadContentStream(AContent:TStream; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReadContentString(var AContent:String; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP server response'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPServerResponse = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPServerResponse|<code>THTTPServerResponse = class(TObject)</code>]]
|-
+
| <code>constructor Create(AThread:TWinsock2TCPServerThread);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FFlags:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FThread:TWinsock2TCPServerThread;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetStatusSent:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function GetHeadersSent:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function GetContentSent:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetNoCache:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetNoCache(ANoCache:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>function GetConnectionClose:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetConnectionClose(AConnectionClose:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FListener:THTTPListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>Reason:String;</code>
+
| &nbsp;
+
|-
+
| <code>Status:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>Version:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>Headers:THTTPHeaders;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>ContentStream:TStream;</code>
+
| &nbsp;
+
|-
+
| <code>ContentString:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Flags:LongWord read FFlags;</code>
+
| &nbsp;
+
|-
+
| <code>property Thread:TWinsock2TCPServerThread read FThread;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property StatusSent:Boolean read GetStatusSent;</code>
+
| &nbsp;
+
|-
+
| <code>property HeadersSent:Boolean read GetHeadersSent;</code>
+
| &nbsp;
+
|-
+
| <code>property ContentSent:Boolean read GetContentSent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property NoCache:Boolean read GetNoCache write SetNoCache;</code>
+
| &nbsp;
+
|-
+
| <code>property ConnectionClose:Boolean read GetConnectionClose write SetConnectionClose;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SetHeader(const AName,AValue:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SetHeaderEx(const AName,AValue:String; AReplace:Boolean):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function WriteResponse:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function WriteStatus:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteHeaders:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteContentStream(AContent:TStream; ASize:LongWord; ACompleted:Boolean):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteContentString(const AContent:String; ASize:LongWord; ACompleted:Boolean):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP host'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPHost = class(TListObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPHost|<code>THTTPHost = class(TListObject)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FName:String;</code>
+
| &nbsp;
+
|-
+
| <code>FHash:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FFlags:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FDefaultMimeType:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FErrors:TLinkedList;</code>
+
| &nbsp;
+
|-
+
| <code>FAliases:TLinkedList;</code>
+
| &nbsp;
+
|-
+
| <code>FModules:TLinkedList;</code>
+
| &nbsp;
+
|-
+
| <code>FDocuments:TLinkedList;</code>
+
| &nbsp;
+
|-
+
| <code>FMimeTypes:TLinkedList;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FOnGet:THTTPHostEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnHead:THTTPHostEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnPost:THTTPHostEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnPut:THTTPHostEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnError:THTTPHostEvent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FOnRequest:THTTPHostEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnResponse:THTTPHostEvent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetName:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetName(const AName:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetFlags(AFlags:LongWord);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetDefaultMimeType:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetDefaultMimeType(const ADefaultMimeType:String);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetIsDefault:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetIsDefault(AIsDefault:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>function GetIsDomain:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetIsDomain(AIsDomain:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function MatchError(AStatus:LongWord):THTTPError; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function MatchDocument(const AName:String; var AAlias:THTTPAlias):THTTPDocument; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function DoGet(ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function DoHead(ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function DoPost(ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function DoPut(ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function DoError(ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function DoRequest(ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function DoResponse(ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Name:String read GetName write SetName;</code>
+
| &nbsp;
+
|-
+
| <code>property Hash:LongWord read FHash;</code>
+
| &nbsp;
+
|-
+
| <code>property Flags:LongWord read FFlags write SetFlags;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property IsDefault:Boolean read GetIsDefault write SetIsDefault;</code>
+
| &nbsp;
+
|-
+
| <code>property IsDomain:Boolean read GetIsDomain write SetIsDomain;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property DefaultMimeType:String read GetDefaultMimeType write SetDefaultMimeType;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property OnGet:THTTPHostEvent read FOnGet write FOnGet;</code>
+
| &nbsp;
+
|-
+
| <code>property OnHead:THTTPHostEvent read FOnHead write FOnHead;</code>
+
| &nbsp;
+
|-
+
| <code>property OnPost:THTTPHostEvent read FOnPost write FOnPost;</code>
+
| &nbsp;
+
|-
+
| <code>property OnPut:THTTPHostEvent read FOnPut write FOnPut;</code>
+
| &nbsp;
+
|-
+
| <code>property OnError:THTTPHostEvent read FOnError write FOnError;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property OnRequest:THTTPHostEvent read FOnRequest write FOnRequest;</code>
+
| &nbsp;
+
|-
+
| <code>property OnResponse:THTTPHostEvent read FOnResponse write FOnResponse;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindError(AStatus:LongWord):THTTPError;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RegisterError(AError:THTTPError):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeregisterError(AError:THTTPError):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindAlias(const AName:String):THTTPAlias;</code>
+
| &nbsp;
+
|-
+
| <code>function MatchAlias(const AName:String):THTTPAlias; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RegisterAlias(AAlias:THTTPAlias):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeregisterAlias(AAlias:THTTPAlias):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetModule(APrevious:THTTPModule):THTTPModule;</code>
+
| &nbsp;
+
|-
+
| <code>function FindModule(AModule:THTTPModule):THTTPModule;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RegisterModule(AModule:THTTPModule):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeregisterModule(AModule:THTTPModule):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindDocument(const AName:String):THTTPDocument;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RegisterDocument(ADocument:THTTPDocument):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeregisterDocument(ADocument:THTTPDocument):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function LoadMimeTypes:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindMimeType(const AExtension:String):THTTPMimeType;</code>
+
| &nbsp;
+
|-
+
| <code>function ResolveMimeType(const AExtension:String):String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RegisterMimeType(AMimeType:THTTPMimeType):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeregisterMimeType(AMimeType:THTTPMimeType):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP error'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPError = class(TListObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPError|<code>THTTPError = class(TListObject)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FFlags:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FStatus:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FOnError:THTTPErrorEvent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetFlags(AFlags:LongWord);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetStatus(AStatus:LongWord);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetIsDefault:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetIsDefault(AIsDefault:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function DoError(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Flags:LongWord read FFlags write SetFlags;</code>
+
| &nbsp;
+
|-
+
| <code>property Status:LongWord read FStatus write SetStatus;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property IsDefault:Boolean read GetIsDefault write SetIsDefault;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property OnError:THTTPErrorEvent read FOnError write FOnError;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP alias'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPAlias = class(TListObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPAlias|<code>THTTPAlias = class(TListObject)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TMutexHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FName:String;</code>
+
| &nbsp;
+
|-
+
| <code>FHash:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetName:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetName(const AName:String);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Name:String read GetName write SetName;</code>
+
| &nbsp;
+
|-
+
| <code>property Hash:LongWord read FHash;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP module'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPModule = class(TListObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FFlags:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FOnRequest:THTTPModuleEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnResponse:THTTPModuleEvent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetFlags(AFlags:LongWord);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function DoRequest(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function DoResponse(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Flags:LongWord read FFlags write SetFlags;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property OnRequest:THTTPModuleEvent read FOnRequest write FOnRequest;</code>
+
| &nbsp;
+
 
|-
 
|-
| <code>property OnResponse:THTTPModuleEvent read FOnResponse write FOnResponse;</code>
+
| [[THTTPModule|<code>THTTPModule = class(TListObject)</code>]]
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP document'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPDocument = class(TListObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPDocument|<code>THTTPDocument = class(TListObject)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FName:String;</code>
+
| &nbsp;
+
|-
+
| <code>FHash:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FFlags:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FAliases:TLinkedList;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FOnGet:THTTPDocumentEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnHead:THTTPDocumentEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnPost:THTTPDocumentEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnPut:THTTPDocumentEvent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetName:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetName(const AName:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetFlags(AFlags:LongWord);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetIsDefault:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetIsDefault(AIsDefault:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>function GetIsFolder:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetIsFolder(AIsFolder:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>function GetIsSubtree:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetIsSubtree(AIsSubtree:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>function GetIsExtension:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetIsExtension(AIsExtension:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function DoGet(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function DoHead(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function DoPost(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function DoPut(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Name:String read GetName write SetName;</code>
+
| &nbsp;
+
|-
+
| <code>property Hash:LongWord read FHash;</code>
+
| &nbsp;
+
|-
+
| <code>property Flags:LongWord read FFlags write SetFlags;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property IsDefault:Boolean read GetIsDefault write SetIsDefault;</code>
+
| &nbsp;
+
|-
+
| <code>property IsFolder:Boolean read GetIsFolder write SetIsFolder;</code>
+
| &nbsp;
+
|-
+
| <code>property IsSubtree:Boolean read GetIsSubtree write SetIsSubtree;</code>
+
| &nbsp;
+
|-
+
| <code>property IsExtension:Boolean read GetIsExtension write SetIsExtension;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property OnGet:THTTPDocumentEvent read FOnGet write FOnGet;</code>
+
| &nbsp;
+
|-
+
| <code>property OnHead:THTTPDocumentEvent read FOnHead write FOnHead;</code>
+
| &nbsp;
+
|-
+
| <code>property OnPost:THTTPDocumentEvent read FOnPost write FOnPost;</code>
+
| &nbsp;
+
|-
+
| <code>property OnPut:THTTPDocumentEvent read FOnPut write FOnPut;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindAlias(const AName:String):THTTPAlias;</code>
+
| &nbsp;
+
|-
+
| <code>function MatchAlias(const AName:String):THTTPAlias; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RegisterAlias(AAlias:THTTPAlias):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeregisterAlias(AAlias:THTTPAlias):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP mime type'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPMimeType = class(TListObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPMimeType|<code>THTTPMimeType = class(TListObject)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TMutexHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FExtension:String;</code>
+
| &nbsp;
+
|-
+
| <code>FHash:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FMimeType:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetExtension:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetExtension(const AExtension:String);</code>
+
| &nbsp;
+
|-
+
| <code>function GetMimeType:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetMimeType(const AMimeType:String);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Extension:String read GetExtension write SetExtension;</code>
+
| &nbsp;
+
|-
+
| <code>property Hash:LongWord read FHash;</code>
+
| &nbsp;
+
|-
+
| <code>property MimeType:String read GetMimeType write SetMimeType;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP redirect'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPRedirect = class(THTTPDocument)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPRedirect|<code>THTTPRedirect = class(THTTPDocument)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLocation:String;</code>
+
| &nbsp;
+
|-
+
| <code>FPermanent:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetLocation:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetLocation(const ALocation:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetPermanent(APermanent:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function DoGet(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Location:String read GetLocation write SetLocation;</code>
+
| &nbsp;
+
|-
+
| <code>property Permanent:Boolean read FPermanent write SetPermanent;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP folder'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPFolder = class(THTTPDocument)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPFolder|<code>THTTPFolder = class(THTTPDocument)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FFolder:String;</code>
+
| &nbsp;
+
|-
+
| <code>FIndexPage:String;</code>
+
| &nbsp;
+
|-
+
| <code>FAllowCache:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>FAllowListing:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>FAllowSubtree:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetFolder:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetFolder(const AFolder:String);</code>
+
| &nbsp;
+
|-
+
| <code>function GetIndexPage:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetIndexPage(const AIndexPage:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetAllowCache(AAllowCache:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetAllowListing(AAllowListing:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetAllowSubtree(AAllowSubtree:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function DoGet(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function DoHead(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function DoGetFile(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse; const AFile:String):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function DoGetFolder(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse; const AFolder:String):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Folder:String read GetFolder write SetFolder;</code>
+
| &nbsp;
+
|-
+
| <code>property IndexPage:String read GetIndexPage write SetIndexPage;</code>
+
| &nbsp;
+
|-
+
| <code>property AllowCache:Boolean read FAllowCache write SetAllowCache;</code>
+
| &nbsp;
+
|-
+
| <code>property AllowListing:Boolean read FAllowListing write SetAllowListing;</code>
+
| &nbsp;
+
|-
+
| <code>property AllowSubtree:Boolean read FAllowSubtree write SetAllowSubtree;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP file'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPFile = class(THTTPDocument)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[THTTPFile|<code>THTTPFile = class(THTTPDocument)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FFilename:String;</code>
+
| &nbsp;
+
|-
+
| <code>FAllowCache:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetFilename:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetFilename(const AFilename:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetAllowCache(AAllowCache:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function DoGet(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function DoHead(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Filename:String read GetFilename write SetFilename;</code>
+
| &nbsp;
+
|-
+
| <code>property AllowCache:Boolean read FAllowCache write SetAllowCache;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''HTTP listener'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>THTTPListener = class(TWinsock2TCPListener)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FHost:THTTPHost;</code>
+
| Default Host
+
|-
+
| <code>FHosts:TLinkedList;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FServer:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetServer:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetServer(const AServer:String);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure DoConnect(AThread:TWinsock2TCPServerThread); override;</code>
+
| &nbsp;
+
|-
+
| <code>procedure DoDisconnect(AThread:TWinsock2TCPServerThread); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function DoExecute(AThread:TWinsock2TCPServerThread):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function MatchHost(const AName:String; var AAlias:THTTPAlias):THTTPHost;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetRequestLine(AThread:TWinsock2TCPServerThread; ARequest:THTTPServerRequest):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function GetRequestHeaders(AThread:TWinsock2TCPServerThread; ARequest:THTTPServerRequest):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function GetRequestContentStream(AThread:TWinsock2TCPServerThread; ARequest:THTTPServerRequest; AContent:TStream; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function GetRequestContentString(AThread:TWinsock2TCPServerThread; ARequest:THTTPServerRequest; var AContent:String; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendResponseLine(AThread:TWinsock2TCPServerThread; AResponse:THTTPServerResponse):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SendResponseHeaders(AThread:TWinsock2TCPServerThread; AResponse:THTTPServerResponse):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SendResponseContentStream(AThread:TWinsock2TCPServerThread; AResponse:THTTPServerResponse; AContent:TStream; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SendResponseContentString(AThread:TWinsock2TCPServerThread; AResponse:THTTPServerResponse; const AContent:String; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Server:String read GetServer write SetServer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindHost(const AName:String):THTTPHost;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RegisterHost(AHost:THTTPHost):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeregisterHost(AHost:THTTPHost):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindError(const AHost:String; AStatus:LongWord):THTTPError;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RegisterError(const AHost:String; AError:THTTPError):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeregisterError(const AHost:String; AError:THTTPError):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetModule(const AHost:String; APrevious:THTTPModule):THTTPModule;</code>
+
| &nbsp;
+
|-
+
| <code>function FindModule(const AHost:String; AModule:THTTPModule):THTTPModule;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RegisterModule(const AHost:String; AModule:THTTPModule):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeregisterModule(const AHost:String; AModule:THTTPModule):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindDocument(const AHost,AName:String):THTTPDocument;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RegisterDocument(const AHost:String; ADocument:THTTPDocument):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeregisterDocument(const AHost:String; ADocument:THTTPDocument):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function LoadMimeTypes(const AHost:String):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindMimeType(const AHost,AExtension:String):THTTPMimeType;</code>
+
| &nbsp;
+
|-
+
| <code>function ResolveMimeType(const AHost,AExtension:String):String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RegisterMimeType(const AHost:String; AMimeType:THTTPMimeType):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
| <code>function DeregisterMimeType(const AHost:String; AMimeType:THTTPMimeType):Boolean;</code>
+
| [[THTTPListener|<code>THTTPListener = class(TWinsock2TCPListener)</code>]]
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
 
<br />
 
<br />
  

Revision as of 06:24, 17 May 2018

Return to Unit Reference


Description


Ultibo HTTP interface unit

To be documented

Constants



HTTP specific constants HTTP_*
HTTP_TAB = Chr(9); Tab
HTTP_SPACE = Chr(32); Space
HTTP_DASH = '-'; -
HTTP_COLON = ':';  :
HTTP_LINE_END = Chr(13) + Chr(10); CR LF
 
HTTP_PORT_SEPARATOR = ':';  :
HTTP_PATH_SEPARATOR = '/'; /
HTTP_QUERY_SEPARATOR = '?';  ?
HTTP_PARAM_SEPARATOR = '='; =
HTTP_PARAM_DELIMITER = '&'; &
HTTP_HEADER_SEPARATOR = ':';  :
HTTP_BOOKMARK_SEPARATOR = '#'; #
HTTP_PROTOCOL_SEPARATOR = '://';  ://
 
HTTP_BUFFER_SIZE = SIZE_2K;  


HTTP date HTTP_DATE_*
HTTP_DATE_FORMAT_RFC1123 = 'ddd, dd mmm yyyy hh:nn:ss "GMT"'; RFC 822, updated by RFC 1123
HTTP_DATE_FORMAT_RFC850 = 'dddd, dd-mmm-yy hh:nn:ss "GMT"'; RFC 850, obsoleted by RFC 1036
HTTP_DATE_FORMAT_ANSIC = 'ddd mmm d hh:nn:ss yyyy'; ANSI C's asctime() format
 
HTTP_DATE_FORMAT = HTTP_DATE_FORMAT_RFC1123;  


HTTP client HTTP_*
HTTP_USERAGENT_STRING = 'Mozilla/5.0 (compatible; Ultibo/' + ULTIBO_RELEASE_VERSION + ')';  
HTTP_REQUEST_TIMEOUT = 60000; 60 seconds
HTTP_KEEPALIVE_TIMEOUT = 300; 300 seconds (5 minutes)
HTTP_MAX_REDIRECTS = 16;  
HTTP_PROXY_PORT_DEFAULT = 8080;  


HTTP server HTTP_SERVER_*
HTTP_SERVER_STRING = 'Ultibo/' + ULTIBO_RELEASE_VERSION;  


HTTP protocol HTTP_PROTOCOL_*
HTTP_PROTOCOL_NONE = 0;  
HTTP_PROTOCOL_HTTP = 1;  
HTTP_PROTOCOL_HTTPS = 2;  
 
HTTP_PROTOCOL_STRING_HTTP = 'http';  
HTTP_PROTOCOL_STRING_HTTPS = 'https';  


HTTP method HTTP_METHOD_*
HTTP_METHOD_NONE = 0;  
HTTP_METHOD_OPTIONS = 1;  
HTTP_METHOD_GET = 2;  
HTTP_METHOD_HEAD = 3;  
HTTP_METHOD_POST = 4;  
HTTP_METHOD_PUT = 5;  
HTTP_METHOD_DELETE = 6;  
HTTP_METHOD_TRACE = 7;  
HTTP_METHOD_CONNECT = 8;  
 
HTTP_METHOD_STRING_OPTIONS = 'OPTIONS';  
HTTP_METHOD_STRING_GET = 'GET';  
HTTP_METHOD_STRING_HEAD = 'HEAD';  
HTTP_METHOD_STRING_POST = 'POST';  
HTTP_METHOD_STRING_PUT = 'PUT';  
HTTP_METHOD_STRING_DELETE = 'DELETE';  
HTTP_METHOD_STRING_TRACE = 'TRACE';  
HTTP_METHOD_STRING_CONNECT = 'CONNECT';  


HTTP version HTTP_VERSION_*
HTTP_VERSION_00 = 0;  
HTTP_VERSION_10 = 1;  
HTTP_VERSION_11 = 2;  
 
HTTP_VERSION = HTTP_VERSION_11;  
 
HTTP_VERSION_STRING_10 = 'HTTP/1.0';  
HTTP_VERSION_STRING_11 = 'HTTP/1.1';  


HTTP encoding HTTP_ENCODING_*
HTTP_ENCODING_NONE = 0;  
HTTP_ENCODING_IDENTITY = 1;  
HTTP_ENCODING_CHUNKED = 2;  
HTTP_ENCODING_GZIP = 3;  
HTTP_ENCODING_COMPRESS = 4;  
HTTP_ENCODING_DEFLATE = 5;  
 
HTTP_ENCODING_STRING_IDENTITY = 'identity';  
HTTP_ENCODING_STRING_CHUNKED = 'chunked';  
HTTP_ENCODING_STRING_GZIP = 'gzip';  
HTTP_ENCODING_STRING_COMPRESS = 'compress';  
HTTP_ENCODING_STRING_DEFLATE = 'deflate';  


HTTP general header HTTP_GENERAL_HEADER_*
HTTP_GENERAL_HEADER_CACHE_CONTROL = 'Cache-Control';  
HTTP_GENERAL_HEADER_CONNECTION = 'Connection';  
HTTP_GENERAL_HEADER_DATE = 'Date';  
HTTP_GENERAL_HEADER_PRAGMA = 'Pragma';  
HTTP_GENERAL_HEADER_TRAILER = 'Trailer';  
HTTP_GENERAL_HEADER_TRANSFER_ENCODING = 'Transfer-Encoding';  
HTTP_GENERAL_HEADER_UPGRADE = 'Upgrade';  
HTTP_GENERAL_HEADER_VIA = 'Via';  
HTTP_GENERAL_HEADER_WARNING = 'Warning';  


HTTP request header HTTP_REQUEST_HEADER_*
HTTP_REQUEST_HEADER_ACCEPT = 'Accept';  
HTTP_REQUEST_HEADER_ACCEPT_CHARSET = 'Accept-Charset';  
HTTP_REQUEST_HEADER_ACCEPT_ENCODING = 'Accept-Encoding';  
HTTP_REQUEST_HEADER_ACCEPT_LANGUAGE = 'Accept-Language';  
HTTP_REQUEST_HEADER_AUTHORIZATION = 'Authorization';  
HTTP_REQUEST_HEADER_EXPECT = 'Expect';  
HTTP_REQUEST_HEADER_FROM = 'From';  
HTTP_REQUEST_HEADER_HOST = 'Host';  
HTTP_REQUEST_HEADER_IF_MATCH = 'If-Match';  
HTTP_REQUEST_HEADER_IF_MODIFIED_SINCE = 'If-Modified-Since';  
HTTP_REQUEST_HEADER_IF_NONE_MATCH = 'If-None-Match';  
HTTP_REQUEST_HEADER_IF_RANGE = 'If-Range'  
HTTP_REQUEST_HEADER_IF_UNMODIFIED_SINCE = 'If-Unmodified-Since';  
HTTP_REQUEST_HEADER_MAX_FORWARDS = 'Max-Forwards';  
HTTP_REQUEST_HEADER_PROXY_AUTH = 'Proxy-Authorization';  
HTTP_REQUEST_HEADER_RANGE = 'Range';  
HTTP_REQUEST_HEADER_REFERER = 'Referer';  
HTTP_REQUEST_HEADER_TE = 'TE';  
HTTP_REQUEST_HEADER_USER_AGENT = 'User-Agent';  


HTTP response header HTTP_RESPONSE_HEADER_*
HTTP_RESPONSE_HEADER_ACCEPT_RANGES = 'Accept-Ranges';  
HTTP_RESPONSE_HEADER_AGE = 'Age';  
HTTP_RESPONSE_HEADER_ETAG = 'ETag';  
HTTP_RESPONSE_HEADER_LOCATION = 'Location';  
HTTP_RESPONSE_HEADER_PROXY_AUTH = 'Proxy-Authenticate';  
HTTP_RESPONSE_HEADER_RETRY_AFTER = 'Retry-After';  
HTTP_RESPONSE_HEADER_SERVER = 'Server';  
HTTP_RESPONSE_HEADER_VARY = 'Vary';  
HTTP_RESPONSE_HEADER_WWW_AUTHENTICATE = 'WWW-Authenticate';  


HTTP entity header HTTP_ENTITY_HEADER_*
HTTP_ENTITY_HEADER_ALLOW = 'Allow';  
HTTP_ENTITY_HEADER_CONTENT_ENCODING = 'Content-Encoding';  
HTTP_ENTITY_HEADER_CONTENT_LENGTH = 'Content-Length';  
HTTP_ENTITY_HEADER_CONTENT_LOCATION = 'Content-Location';  
HTTP_ENTITY_HEADER_CONTENT_MD5 = 'Content-MD5';  
HTTP_ENTITY_HEADER_CONTENT_RANGE = 'Content-Range';  
HTTP_ENTITY_HEADER_CONTENT_TYPE = 'Content-Type';  
HTTP_ENTITY_HEADER_EXPIRES = 'Expires';  
HTTP_ENTITY_HEADER_LAST_MODIFIED = 'Last-Modified';  


HTTP status HTTP_STATUS_*
HTTP_STATUS_NONE = 0;  
HTTP_STATUS_CONTINUE = 100; Continue
HTTP_STATUS_SWITCH_PROTOCOL = 101; Switching Protocols
HTTP_STATUS_OK = 200; OK
HTTP_STATUS_CREATED = 201; Created
HTTP_STATUS_ACCEPTED = 202; Accepted
HTTP_STATUS_NON_AUTHORITATIVE = 203; Non-Authoritative Information
HTTP_STATUS_NO_CONTENT = 204; No Content
HTTP_STATUS_RESET_CONTENT = 205; Reset Content
HTTP_STATUS_PARTIAL_CONTENT = 206; Partial Content
HTTP_STATUS_MULTIPLE_CHOICES = 300; Multiple Choices
HTTP_STATUS_MOVED_PERMANENT = 301; Moved Permanently
HTTP_STATUS_FOUND = 302; Found
HTTP_STATUS_SEE_OTHER = 303; See Other
HTTP_STATUS_NOT_MODIFIED = 304; Not Modified
HTTP_STATUS_USE_PROXY = 305; Use Proxy
HTTP_STATUS_TEMPORARY_REDIRECT = 307; Temporary Redirect
HTTP_STATUS_BAD_REQUEST = 400; Bad Request
HTTP_STATUS_UNAUTHORIZED = 401; Unauthorized
HTTP_STATUS_PAYMENT_REQUIRED = 402; Payment Required
HTTP_STATUS_FORBIDDEN = 403; Forbidden
HTTP_STATUS_NOT_FOUND = 404; Not Found
HTTP_STATUS_METHOD_NOT_ALLOWED = 405; Method Not Allowed
HTTP_STATUS_NOT_ACCEPTABLE = 406; Not Acceptable
HTTP_STATUS_PROXY_AUTH_REQUIRED = 407; Proxy Authentication Required
HTTP_STATUS_REQUEST_TIMEOUT = 408; Request Time-out
HTTP_STATUS_CONFLICT = 409; Conflict
HTTP_STATUS_GONE = 410; Gone
HTTP_STATUS_LENGTH_REQUIRED = 411; Length Required
HTTP_STATUS_PRECONDITION_FAILED = 412; Precondition Failed
HTTP_STATUS_ENTITY_TOO_LARGE = 413; Request Entity Too Large
HTTP_STATUS_URI_TOO_LARGE = 414; Request-URI Too Large
HTTP_STATUS_UNSUPPORTED_MEDIA = 415; Unsupported Media Type
HTTP_STATUS_RANGE_NOT_SATISFIED = 416; Requested range not satisfiable
HTTP_STATUS_EXPECTATION_FAILED = 417; Expectation Failed
HTTP_STATUS_INTERNAL_SERVER_ERROR = 500; Internal Server Error
HTTP_STATUS_NOT_IMPLEMENTED = 501; Not Implemented
HTTP_STATUS_BAD_GATEWAY = 502; Bad Gateway
HTTP_STATUS_SERICE_UNAVAILABLE = 503; Service Unavailable
HTTP_STATUS_GATEWAY_TIMEOUT = 504; Gateway Time-out
HTTP_STATUS_VERSION_NOT_SUPPORTED = 505; HTTP Version not supported
 
HTTP_MIN_STATUS = 100;  
HTTP_MAX_STATUS = 599;  


HTTP reason HTTP_REASON_*
HTTP_REASON_100 = 'Continue';  
HTTP_REASON_101 = 'Switching Protocols';  
HTTP_REASON_200 = 'OK';  
HTTP_REASON_201 = 'Created';  
HTTP_REASON_202 = 'Accepted';  
HTTP_REASON_203 = 'Non-Authoritative Information';  
HTTP_REASON_204 = 'No Content';  
HTTP_REASON_205 = 'Reset Content';  
HTTP_REASON_206 = 'Partial Content';  
HTTP_REASON_300 = 'Multiple Choices';  
HTTP_REASON_301 = 'Moved Permanently';  
HTTP_REASON_302 = 'Found';  
HTTP_REASON_303 = 'See Other';  
HTTP_REASON_304 = 'Not Modified';  
HTTP_REASON_305 = 'Use Proxy';  
HTTP_REASON_307 = 'Temporary Redirect';  
HTTP_REASON_400 = 'Bad Request';  
HTTP_REASON_401 = 'Unauthorized';  
HTTP_REASON_402 = 'Payment Required';  
HTTP_REASON_403 = 'Forbidden';  
HTTP_REASON_404 = 'Not Found';  
HTTP_REASON_405 = 'Method Not Allowed';  
HTTP_REASON_406 = 'Not Acceptable';  
HTTP_REASON_407 = 'Proxy Authentication Required';  
HTTP_REASON_408 = 'Request Time-out';  
HTTP_REASON_409 = 'Conflict';  
HTTP_REASON_410 = 'Gone';  
HTTP_REASON_411 = 'Length Required';  
HTTP_REASON_412 = 'Precondition Failed';  
HTTP_REASON_413 = 'Request Entity Too Large';  
HTTP_REASON_414 = 'Request-URI Too Large';  
HTTP_REASON_415 = 'Unsupported Media Type';  
HTTP_REASON_416 = 'Requested range not satisfiable';  
HTTP_REASON_417 = 'Expectation Failed';  
HTTP_REASON_500 = 'Internal Server Error';  
HTTP_REASON_501 = 'Not Implemented';  
HTTP_REASON_502 = 'Bad Gateway';  
HTTP_REASON_503 = 'Service Unavailable';  
HTTP_REASON_504 = 'Gateway Time-out';  
HTTP_REASON_505 = 'HTTP Version not supported ';  


HTTP content type HTTP_CONTENT_*
HTTP_CONTENT_TEXT_HTML = 'text/html';  


HTTP cache control HTTP_CACHE_*
HTTP_CACHE_NO_CACHE = 'no-cache';  


HTTP connection HTTP_CONNECTION_*
HTTP_CONNECTION_CLOSE = 'close';  
HTTP_CONNECTION_KEEPALIVE = 'keep-alive';  


HTTP request flag HTTP_REQUEST_FLAG_*
HTTP_REQUEST_FLAG_NONE = $00000000;  
HTTP_REQUEST_FLAG_CONTENT_RECEIVED = $00000001; Server
HTTP_REQUEST_FLAG_LINE_SENT = $00000002; Client
HTTP_REQUEST_FLAG_HEADERS_SENT = $00000004; Client
HTTP_REQUEST_FLAG_CONTENT_SENT = $00000008; Client


HTTP response flag HTTP_RESPONSE_FLAG_*
HTTP_RESPONSE_FLAG_NONE = $00000000;  
HTTP_RESPONSE_FLAG_STATUS_SENT = $00000001; Server
HTTP_RESPONSE_FLAG_HEADERS_SENT = $00000002; Server
HTTP_RESPONSE_FLAG_CONTENT_SENT = $00000004; Server
HTTP_RESPONSE_FLAG_CONNECTION_CLOSE = $00000008; Server/Client
HTTP_RESPONSE_FLAG_NO_CACHE = $00000010; Server/Client
HTTP_RESPONSE_FLAG_CONTENT_RECEIVED = $00000020; Client


HTTP client state HTTP_CLIENT_STATE_*
HTTP_CLIENT_STATE_NONE = 0;  
HTTP_CLIENT_STATE_REQUEST = 1;  
HTTP_CLIENT_STATE_REDIRECT = 2;  
HTTP_CLIENT_STATE_SUCCESS = 3;  
HTTP_CLIENT_STATE_FAILURE = 4;  


HTTP host flag HTTP_HOST_FLAG_*
HTTP_HOST_FLAG_NONE = $00000000;  
HTTP_HOST_FLAG_DEFAULT = $00000001;  
HTTP_HOST_FLAG_DOMAIN = $00000002;  


HTTP CGI flag HTTP_CGI_FLAG_*
HTTP_CGI_FLAG_NONE = $00000000;  
HTTP_CGI_FLAG_FOLDER = $00000001;  
HTTP_CGI_FLAG_SUBTREE = $00000002;  
HTTP_CGI_FLAG_EXTENSION = $00000004;  


HTTP error flag HTTP_ERROR_FLAG_*
HTTP_ERROR_FLAG_NONE = $00000000;  
HTTP_ERROR_FLAG_DEFAULT = $00000001;  


HTTP module flag HTTP_MODULE_FLAG_*
HTTP_MODULE_FLAG_NONE = $00000000;  


HTTP document flag HTTP_DOCUMENT_FLAG_*
HTTP_DOCUMENT_FLAG_NONE = $00000000;  
HTTP_DOCUMENT_FLAG_DEFAULT = $00000001;  
HTTP_DOCUMENT_FLAG_FOLDER = $00000002;  
HTTP_DOCUMENT_FLAG_SUBTREE = $00000004;  
HTTP_DOCUMENT_FLAG_EXTENSION = $00000008;  


HTTP mime type HTTP_MIME_TYPE_*
See: Apache mime.types file
HTTP_MIME_TYPE_MAX = 28;  
 
HTTP_MIME_TYPES:array[0..HTTP_MIME_TYPE_MAX,0..1] of String = (
('avi','video/x-msvideo'),  
('bat','application/x-msdownload'),  
('bmp','image/bmp'),  
('com','application/x-msdownload'),  
('conf','text/plain'),  
('css','text/css'),  
('dll','application/x-msdownload'),  
('doc','application/msword'),  
('dot','application/msword'),  
('exe','application/x-msdownload'),  
('gif','image/gif'),  
('html','text/html'),  
('htm','text/html'),  
('iso','application/octet-stream'),  
('jpeg','image/jpeg'),  
('jpg','image/jpeg'),  
('pdf','application/pdf'),  
('png','image/png'),  
('txt','text/plain'),  
('text','text/plain'),  
('log','text/plain'),  
('mov','video/quicktime'),  
('mp3','audio/mpeg'),  
('mp4','video/mp4'),  
('msi','application/x-msdownload'),  
('qt','video/quicktime'),  
('tar','application/x-tar'),  
('wmv','video/x-ms-wmv'),  
('zip','application/zip') );  
 
HTTP_MIME_TYPE_DEFAULT = 'application/octet-stream';


HTTP logging HTTP_LOG_LEVEL_*
HTTP_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG; HTTP debugging messages
HTTP_LOG_LEVEL_INFO = LOG_LEVEL_INFO; HTTP informational messages
HTTP_LOG_LEVEL_WARN = LOG_LEVEL_WARN; HTTP warning messages
HTTP_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR; HTTP error messages
HTTP_LOG_LEVEL_NONE = LOG_LEVEL_NONE; No HTTP messages


Type definitions



HTTP reserved chars

THTTPReservedChars = set of AnsiChar;

HTTP redirect event

THTTPRedirectEvent = function(AClient:THTTPClient; const AURL:String; var ALocation:String):Boolean of Object;

HTTP password event

THTTPPasswordEvent = function(AClient:THTTPClient; var AUsername,APassword:String):Boolean of Object;

HTTP host event

THTTPHostEvent = function(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean of Object;

HTTP error event

THTTPErrorEvent = function(AHost:THTTPHost; AError:THTTPError; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean of Object;

HTTP module event

THTTPModuleEvent = function(AHost:THTTPHost; AModule:THTTPModule; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean of Object;

HTTP document event

THTTPDocumentEvent = function(AHost:THTTPHost; ADocument:THTTPDocument; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean of Object;


Class definitions



HTTP helper classes

THTTPBuffer = class(TObject)

HTTP common classes

THTTPParam = class(TListObject)
THTTPParams = class(TObject)
THTTPHeader = class(TListObject)
THTTPHeaders = class(TObject)

HTTP client classes

THTTPClientRequest = class(TObject)
THTTPClientResponse = class(TObject)
THTTPClient = class(TWinsock2TCPClient)

HTTP server classes

THTTPServerRequest = class(TObject)
THTTPServerResponse = class(TObject)
THTTPHost = class(TListObject)
THTTPError = class(TListObject)
THTTPAlias = class(TListObject)
THTTPModule = class(TListObject)
THTTPDocument = class(TListObject)
THTTPMimeType = class(TListObject)
THTTPRedirect = class(THTTPDocument)
THTTPFolder = class(THTTPDocument)
THTTPFile = class(THTTPDocument)
THTTPListener = class(TWinsock2TCPListener)


Public variables



HTTP logging

HTTP_DEFAULT_LOG_LEVEL:LongWord = HTTP_LOG_LEVEL_DEBUG; Minimum level for HTTP messages. Only messages with level greater than or equal to this will be printed.
HTTP_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

procedure HTTPInit;
Description: To be documented
Note None documented


HTTP helper functions

function HTTPEncode(const AValue:String; AReserved:THTTPReservedChars):String;
Description: To be documented
Note None documented


function HTTPDecode(const AValue:String):String;
Description: To be documented
Note None documented


function HTTPParseURI(const AURI:String; var AProtocol,AHost,APort,APath,AQuery:String):Boolean;
Description: To be documented
Note None documented


function HTTPBuildURI(const AProtocol,AHost,APort,APath,AQuery:String; var AURI:String):Boolean;
Description: To be documented
Note None documented


function HTTPParseHost(const AHost:String; var AName,APort:String):Boolean;
Description: To be documented
Note None documented


function HTTPBuildHost(const AName,APort:String; var AHost:String):Boolean;
Description: To be documented
Note None documented


function HTTPParseParam(const AParam:String; var AName,AValue:String):Boolean;
Description: To be documented
Note None documented


function HTTPBuildParam(const AName,AValue:String; var AParam:String):Boolean;
Description: To be documented
Note None documented


function HTTPParseQuery(const AQuery:String; AParams:THTTPParams):Boolean;
Description: To be documented
Note None documented


function HTTPBuildQuery(AParams:THTTPParams; var AQuery:String):Boolean;
Description: To be documented
Note None documented


function HTTPParseHeader(const AHeader:String; var AName,AValue:String):Boolean;
Description: To be documented
Note None documented


function HTTPBuildHeader(const AName,AValue:String; var AHeader:String):Boolean;
Description: To be documented
Note None documented


function HTTPPathExtractName(const ASource:String; var AName:String):Boolean;
Description: To be documented
Note None documented


function HTTPPathExtractDir(const ASource:String; var APath:String):Boolean;
Description: To be documented
Note None documented


function HTTPPathExtractPath(const ASource:String; var APath:String):Boolean;
Description: To be documented
Note None documented


function HTTPPathExtractExtension(const ASource:String; var AExtension:String):Boolean;
Description: To be documented
Note None documented


function HTTPParseRequestLine(const ARequest:String; var AMethod:LongWord; var AURL:String; var AVersion:LongWord):Boolean;
Description: To be documented
Note None documented


function HTTPBuildRequestLine(AMethod:LongWord; const AURL:String; AVersion:LongWord; var ARequest:String):Boolean;
Description: To be documented
Note None documented


function HTTPParseResponseLine(const AResponse:String; var AVersion,AStatus:LongWord; var AReason:String):Boolean;
Description: To be documented
Note None documented


function HTTPBuildResponseLine(AVersion,AStatus:LongWord; const AReason:String; var AResponse:String):Boolean;
Description: To be documented
Note None documented


function FileTimeToHTTPDate(const AFileTime:TFileTime):String;
Description: To be documented
Note None documented


function HTTPDateToFileTime(const AHTTPDate:String):TFileTime;
Description: To be documented
Note None documented


function DateTimeToHTTPDate(const ADateTime:TDateTime):String;
Description: To be documented
Note None documented


function HTTPDateToDateTime(const AHTTPDate:String):TDateTime;
Description: To be documented
Note None documented


function StringToHTTPProtocol(const AProtocol:String):LongWord;
Description: To be documented
Note None documented


function HTTPProtocolToString(AProtocol:LongWord):String;
Description: To be documented
Note None documented


function StringToHTTPMethod(const AMethod:String):LongWord;
Description: To be documented
Note None documented


function HTTPMethodToString(AMethod:LongWord):String;
Description: To be documented
Note None documented


function StringToHTTPVersion(const AVersion:String):LongWord;
Description: To be documented
Note None documented


function HTTPVersionToString(AVersion:LongWord):String;
Description: To be documented
Note None documented


function StringToHTTPEncoding(const AEncoding:String):LongWord;
Description: To be documented
Note None documented


function HTTPEncodingToString(AEncoding:LongWord):String;
Description: To be documented
Note None documented


function StringToHTTPStatus(const AStatus:String):LongWord;
Description: To be documented
Note None documented


function HTTPStatusToString(AStatus:LongWord):String;
Description: To be documented
Note None documented


procedure HTTPLog(Level:LongWord;const AText:String);
Description: To be documented
Note None documented


procedure HTTPLogInfo(const AText:String); inline;
Description: To be documented
Note None documented


procedure HTTPLogWarn(const AText:String); inline;
Description: To be documented
Note None documented


procedure HTTPLogError(const AText:String); inline;
Description: To be documented
Note None documented


procedure HTTPLogDebug(const AText:String); inline;
Description: To be documented
Note None documented


Return to Unit Reference