-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdwsWebEnvironment.pas
More file actions
864 lines (727 loc) · 22.7 KB
/
Copy pathdwsWebEnvironment.pas
File metadata and controls
864 lines (727 loc) · 22.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
{**********************************************************************}
{ }
{ "The contents of this file are subject to the Mozilla Public }
{ License Version 1.1 (the "License"); you may not use this }
{ file except in compliance with the License. You may obtain }
{ a copy of the License at http://www.mozilla.org/MPL/ }
{ }
{ Software distributed under the License is distributed on an }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express }
{ or implied. See the License for the specific language }
{ governing rights and limitations under the License. }
{ }
{ Copyright Creative IT. }
{ Current maintainer: Eric Grange }
{ }
{**********************************************************************}
unit dwsWebEnvironment;
interface
uses
Classes, SysUtils, StrUtils, DateUtils,
SynCrtSock, SynCommons,
dwsExprs, dwsUtils, dwsWebUtils, dwsWebServerUtils, dwsWebServerHelpers;
type
TWebRequestAuthentication = (
wraNone,
wraFailed,
wraBasic,
wraDigest,
wraNTLM,
wraNegotiate,
wraKerberos,
wraAuthorization
);
TWebRequestAuthentications = set of TWebRequestAuthentication;
TWebRequestMethodVerb = (
wrmvUnknown,
wrmvOPTIONS,
wrmvGET,
wrmvHEAD,
wrmvPOST,
wrmvPUT,
wrmvDELETE,
wrmvTRACE,
wrmvCONNECT,
wrmvTRACK,
wrmvMOVE,
wrmvCOPY,
wrmvPROPFIND,
wrmvPROPPATCH,
wrmvMKCOL,
wrmvLOCK,
wrmvUNLOCK,
wrmvSEARCH
);
TWebRequestMethodVerbs = set of TWebRequestMethodVerb;
TWebServerEventData = array of RawByteString;
TWebRequest = class
private
FCookies : TStrings;
FQueryFields : TStrings;
FContentFields : TStrings;
FCustom : TObject;
FID : Int64;
FAppUser : String;
protected
FPathInfo : String;
FQueryString : String;
function GetHeaders : TStrings; virtual; abstract;
function GetCookies : TStrings;
function GetQueryFields : TStrings;
function GetContentFields : TStrings;
function GetUserAgent : String;
function GetAuthentication : TWebRequestAuthentication; virtual;
function GetAuthenticatedUser : String; virtual;
function PrepareCookies : TStrings; virtual;
function PrepareQueryFields : TStrings; virtual;
function PrepareContentFields : TStrings; virtual;
public
destructor Destroy; override;
procedure ResetCookies; inline;
procedure ResetQueryFields; inline;
procedure ResetContentFields; inline;
procedure ResetFields; inline;
function Header(const headerName : String) : String;
function RemoteIP : String; virtual; abstract;
function RawURL : String; virtual; abstract;
function URL : String; virtual; abstract;
function FullURL : String; virtual; abstract;
function Method : String; virtual; abstract;
function MethodVerb : TWebRequestMethodVerb; virtual; abstract;
function Security : String; virtual; abstract;
function Secure : Boolean; virtual; abstract;
function Host : String; virtual;
function ContentLength : Integer; virtual; abstract;
function ContentData : RawByteString; virtual; abstract;
function ContentType : RawByteString; virtual; abstract;
property PathInfo : String read FPathInfo write FPathInfo;
property QueryString : String read FQueryString write FQueryString;
property UserAgent : String read GetUserAgent;
property Headers : TStrings read GetHeaders;
property Cookies : TStrings read GetCookies;
property QueryFields : TStrings read GetQueryFields;
property ContentFields : TStrings read GetContentFields;
function HasQueryField(const name : String) : Boolean;
function HasContentField(const name : String) : Boolean;
function IfModifiedSince : TDateTime;
property Authentication : TWebRequestAuthentication read GetAuthentication;
property AuthenticatedUser : String read GetAuthenticatedUser;
// custom request ID
property ID : Int64 read FID write FID;
// custom Application User
property AppUser : String read FAppUser write FAppUser;
// custom object field, freed with the request
property Custom : TObject read FCustom write FCustom;
end;
TWebResponseCookieFlag = (wrcfSecure = 1, wrcfHttpOnly = 2);
TWebResponseCookieSameSite = (wrcssUnspecified = 0, wrcssStrict = 1, wrcssLax = 2);
TWebResponseCookie = class
public
Name : String;
Value : String;
ExpiresGMT : TDateTime;
Domain : String;
Path : String;
MaxAge : Integer;
Flags : Integer;
SameSite : TWebResponseCookieSameSite;
procedure WriteStringLn(dest : TWriteOnlyBlockStream);
end;
TWebResponseCookies = class (TSimpleList<TWebResponseCookie>)
public
function AddCookie(const name : String) : TWebResponseCookie;
end;
TWebResponseHint = (shStatic, shCompression);
TWebResponseHints = set of TWebResponseHint;
TWebResponse = class
private
FStatusCode : Integer;
FContentData : RawByteString;
FContentType : RawByteString;
FContentEncoding : RawByteString;
FHeaders : TStrings;
FCookies : TWebResponseCookies; // lazy initialization
FProcessingTime : Integer;
FHints : TWebResponseHints;
protected
procedure SetContentText(const textType : RawByteString; const text : String);
procedure SetContentJSON(const json : String);
procedure SetLastModified(v : TDateTime);
function GetCookies : TWebResponseCookies;
function GetCompression : Boolean; inline;
procedure SetCompression(v : Boolean);
public
constructor Create;
destructor Destroy; override;
procedure Clear; virtual;
function HasHeaders : Boolean; inline;
function HasCookies : Boolean; inline;
function CompiledHeaders : RawByteString;
property StatusCode : Integer read FStatusCode write FStatusCode;
property ContentText[const textType : RawByteString] : String write SetContentText;
property ContentJSON : String write SetContentJSON;
property ContentData : RawByteString read FContentData write FContentData;
property ContentType : RawByteString read FContentType write FContentType;
property ContentEncoding : RawByteString read FContentEncoding write FContentEncoding;
property Headers : TStrings read FHeaders;
property Cookies : TWebResponseCookies read GetCookies;
property Compression : Boolean read GetCompression write SetCompression;
property LastModified : TDateTime write SetLastModified;
property Hints : TWebResponseHints read FHints write FHints;
// optional, informative, time it took to process the response in microseconds
property ProcessingTime : Integer read FProcessingTime write FProcessingTime;
end;
IWebEnvironment = interface
['{797FDC50-0643-4290-88D1-8BD3C0D7C303}']
function GetWebRequest : TWebRequest;
function GetWebResponse : TWebResponse;
property WebRequest : TWebRequest read GetWebRequest;
property WebResponse : TWebResponse read GetWebResponse;
end;
TWebEnvironment = class (TInterfacedSelfObject, IdwsEnvironment, IWebEnvironment)
protected
function GetWebRequest : TWebRequest;
function GetWebResponse : TWebResponse;
public
WebRequest : TWebRequest;
WebResponse : TWebResponse;
end;
TWebEnvironmentHelper = class helper for TProgramInfo
function WebEnvironment : IWebEnvironment; inline;
function WebRequest : TWebRequest; inline;
function WebResponse : TWebResponse; inline;
end;
TWebStaticCacheEntry = class (TInterfacedSelfObject)
private
FStatusCode : Integer;
FContentType : RawByteString;
FContentData : RawByteString;
FETag : String;
FCacheControl : String;
public
constructor Create(fromResponse : TWebResponse);
procedure HandleStatic(request : TWebRequest; response : TWebResponse);
property StatusCode : Integer read FStatusCode write FStatusCode;
property ContentData : RawByteString read FContentData write FContentData;
property ContentType : RawByteString read FContentType write FContentType;
property ETag : String read FETag write FETag;
property CacheControl : String read FCacheControl write FCacheControl;
function Size : Integer;
end;
TEmptyWebRequest = class(TWebRequest)
protected
FHeaders : TStringList;
function GetHeaders : TStrings; override;
public
destructor Destroy; override;
function RemoteIP : String; override;
function RawURL : String; override;
function URL : String; override;
function FullURL : String; override;
function Method : String; override;
function MethodVerb : TWebRequestMethodVerb; override;
function Security : String; override;
function Secure : Boolean; override;
function Host : String; override;
function ContentLength : Integer; override;
function ContentData : RawByteString; override;
function ContentType : RawByteString; override;
end;
const
cWebRequestAuthenticationToString : array [TWebRequestAuthentication] of String = (
'None', 'Failed', 'Basic', 'Digest', 'NTLM', 'Negotiate', 'Kerberos', 'Header'
);
const
cWebRequestMethodVerbs : array [TWebRequestMethodVerb] of String = (
'?', 'OPTIONS', 'GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'TRACE',
'CONNECT', 'TRACK', 'MOVE', 'COPY', 'PROPFIND', 'PROPPATCH',
'MKCOL', 'LOCK', 'UNLOCK', 'SEARCH' );
cHTMTL_UTF8_CONTENT_TYPE = 'text/html; charset=utf-8';
implementation
// ------------------
// ------------------ TWebEnvironmentHelper ------------------
// ------------------
// WebEnvironment
//
function TWebEnvironmentHelper.WebEnvironment : IWebEnvironment;
begin
Result:=(Execution.Environment as IWebEnvironment);
end;
// WebRequest
//
function TWebEnvironmentHelper.WebRequest : TWebRequest;
begin
Result:=WebEnvironment.WebRequest;
end;
// WebResponse
//
function TWebEnvironmentHelper.WebResponse : TWebResponse;
begin
Result:=WebEnvironment.WebResponse;
end;
// ------------------
// ------------------ TWebRequest ------------------
// ------------------
// Destroy
//
destructor TWebRequest.Destroy;
begin
FQueryFields.Free;
FContentFields.Free;
FCookies.Free;
FCustom.Free;
inherited;
end;
// ResetCookies
//
procedure TWebRequest.ResetCookies;
begin
if FCookies<>nil then begin
FCookies.Free;
FCookies:=nil;
end;
end;
// ResetQueryFields
//
procedure TWebRequest.ResetQueryFields;
begin
if FQueryFields<>nil then begin
FQueryFields.Free;
FQueryFields:=nil;
end;
end;
// ResetContentFields
//
procedure TWebRequest.ResetContentFields;
begin
if FContentFields<>nil then begin
FContentFields.Free;
FContentFields:=nil;
end;
end;
// ResetFields
//
procedure TWebRequest.ResetFields;
begin
ResetQueryFields;
ResetContentFields;
end;
// PrepareCookies
//
function TWebRequest.PrepareCookies : TStrings;
procedure AddCookie(const name, value : String);
var
i : Integer;
begin
i := Result.IndexOfName(name);
if i >= 0 then begin
if value <> '' then
Result[i] := name + '=' + value;
end else begin
Result.Add(name + '=' + value);
end;
end;
var
base, next, p : Integer;
cookieField : String;
begin
Result:=TFastCompareTextList.Create;
cookieField:=Header('Cookie');
p:=0;
base:=1;
while True do begin
p:=StrUtils.PosEx('=', cookieField, base);
next:=StrUtils.PosEx(';', cookieField, p);
if (p>base) and (next>p) then begin
AddCookie(SysUtils.Trim(Copy(cookieField, base, p-base)), Copy(cookieField, p+1, pred(next-p)));
base:=next+1;
end else Break;
end;
if (p>base) and (base<Length(cookieField)) then
AddCookie(SysUtils.Trim(Copy(cookieField, base, p-base)), Copy(cookieField, p+1));
end;
// PrepareQueryFields
//
function TWebRequest.PrepareQueryFields : TStrings;
begin
Result:=TStringList.Create;
WebUtils.ParseURLEncoded(ScriptStringToRawByteString(QueryString), Result);
end;
// PrepareContentFields
//
function TWebRequest.PrepareContentFields : TStrings;
begin
Result:=TStringList.Create;
if StrBeginsWithA(ContentType, 'application/x-www-form-urlencoded') then begin
// TODO: handle case where encoding isn't utf-8
WebUtils.ParseURLEncoded(ContentData, Result);
end;
end;
// Header
//
function TWebRequest.Header(const headerName : String) : String;
begin
Result:=Headers.Values[headerName];
end;
// Host
//
function TWebRequest.Host : String;
begin
Result:=Headers.Values['Host'];
end;
// GetCookies
//
function TWebRequest.GetCookies : TStrings;
begin
if FCookies=nil then
FCookies:=PrepareCookies;
Result:=FCookies;
end;
// GetQueryFields
//
function TWebRequest.GetQueryFields : TStrings;
begin
if FQueryFields=nil then
FQueryFields:=PrepareQueryFields;
Result:=FQueryFields;
end;
// GetContentFields
//
function TWebRequest.GetContentFields : TStrings;
begin
if FContentFields=nil then
FContentFields:=PrepareContentFields;
Result:=FContentFields;
end;
// HasQueryField
//
function TWebRequest.HasQueryField(const name : String) : Boolean;
begin
Result:=WebUtils.HasFieldName(QueryFields, name);
end;
// HasContentField
//
function TWebRequest.HasContentField(const name : String) : Boolean;
begin
Result:=WebUtils.HasFieldName(ContentFields, name);
end;
// IfModifiedSince
//
function TWebRequest.IfModifiedSince : TDateTime;
var
v : String;
begin
v:=Header('If-Modified-Since');
if v<>'' then
Result:=WebUtils.RFC822ToDateTime(v)
else Result:=0;
end;
// GetUserAgent
//
function TWebRequest.GetUserAgent : String;
begin
Result:=Header('User-Agent');
end;
// GetAuthentication
//
function TWebRequest.GetAuthentication : TWebRequestAuthentication;
begin
Result:=wraNone;
end;
// GetAuthenticatedUser
//
function TWebRequest.GetAuthenticatedUser : String;
begin
Result:='';
end;
// ------------------
// ------------------ TWebEnvironment ------------------
// ------------------
// GetWebRequest
//
function TWebEnvironment.GetWebRequest : TWebRequest;
begin
Result:=WebRequest;
end;
// GetWebResponse
//
function TWebEnvironment.GetWebResponse : TWebResponse;
begin
Result:=WebResponse;
end;
// ------------------
// ------------------ TWebResponse ------------------
// ------------------
// Create
//
constructor TWebResponse.Create;
begin
inherited;
FHeaders:=TFastCompareStringList.Create;
FHints:=[shCompression];
end;
// Destroy
//
destructor TWebResponse.Destroy;
begin
FHeaders.Free;
FCookies.Free;
inherited;
end;
// Clear
//
procedure TWebResponse.Clear;
begin
FStatusCode:=200;
FContentType:=cHTMTL_UTF8_CONTENT_TYPE;
FContentData:='';
FContentEncoding:='';
FHeaders.Clear;
if FCookies<>nil then
FCookies.Clear;
FHints:=[shCompression];
end;
// HasCookies
//
function TWebResponse.HasCookies : Boolean;
begin
Result:=(FCookies<>nil) and (FCookies.Count>0);
end;
// HasHeaders
//
function TWebResponse.HasHeaders : Boolean;
begin
Result:=(FHeaders.Count>0) or HasCookies;
end;
// CompiledHeaders
//
function TWebResponse.CompiledHeaders : RawByteString;
var
i, p : Integer;
wobs : TWriteOnlyBlockStream;
buf : String;
begin
wobs:=TWriteOnlyBlockStream.AllocFromPool;
try
for i:=0 to Headers.Count-1 do begin
buf:=FHeaders[i];
p:=Pos('=', buf);
wobs.WriteSubString(buf, 1, p-1);
wobs.WriteString(': ');
wobs.WriteSubString(buf, p+1);
wobs.WriteCRLF;
end;
if HasCookies then
for i:=0 to Cookies.Count-1 do
FCookies[i].WriteStringLn(wobs);
Result:=wobs.ToUTF8String;
finally
wobs.ReturnToPool;
end;
end;
// SetLastModified
//
procedure TWebResponse.SetLastModified(v : TDateTime);
begin
Headers.Add('Last-Modified='+WebUtils.DateTimeToRFC822(v));
end;
// SetContentText
//
procedure TWebResponse.SetContentText(const textType : RawByteString; const text : String);
begin
ContentType:='text/'+textType+'; charset=utf-8';
ContentData:=StringToUTF8(text);
end;
// SetContentJSON
//
procedure TWebResponse.SetContentJSON(const json : String);
begin
ContentType:='application/json';
ContentData:=StringToUTF8(json);
end;
// GetCookies
//
function TWebResponse.GetCookies : TWebResponseCookies;
begin
if FCookies=nil then
FCookies:=TWebResponseCookies.Create;
Result:=FCookies;
end;
// GetCompression
//
function TWebResponse.GetCompression : Boolean;
begin
Result:=(shCompression in FHints);
end;
// SetCompression
//
procedure TWebResponse.SetCompression(v : Boolean);
begin
if v then
Include(FHints, shCompression)
else Exclude(FHints, shCompression);
end;
// ------------------
// ------------------ TWebResponseCookies ------------------
// ------------------
// WriteStringLn
//
procedure TWebResponseCookie.WriteStringLn(dest : TWriteOnlyBlockStream);
const
cMonths : array [1..12] of String = (
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
cWeekDays : array [1..7] of String = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' );
var
y, m, d : Word;
h, n, s, z : Word;
begin
dest.WriteString('Set-Cookie: ');
dest.WriteString(Name);
dest.WriteChar('=');
dest.WriteString(Value);
if ExpiresGMT<>0 then begin
dest.WriteString('; Expires=');
if ExpiresGMT<0 then
dest.WriteString('Sat, 01 Jan 2000 00:00:01 GMT')
else begin
dest.WriteString(cWeekDays[DayOfTheWeek(ExpiresGMT)]);
DecodeDateTime(ExpiresGMT, y, m, d, h, n, s, z);
dest.WriteString(Format(', %.02d %s %d %.02d:%.02d:%.02d GMT',
[d, cMonths[m], y, h, n, s]));
end;
end;
if MaxAge>0 then begin
dest.WriteString('; Max-Age=');
dest.WriteString(MaxAge);
end;
if Path<>'' then begin
dest.WriteString('; Path=');
dest.WriteString(Path);
end;
if Domain<>'' then begin
dest.WriteString('; Domain=');
dest.WriteString(Domain);
end;
if (Flags and Ord(wrcfSecure))<>0 then
dest.WriteString('; Secure');
if (Flags and Ord(wrcfHttpOnly))<>0 then
dest.WriteString('; HttpOnly');
case SameSite of
wrcssStrict : dest.WriteString('; SameSite=Strict');
wrcssLax : dest.WriteString('; SameSite=Lax');
end;
dest.WriteCRLF;
end;
// ------------------
// ------------------ TWebResponseCookie ------------------
// ------------------
// AddCookie
//
function TWebResponseCookies.AddCookie(const name : String) : TWebResponseCookie;
begin
Result:=TWebResponseCookie.Create;
Result.Name:=name;
Add(Result);
end;
// ------------------
// ------------------ TWebStaticCacheEntry ------------------
// ------------------
// Create
//
constructor TWebStaticCacheEntry.Create(fromResponse : TWebResponse);
begin
inherited Create;
FContentType:=fromResponse.ContentType;
FContentData:=fromResponse.ContentData;
FStatusCode:=fromResponse.StatusCode;
FCacheControl:=fromResponse.Headers.Values['Cache-Control'];
FETag:=fromResponse.Headers.Values['ETag'];
if FETag='' then begin
FEtag:=WebServerUtils.ETag([FStatusCode, FCacheControl, FContentType, FContentData]);
fromResponse.Headers.Values['ETag']:=FETag;
end;
end;
// HandleStatic
//
procedure TWebStaticCacheEntry.HandleStatic(request : TWebRequest; response : TWebResponse);
begin
if request.Header('If-None-Match') = FETag then begin
response.StatusCode := 304;
Exit;
end;
response.Headers.Values['ETag'] := FETag;
if FCacheControl<>'' then
response.Headers.Values['Cache-Control'] := FCacheControl;
response.ContentType := FContentType;
response.ContentData := FContentData;
response.StatusCode := FStatusCode;
end;
// Size
//
function TWebStaticCacheEntry.Size : Integer;
begin
Result:=Length(FContentData);
end;
// ------------------
// ------------------ TEmptyWebRequest ------------------
// ------------------
destructor TEmptyWebRequest.Destroy;
begin
inherited;
FHeaders.Free;
end;
function TEmptyWebRequest.GetHeaders : TStrings;
begin
if FHeaders = nil then
FHeaders := TStringList.Create;
Result := FHeaders;
end;
function TEmptyWebRequest.RemoteIP : String;
begin
Result := '';
end;
function TEmptyWebRequest.RawURL : String;
begin
Result := '';
end;
function TEmptyWebRequest.URL : String;
begin
Result := '';
end;
function TEmptyWebRequest.FullURL : String;
begin
Result := '';
end;
function TEmptyWebRequest.Method : String;
begin
Result := '';
end;
function TEmptyWebRequest.MethodVerb : TWebRequestMethodVerb;
begin
Result := wrmvUnknown;
end;
function TEmptyWebRequest.Security : String;
begin
Result := '';
end;
function TEmptyWebRequest.Secure : Boolean;
begin
Result := False;
end;
function TEmptyWebRequest.Host : String;
begin
Result := '';
end;
function TEmptyWebRequest.ContentLength : Integer;
begin
Result := 0;
end;
function TEmptyWebRequest.ContentData : RawByteString;
begin
Result := '';
end;
function TEmptyWebRequest.ContentType : RawByteString;
begin
Result := '';
end;
end.