IdHTTPHeaderInfo.pas 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. { $HDR$}
  2. {**********************************************************************}
  3. { Unit archived using Team Coherence }
  4. { Team Coherence is Copyright 2002 by Quality Software Components }
  5. { }
  6. { For further information / comments, visit our WEB site at }
  7. { http://www.TeamCoherence.com }
  8. {**********************************************************************}
  9. {}
  10. { $Log: 10193: IdHTTPHeaderInfo.pas
  11. {
  12. { Rev 1.3 29/11/2003 7:37:04 AM GGrieve
  13. { make TIdHTTPHeaderInfo.authentication a property and destroy it
  14. }
  15. {
  16. { Rev 1.2 20/4/2003 3:48:34 PM SGrobety
  17. { Fix to previous fix (Dumb me)
  18. }
  19. {
  20. { Rev 1.0 2002.11.12 10:41:12 PM czhower
  21. }
  22. {
  23. HTTP Header definition - RFC 2616
  24. Copyright: (c) Chad Z. Hower and The Indy Pit Crew.
  25. Author: Doychin Bondzhev ([email protected])
  26. }
  27. unit IdHTTPHeaderInfo;
  28. {
  29. REVIEW: public - Authentication: TIdAuthentication;
  30. This nees to be a property
  31. }
  32. interface
  33. uses
  34. Classes, SysUtils, IdAuthentication, IdGlobal, IdHeaderList;
  35. Type
  36. TIdEntityHeaderInfo = class(TPersistent)
  37. protected
  38. FCacheControl: String;
  39. FRawHeaders: TIdHeaderList;
  40. FConnection: string;
  41. FContentEncoding: string;
  42. FContentLanguage: string;
  43. FContentLength: Integer;
  44. FContentRangeEnd: Cardinal;
  45. FContentRangeStart: Cardinal;
  46. FContentType: string;
  47. FContentVersion: string;
  48. FCustomHeaders: TIdHeaderList;
  49. FDate: TDateTime;
  50. FExpires: TDateTime;
  51. FLastModified: TDateTime;
  52. FPragma: string;
  53. FHasContentLength: Boolean;
  54. //
  55. procedure AssignTo(Destination: TPersistent); override;
  56. procedure ProcessHeaders; virtual;
  57. procedure SetHeaders; virtual;
  58. procedure SetContentLength(const AValue: Integer);
  59. procedure SetCustomHeaders(const AValue: TIdHeaderList);
  60. public
  61. procedure Clear; virtual;
  62. constructor Create; virtual;
  63. destructor Destroy; override;
  64. //
  65. property HasContentLength: Boolean read FHasContentLength;
  66. property RawHeaders: TIdHeaderList read FRawHeaders;
  67. published
  68. property CacheControl: String read FCacheControl write FCacheControl;
  69. property Connection: string read FConnection write FConnection;
  70. property ContentEncoding: string read FContentEncoding write FContentEncoding;
  71. property ContentLanguage: string read FContentLanguage write FContentLanguage;
  72. property ContentLength: Integer read FContentLength write SetContentLength;
  73. property ContentRangeEnd: Cardinal read FContentRangeEnd write FContentRangeEnd;
  74. property ContentRangeStart: Cardinal read FContentRangeStart write FContentRangeStart;
  75. property ContentType: string read FContentType write FContentType;
  76. property ContentVersion: string read FContentVersion write FContentVersion;
  77. property CustomHeaders: TIdHeaderList read FCustomHeaders write SetCustomHeaders;
  78. property Date: TDateTime read FDate write FDate;
  79. property Expires: TDateTime read FExpires write FExpires;
  80. property LastModified: TDateTime read FLastModified write FLastModified;
  81. property Pragma: string read FPragma write FPragma;
  82. end;
  83. TIdProxyConnectionInfo = class(TPersistent)
  84. protected
  85. FAuthentication: TIdAuthentication;
  86. FPassword: string;
  87. FPort: Integer;
  88. FServer: string;
  89. FUsername: string;
  90. FBasicByDefault: Boolean;
  91. procedure AssignTo(Destination: TPersistent); override;
  92. procedure SetProxyPort(const Value: Integer);
  93. procedure SetProxyServer(const Value: string);
  94. public
  95. constructor Create;
  96. procedure Clear;
  97. destructor Destroy; override;
  98. procedure SetHeaders(Headers: TIdHeaderList);
  99. //
  100. property Authentication: TIdAuthentication read FAuthentication write FAuthentication;
  101. published
  102. property BasicAuthentication: boolean read FBasicByDefault write FBasicByDefault;
  103. property ProxyPassword: string read FPassword write FPassword;
  104. property ProxyPort: Integer read FPort write SetProxyPort;
  105. property ProxyServer: string read FServer write SetProxyServer;
  106. property ProxyUsername: string read FUsername write FUserName;
  107. end;
  108. TIdRequestHeaderInfo = class(TIdEntityHeaderInfo)
  109. protected
  110. FAccept: string;
  111. FAcceptCharSet: string;
  112. FAcceptEncoding: string;
  113. FAcceptLanguage: string;
  114. FExpect: string;
  115. FFrom: string;
  116. FPassword: string;
  117. FReferer: string;
  118. FUserAgent: string;
  119. FUserName: string;
  120. FHost: string;
  121. FBasicByDefault: Boolean;
  122. FProxyConnection: string;
  123. FAuthentication: TIdAuthentication;
  124. //
  125. procedure AssignTo(Destination: TPersistent); override;
  126. public
  127. destructor destroy; override;
  128. //
  129. procedure Clear; override;
  130. procedure ProcessHeaders; override;
  131. procedure SetHeaders; override;
  132. property Authentication: TIdAuthentication read FAuthentication write FAuthentication;
  133. published
  134. property Accept: string read FAccept write FAccept;
  135. property AcceptCharSet: string read FAcceptCharSet write FAcceptCharSet;
  136. property AcceptEncoding: string read FAcceptEncoding write FAcceptEncoding;
  137. property AcceptLanguage: string read FAcceptLanguage write FAcceptLanguage;
  138. property BasicAuthentication: boolean read FBasicByDefault write FBasicByDefault;
  139. property Host: string read FHost write FHost;
  140. property From: string read FFrom write FFrom;
  141. property Password: String read FPassword write FPassword;
  142. property Referer: string read FReferer write FReferer;
  143. property UserAgent: string read FUserAgent write FUserAgent;
  144. property Username: String read FUsername write FUsername;
  145. property ProxyConnection: string read FProxyConnection write FProxyConnection;
  146. end;
  147. TIdResponseHeaderInfo = class(TIdEntityHeaderInfo)
  148. protected
  149. FLocation: string;
  150. FServer: string;
  151. FProxyConnection: string;
  152. FProxyAuthenticate: TIdHeaderList;
  153. FWWWAuthenticate: TIdHeaderList;
  154. //
  155. procedure SetProxyAuthenticate(const Value: TIdHeaderList);
  156. procedure SetWWWAuthenticate(const Value: TIdHeaderList);
  157. public
  158. procedure Clear; override;
  159. constructor Create; override;
  160. destructor Destroy; override;
  161. procedure ProcessHeaders; override;
  162. published
  163. property Location: string read FLocation write FLocation;
  164. property ProxyConnection: string read FProxyConnection write FProxyConnection;
  165. property ProxyAuthenticate: TIdHeaderList read FProxyAuthenticate write SetProxyAuthenticate;
  166. property Server: string read FServer write FServer;
  167. property WWWAuthenticate: TIdHeaderList read FWWWAuthenticate write SetWWWAuthenticate;
  168. end;
  169. implementation
  170. const
  171. DefaultUserAgent = 'Mozilla/3.0 (compatible; Indy Library)'; {do not localize}
  172. { TIdGeneralHeaderInfo }
  173. constructor TIdEntityHeaderInfo.Create;
  174. begin
  175. inherited Create;
  176. FRawHeaders := TIdHeaderList.Create;
  177. FRawHeaders.FoldLength := 1024;
  178. FCustomHeaders := TIdHeaderList.Create;
  179. Clear;
  180. end;
  181. destructor TIdEntityHeaderInfo.Destroy;
  182. begin
  183. FreeAndNil(FRawHeaders);
  184. FreeAndNil(FCustomHeaders);
  185. inherited Destroy;
  186. end;
  187. procedure TIdEntityHeaderInfo.AssignTo(Destination: TPersistent);
  188. begin
  189. if Destination is TIdEntityHeaderInfo then
  190. begin
  191. with Destination as TIdEntityHeaderInfo do
  192. begin
  193. FRawHeaders.Assign(Self.FRawHeaders);
  194. FContentEncoding := Self.FContentEncoding;
  195. FContentLanguage := Self.FContentLanguage;
  196. FContentLength := Self.FContentLength;
  197. FContentRangeEnd:= Self.FContentRangeEnd;
  198. FContentRangeStart:= Self.FContentRangeStart;
  199. FContentType := Self.FContentType;
  200. FContentVersion := Self.FContentVersion;
  201. FDate := Self.FDate;
  202. FExpires := Self.FExpires;
  203. FLastModified := Self.FLastModified;
  204. end;
  205. end
  206. else
  207. inherited AssignTo(Destination);
  208. end;
  209. procedure TIdEntityHeaderInfo.Clear;
  210. begin
  211. FConnection := '';
  212. FContentVersion := '';
  213. FContentEncoding := '';
  214. FContentLanguage := '';
  215. // S.G. 20/4/2003: Was FContentType := 'Text/HTML'
  216. // S.G. 20/4/2003: Shouldn't be set here but in response.
  217. // S.G. 20/4/2003: Requests, by default, have NO content-type. This caused problems
  218. // S.G. 20/4/2003: with some netscape servers
  219. FContentType := '';
  220. FContentLength := -1;
  221. FContentRangeStart := 0;
  222. FContentRangeEnd := 0;
  223. FDate := 0;
  224. FLastModified := 0;
  225. FExpires := 0;
  226. FRawHeaders.Clear;
  227. end;
  228. procedure TIdEntityHeaderInfo.ProcessHeaders;
  229. var
  230. LSecs: Integer;
  231. LValue: String;
  232. begin
  233. // Set and Delete so that later we copy remaining to optional headers
  234. with FRawHeaders do
  235. begin
  236. FConnection := Values['Connection']; {do not localize}
  237. FContentVersion := Values['Content-Version']; {do not localize}
  238. FContentEncoding := Values['Content-Encoding']; {do not localize}
  239. FContentLanguage := Values['Content-Language']; {do not localize}
  240. FContentType := Values['Content-Type']; {do not localize}
  241. FContentLength := StrToIntDef(Trim(Values['Content-Length']), -1); {do not localize}
  242. FHasContentLength := FContentLength >= 0;
  243. FDate := idGlobal.GMTToLocalDateTime(Values['Date']); {do not localize}
  244. FLastModified := GMTToLocalDateTime(Values['Last-Modified']); {do not localize}
  245. LValue := Values['Expires']; {do not localize}
  246. if IsNumeric(LValue) then
  247. begin
  248. // This is happening when expires is returned as integer number in seconds
  249. LSecs := StrToInt(LValue);
  250. // RLebeau 02/28/2007 - IIS sometimes sends an 'Expires: -1' header
  251. if LSecs >= 0 then begin
  252. FExpires := Now + (LSecs / SecsPerDay);
  253. end else begin
  254. FExpires := 0.0;
  255. end;
  256. end
  257. else begin
  258. FExpires := GMTToLocalDateTime(LValue);
  259. end;
  260. FPragma := Values['Pragma']; {do not localize}
  261. end;
  262. end;
  263. procedure TIdEntityHeaderInfo.SetHeaders;
  264. begin
  265. RawHeaders.Clear;
  266. with RawHeaders do
  267. begin
  268. if Length(FConnection) > 0 then
  269. begin
  270. Values['Connection'] := FConnection; {do not localize}
  271. end;
  272. if Length(FContentVersion) > 0 then
  273. begin
  274. Values['Content-Version'] := FContentVersion; {do not localize}
  275. end;
  276. if Length(FContentEncoding) > 0 then
  277. begin
  278. Values['Content-Encoding'] := FContentEncoding; {do not localize}
  279. end;
  280. if Length(FContentLanguage) > 0 then
  281. begin
  282. Values['Content-Language'] := FContentLanguage; {do not localize}
  283. end;
  284. if Length(FContentType) > 0 then
  285. begin
  286. Values['Content-Type'] := FContentType; {do not localize}
  287. end;
  288. if FContentLength >= 0 then
  289. begin
  290. Values['Content-Length'] := IntToStr(FContentLength); {do not localize}
  291. end;
  292. if Length(FCacheControl) > 0 then
  293. begin
  294. Values['Cache-control'] := FCacheControl; {do not localize}
  295. end;
  296. if FDate > 0 then
  297. begin
  298. Values['Date'] := DateTimeToInternetStr(FDate); {do not localize}
  299. end;
  300. if FExpires > 0 then
  301. begin
  302. Values['Expires'] := DateTimeToInternetStr(FExpires); {do not localize}
  303. end;
  304. if (FLastModified > 0) then
  305. begin
  306. Values['Last-Modified'] := DateTimeGMTToHttpStr(FLastModified); { do not localize}
  307. end;
  308. if Length(FPragma) > 0 then
  309. begin
  310. Values['Pragma'] := FPragma; {do not localize}
  311. end;
  312. if FCustomHeaders.Count > 0 then
  313. begin
  314. // Append Custom headers
  315. Text := Text + FCustomHeaders.Text;
  316. end;
  317. end;
  318. end;
  319. { TIdProxyConnectionInfo }
  320. constructor TIdProxyConnectionInfo.Create;
  321. begin
  322. inherited Create;
  323. Clear;
  324. end;
  325. destructor TIdProxyConnectionInfo.Destroy;
  326. begin
  327. if Assigned(FAuthentication) then
  328. begin
  329. FreeAndNil(FAuthentication);
  330. end;
  331. inherited Destroy;
  332. end;
  333. procedure TIdProxyConnectionInfo.AssignTo(Destination: TPersistent);
  334. begin
  335. if Destination is TIdProxyConnectionInfo then
  336. begin
  337. with Destination as TIdProxyConnectionInfo do
  338. begin
  339. FPassword := Self.FPassword;
  340. FPort := Self.FPort;
  341. FServer := Self.FServer;
  342. FUsername := Self.FUsername;
  343. FBasicByDefault := Self.FBasicByDefault;
  344. end;
  345. end
  346. else inherited AssignTo(Destination);
  347. end;
  348. procedure TIdProxyConnectionInfo.Clear;
  349. begin
  350. FServer := '';
  351. FUsername := '';
  352. FPassword := '';
  353. FPort := 0;
  354. end;
  355. procedure TIdProxyConnectionInfo.SetHeaders(Headers: TIdHeaderList);
  356. Var
  357. S: String;
  358. begin
  359. with Headers do
  360. begin
  361. if Assigned(Authentication) then
  362. begin
  363. S := Authentication.Authentication;
  364. if Length(S) > 0 then
  365. begin
  366. Values['Proxy-Authorization'] := S;
  367. end
  368. else
  369. end
  370. else begin // Use Basic authentication by default
  371. if FBasicByDefault then
  372. begin
  373. FAuthentication := TIdBasicAuthentication.Create;
  374. with Authentication do
  375. begin
  376. Params.Values['Username'] := Self.FUsername;
  377. Params.Values['Password'] := Self.FPassword;
  378. S := Authentication;
  379. end;
  380. if Length(S) > 0 then
  381. begin
  382. Values['Proxy-Authorization'] := S;
  383. end;
  384. end;
  385. end;
  386. end;
  387. end;
  388. procedure TIdProxyConnectionInfo.SetProxyPort(const Value: Integer);
  389. begin
  390. if Value <> FPort then
  391. FreeAndNil(FAuthentication);
  392. FPort := Value;
  393. end;
  394. procedure TIdProxyConnectionInfo.SetProxyServer(const Value: string);
  395. begin
  396. if not AnsiSameText(Value, FServer) then
  397. FreeAndNil(FAuthentication);
  398. FServer := Value;
  399. end;
  400. { TIdRequestHeaderInfo }
  401. procedure TIdRequestHeaderInfo.ProcessHeaders;
  402. var
  403. RangeDecode: string;
  404. begin
  405. // Set and Delete so that later we copy remaining to optional headers
  406. with FRawHeaders do
  407. begin
  408. FAccept := Values['Accept']; {do not localize}
  409. FAcceptCharSet := Values['Accept-Charset']; {do not localize}
  410. FAcceptEncoding := Values['Accept-Encoding']; {do not localize}
  411. FAcceptLanguage := Values['Accept-Language']; {do not localize}
  412. FHost := Values['Host']; {do not localize}
  413. FFrom := Values['From']; {do not localize}
  414. FReferer := Values['Referer']; {do not localize}
  415. FUserAgent := Values['User-Agent']; {do not localize}
  416. RangeDecode := Values['Range']; {do not localize}
  417. if RangeDecode <> '' then
  418. begin
  419. Fetch(RangeDecode, '=');
  420. FContentRangeStart := StrToIntDef(Fetch(RangeDecode,'-'), 0);
  421. FContentRangeEnd := StrToIntDef(Fetch(RangeDecode), 0);
  422. end;
  423. end;
  424. inherited ProcessHeaders;
  425. end;
  426. procedure TIdRequestHeaderInfo.AssignTo(Destination: TPersistent);
  427. begin
  428. if Destination is TIdRequestHeaderInfo then
  429. begin
  430. with Destination as TIdRequestHeaderInfo do
  431. begin
  432. FAccept := Self.FAccept;
  433. FAcceptCharSet := Self.FAcceptCharset;
  434. FAcceptEncoding := Self.FAcceptEncoding;
  435. FAcceptLanguage := Self.FAcceptLanguage;
  436. FFrom := Self.FFrom;
  437. FPassword := Self.FPassword;
  438. FReferer := Self.FReferer;
  439. FUserAgent := Self.FUserAgent;
  440. FUsername := Self.FUsername;
  441. FBasicByDefault := Self.FBasicByDefault;
  442. end;
  443. end
  444. else
  445. inherited AssignTo(Destination);
  446. end;
  447. procedure TIdRequestHeaderInfo.Clear;
  448. begin
  449. FAccept := 'text/html, */*'; {do not localize}
  450. FAcceptCharSet := '';
  451. FUserAgent := DefaultUserAgent;
  452. FBasicByDefault := false;
  453. inherited Clear;
  454. end;
  455. procedure TIdRequestHeaderInfo.SetHeaders;
  456. Var
  457. S: String;
  458. begin
  459. inherited SetHeaders;
  460. with RawHeaders do
  461. begin
  462. if Length(FProxyConnection) > 0 then
  463. begin
  464. Values['Proxy-Connection'] := FProxyConnection; {do not localize}
  465. end;
  466. if Length(FHost) > 0 then
  467. begin
  468. Values['Host'] := FHost; {do not localize}
  469. end;
  470. if Length(FAccept) > 0 then
  471. begin
  472. Values['Accept'] := FAccept; {do not localize}
  473. end;
  474. if Length(FAcceptCharset) > 0 then
  475. begin
  476. Values['Accept-Charset'] := FAcceptCharSet;
  477. end;
  478. if Length(FAcceptEncoding) > 0 then
  479. begin
  480. Values['Accept-Encoding'] := FAcceptEncoding; {do not localize}
  481. end;
  482. if Length(FAcceptLanguage) > 0 then
  483. begin
  484. Values['Accept-Language'] := FAcceptLanguage; {do not localize}
  485. end;
  486. if Length(FFrom) > 0 then
  487. begin
  488. Values['From'] := FFrom; {do not localize}
  489. end;
  490. if Length(FReferer) > 0 then
  491. begin
  492. Values['Referer'] := FReferer; {do not localize}
  493. end;
  494. if Length(FUserAgent) > 0 then
  495. begin
  496. Values['User-Agent'] := FUserAgent; {do not localize}
  497. end;
  498. if FLastModified > 0 then
  499. begin
  500. Values['If-Modified-Since'] := DateTimeToInternetStr(FLastModified); {do not localize}
  501. end;
  502. if (FContentRangeStart <> 0) or (FContentRangeEnd <> 0) then
  503. begin
  504. if FContentRangeEnd <> 0 then
  505. begin
  506. Values['Range'] := 'bytes=' + IntToStr(FContentRangeStart) + '-' + IntToStr(FContentRangeEnd); {do not localize}
  507. end else begin
  508. Values['Range'] := 'bytes=' + IntToStr(FContentRangeStart) + '-'; {do not localize}
  509. end;
  510. end;
  511. if Assigned(Authentication) then
  512. begin
  513. S := Authentication.Authentication;
  514. if Length(S) > 0 then
  515. begin
  516. Values['Authorization'] := S; {do not localize}
  517. end;
  518. end
  519. else begin // Use Basic authentication by default
  520. if FBasicByDefault then
  521. begin
  522. Authentication := TIdBasicAuthentication.Create;
  523. with Authentication do
  524. begin
  525. Params.Values['Username'] := Self.FUserName;
  526. Params.Values['Password'] := Self.FPassword;
  527. S := Authentication;
  528. end;
  529. if Length(S) > 0 then
  530. begin
  531. Values['Authorization'] := S; {do not localize}
  532. end;
  533. end;
  534. end;
  535. end;
  536. end;
  537. destructor TIdRequestHeaderInfo.destroy;
  538. begin
  539. FAuthentication.Free;
  540. inherited;
  541. end;
  542. { TIdResponseHeaderInfo }
  543. constructor TIdResponseHeaderInfo.Create;
  544. begin
  545. inherited Create;
  546. FContentType := 'text/html';
  547. FWWWAuthenticate := TIdHeaderList.Create;
  548. FProxyAuthenticate := TIdHeaderList.Create;
  549. end;
  550. destructor TIdResponseHeaderInfo.Destroy;
  551. begin
  552. FreeAndNil(FWWWAuthenticate);
  553. FreeAndNil(FProxyAuthenticate);
  554. inherited Destroy;
  555. end;
  556. procedure TIdResponseHeaderInfo.SetProxyAuthenticate(const Value: TIdHeaderList);
  557. begin
  558. FProxyAuthenticate.Assign(Value);
  559. end;
  560. procedure TIdResponseHeaderInfo.SetWWWAuthenticate(const Value: TIdHeaderList);
  561. begin
  562. FWWWAuthenticate.Assign(Value);
  563. end;
  564. procedure TIdResponseHeaderInfo.ProcessHeaders;
  565. Var
  566. RangeDecode: string;
  567. begin
  568. with FRawHeaders do
  569. begin;
  570. FLocation := Values['Location']; {do not localize}
  571. FServer := Values['Server']; {do not localize}
  572. FProxyConnection := Values['Proxy-Connection']; {do not localize}
  573. RangeDecode := Values['Content-Range']; {do not localize}
  574. if RangeDecode <> '' then
  575. begin
  576. Fetch(RangeDecode);
  577. FContentRangeStart := StrToInt(Fetch(RangeDecode,'-'));
  578. FContentRangeEnd := StrToInt(Fetch(RangeDecode,'/'));
  579. end else begin
  580. // Reset range variables if a range isn't given
  581. FContentRangeStart := 0;
  582. FContentRangeEnd := 0;
  583. end;
  584. FWWWAuthenticate.Clear;
  585. Extract('WWW-Authenticate', FWWWAuthenticate); {do not localize}
  586. FProxyAuthenticate.Clear;
  587. Extract('Proxy-Authenticate', FProxyAuthenticate); {do not localize}
  588. end;
  589. inherited ProcessHeaders;
  590. end;
  591. procedure TIdResponseHeaderInfo.Clear;
  592. begin
  593. inherited Clear;
  594. // S.G. 20/4/2003: Default to text/HTML
  595. FContentType := 'text/html';
  596. FLocation := '';
  597. FServer := '';
  598. if Assigned(FProxyAuthenticate) then
  599. begin
  600. FProxyAuthenticate.Clear;
  601. end;
  602. if Assigned(FWWWAuthenticate) then
  603. begin
  604. FWWWAuthenticate.Clear;
  605. end;
  606. end;
  607. procedure TIdEntityHeaderInfo.SetCustomHeaders(const AValue: TIdHeaderList);
  608. begin
  609. FCustomHeaders.Assign(AValue);
  610. end;
  611. procedure TIdEntityHeaderInfo.SetContentLength(const AValue: Integer);
  612. begin
  613. FContentLength := AValue;
  614. FHasContentLength := FContentLength >= 0;
  615. end;
  616. end.