You've already forked lazarus-ccr
fpbrowser: Improves the http test
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2793 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -7,19 +7,19 @@ object formTestHttp: TformTestHttp
|
||||
ClientHeight = 401
|
||||
ClientWidth = 462
|
||||
LCLVersion = '1.1'
|
||||
object buttonVideoHEADTest: TButton
|
||||
Left = 8
|
||||
object buttonHttpTest: TButton
|
||||
Left = 120
|
||||
Height = 25
|
||||
Top = 88
|
||||
Top = 120
|
||||
Width = 195
|
||||
Caption = 'Test HTTP HEAD to Video'
|
||||
OnClick = buttonVideoHEADTestClick
|
||||
Caption = 'Test HTTP'
|
||||
OnClick = buttonHttpTestClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object memoTestHttpDebug: TMemo
|
||||
Left = 8
|
||||
Height = 274
|
||||
Top = 120
|
||||
Height = 242
|
||||
Top = 152
|
||||
Width = 448
|
||||
Lines.Strings = (
|
||||
'memoTestHttpDebug'
|
||||
@ -81,11 +81,41 @@ object formTestHttp: TformTestHttp
|
||||
ParentColor = False
|
||||
end
|
||||
object editProxy: TEdit
|
||||
Left = 81
|
||||
Left = 160
|
||||
Height = 23
|
||||
Top = 58
|
||||
Width = 168
|
||||
TabOrder = 4
|
||||
Text = 'editProxy'
|
||||
Text = 'v62-09.opera-mini.net'
|
||||
end
|
||||
object checkProxy: TCheckBox
|
||||
Left = 72
|
||||
Height = 19
|
||||
Top = 62
|
||||
Width = 71
|
||||
Caption = 'Use Proxy'
|
||||
TabOrder = 5
|
||||
end
|
||||
object Label4: TLabel
|
||||
Left = 10
|
||||
Height = 15
|
||||
Top = 93
|
||||
Width = 45
|
||||
Caption = 'Request:'
|
||||
ParentColor = False
|
||||
end
|
||||
object comboRequest: TComboBox
|
||||
Left = 80
|
||||
Height = 23
|
||||
Top = 88
|
||||
Width = 100
|
||||
ItemHeight = 15
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'GET'
|
||||
'HEAD'
|
||||
)
|
||||
TabOrder = 6
|
||||
Text = 'GET'
|
||||
end
|
||||
end
|
||||
|
@ -3,30 +3,36 @@
|
||||
LazarusResources.Add('TformTestHttp','FORMDATA',[
|
||||
'TPF0'#13'TformTestHttp'#12'formTestHttp'#4'Left'#3#241#0#6'Height'#3#145#1#3
|
||||
+'Top'#3#145#0#5'Width'#3#206#1#7'Caption'#6#12'formTestHttp'#12'ClientHeight'
|
||||
+#3#145#1#11'ClientWidth'#3#206#1#10'LCLVersion'#6#3'1.1'#0#7'TButton'#19'but'
|
||||
+'tonVideoHEADTest'#4'Left'#2#8#6'Height'#2#25#3'Top'#2'X'#5'Width'#3#195#0#7
|
||||
+'Caption'#6#23'Test HTTP HEAD to Video'#7'OnClick'#7#24'buttonVideoHEADTestC'
|
||||
+'lick'#8'TabOrder'#2#0#0#0#5'TMemo'#17'memoTestHttpDebug'#4'Left'#2#8#6'Heig'
|
||||
+'ht'#3#18#1#3'Top'#2'x'#5'Width'#3#192#1#13'Lines.Strings'#1#6#17'memoTestHt'
|
||||
+'tpDebug'#0#10'ScrollBars'#7#10'ssVertical'#8'TabOrder'#2#1#0#0#6'TLabel'#6
|
||||
+'Label1'#4'Left'#2#10#6'Height'#2#15#3'Top'#2#11#5'Width'#2#24#7'Caption'#6#4
|
||||
+'URL:'#11'ParentColor'#8#0#0#9'TComboBox'#8'comboURL'#4'Left'#2'('#6'Height'
|
||||
+#2#23#3'Top'#2#8#5'Width'#3#160#1#10'ItemHeight'#2#15#9'ItemIndex'#2#0#13'It'
|
||||
+'ems.Strings'#1#6'bhttp://file31.content-video.ru/Volume18/mp4/2013/08/20/20'
|
||||
+'13_08_20_RIAMERCEDESmix1_mwyitzcc.0il.mp4'#0#8'TabOrder'#2#2#4'Text'#6'bhtt'
|
||||
+#3#145#1#11'ClientWidth'#3#206#1#10'LCLVersion'#6#3'1.1'#0#7'TButton'#14'but'
|
||||
+'tonHttpTest'#4'Left'#2'x'#6'Height'#2#25#3'Top'#2'x'#5'Width'#3#195#0#7'Cap'
|
||||
+'tion'#6#9'Test HTTP'#7'OnClick'#7#19'buttonHttpTestClick'#8'TabOrder'#2#0#0
|
||||
+#0#5'TMemo'#17'memoTestHttpDebug'#4'Left'#2#8#6'Height'#3#242#0#3'Top'#3#152
|
||||
+#0#5'Width'#3#192#1#13'Lines.Strings'#1#6#17'memoTestHttpDebug'#0#10'ScrollB'
|
||||
+'ars'#7#10'ssVertical'#8'TabOrder'#2#1#0#0#6'TLabel'#6'Label1'#4'Left'#2#10#6
|
||||
+'Height'#2#15#3'Top'#2#11#5'Width'#2#24#7'Caption'#6#4'URL:'#11'ParentColor'
|
||||
+#8#0#0#9'TComboBox'#8'comboURL'#4'Left'#2'('#6'Height'#2#23#3'Top'#2#8#5'Wid'
|
||||
+'th'#3#160#1#10'ItemHeight'#2#15#9'ItemIndex'#2#0#13'Items.Strings'#1#6'bhtt'
|
||||
+'p://file31.content-video.ru/Volume18/mp4/2013/08/20/2013_08_20_RIAMERCEDESm'
|
||||
+'ix1_mwyitzcc.0il.mp4'#0#0#6'TLabel'#6'Label2'#4'Left'#2#10#6'Height'#2#15#3
|
||||
+'Top'#2'$'#5'Width'#2'='#7'Caption'#6#11'User Agent:'#11'ParentColor'#8#0#0#9
|
||||
+'TComboBox'#14'comboUserAgent'#4'Left'#2'P'#6'Height'#2#23#3'Top'#2' '#5'Wid'
|
||||
+'th'#3'x'#1#10'ItemHeight'#2#15#9'ItemIndex'#2#3#13'Items.Strings'#1#6' FPBr'
|
||||
+'owser/1.0 (Mobile; U; en-GB)'#6'WOpera/9.80 (iPhone; Opera Mini/6.5.1.23995'
|
||||
+'/27.1227; U; pt) Presto/2.8.119 Version/11.10'#6'OMozilla/5.0 (X11; U; Linu'
|
||||
+'x i686; en-US; rv:1.7.12) Gecko/20060101 Firefox/1.0.8'#6'lMozilla/5.0 (Win'
|
||||
+'dows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547'
|
||||
+'.66 Safari/537.36'#0#8'TabOrder'#2#3#4'Text'#6'lMozilla/5.0 (Windows NT 6.1'
|
||||
+'; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/'
|
||||
+'537.36'#0#0#6'TLabel'#6'Label3'#4'Left'#2#10#6'Height'#2#15#3'Top'#2'@'#5'W'
|
||||
+'idth'#2' '#7'Caption'#6#6'Proxy:'#11'ParentColor'#8#0#0#5'TEdit'#9'editProx'
|
||||
+'y'#4'Left'#2'Q'#6'Height'#2#23#3'Top'#2':'#5'Width'#3#168#0#8'TabOrder'#2#4
|
||||
+#4'Text'#6#9'editProxy'#0#0#0
|
||||
+'ix1_mwyitzcc.0il.mp4'#0#8'TabOrder'#2#2#4'Text'#6'bhttp://file31.content-vi'
|
||||
+'deo.ru/Volume18/mp4/2013/08/20/2013_08_20_RIAMERCEDESmix1_mwyitzcc.0il.mp4'
|
||||
+#0#0#6'TLabel'#6'Label2'#4'Left'#2#10#6'Height'#2#15#3'Top'#2'$'#5'Width'#2
|
||||
+'='#7'Caption'#6#11'User Agent:'#11'ParentColor'#8#0#0#9'TComboBox'#14'combo'
|
||||
+'UserAgent'#4'Left'#2'P'#6'Height'#2#23#3'Top'#2' '#5'Width'#3'x'#1#10'ItemH'
|
||||
+'eight'#2#15#9'ItemIndex'#2#3#13'Items.Strings'#1#6' FPBrowser/1.0 (Mobile; '
|
||||
+'U; en-GB)'#6'WOpera/9.80 (iPhone; Opera Mini/6.5.1.23995/27.1227; U; pt) Pr'
|
||||
+'esto/2.8.119 Version/11.10'#6'OMozilla/5.0 (X11; U; Linux i686; en-US; rv:1'
|
||||
+'.7.12) Gecko/20060101 Firefox/1.0.8'#6'lMozilla/5.0 (Windows NT 6.1; WOW64)'
|
||||
+' AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36'#0
|
||||
+#8'TabOrder'#2#3#4'Text'#6'lMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/'
|
||||
+'537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36'#0#0#6'TLabel'
|
||||
+#6'Label3'#4'Left'#2#10#6'Height'#2#15#3'Top'#2'@'#5'Width'#2' '#7'Caption'#6
|
||||
+#6'Proxy:'#11'ParentColor'#8#0#0#5'TEdit'#9'editProxy'#4'Left'#3#160#0#6'Hei'
|
||||
+'ght'#2#23#3'Top'#2':'#5'Width'#3#168#0#8'TabOrder'#2#4#4'Text'#6#21'v62-09.'
|
||||
+'opera-mini.net'#0#0#9'TCheckBox'#10'checkProxy'#4'Left'#2'H'#6'Height'#2#19
|
||||
+#3'Top'#2'>'#5'Width'#2'G'#7'Caption'#6#9'Use Proxy'#8'TabOrder'#2#5#0#0#6'T'
|
||||
+'Label'#6'Label4'#4'Left'#2#10#6'Height'#2#15#3'Top'#2']'#5'Width'#2'-'#7'Ca'
|
||||
+'ption'#6#8'Request:'#11'ParentColor'#8#0#0#9'TComboBox'#12'comboRequest'#4
|
||||
+'Left'#2'P'#6'Height'#2#23#3'Top'#2'X'#5'Width'#2'd'#10'ItemHeight'#2#15#9'I'
|
||||
+'temIndex'#2#0#13'Items.Strings'#1#6#3'GET'#6#4'HEAD'#0#8'TabOrder'#2#6#4'Te'
|
||||
+'xt'#6#3'GET'#0#0#0
|
||||
]);
|
||||
|
@ -14,15 +14,18 @@ type
|
||||
{ TformTestHttp }
|
||||
|
||||
TformTestHttp = class(TForm)
|
||||
buttonVideoHEADTest: TButton;
|
||||
buttonHttpTest: TButton;
|
||||
checkProxy: TCheckBox;
|
||||
comboRequest: TComboBox;
|
||||
comboUserAgent: TComboBox;
|
||||
comboURL: TComboBox;
|
||||
editProxy: TEdit;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
Label4: TLabel;
|
||||
memoTestHttpDebug: TMemo;
|
||||
procedure buttonVideoHEADTestClick(Sender: TObject);
|
||||
procedure buttonHttpTestClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
@ -50,7 +53,7 @@ uses httpsend;
|
||||
|
||||
{ TformTestHttp }
|
||||
|
||||
procedure TformTestHttp.buttonVideoHEADTestClick(Sender: TObject);
|
||||
procedure TformTestHttp.buttonHttpTestClick(Sender: TObject);
|
||||
var
|
||||
Client: THttpSend;
|
||||
ContentsList: TStringList;
|
||||
@ -61,26 +64,26 @@ begin
|
||||
Client := THttpSend.Create;
|
||||
ContentsList := TStringList.Create;
|
||||
try
|
||||
// Preparation of headers and proxy
|
||||
Client.Headers.Add('Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8');
|
||||
Client.Headers.Add('Accept-Language: en-gb,en;q=0.5');
|
||||
//Client.Headers.Add('Accept-Encoding: gzip,deflate');
|
||||
Client.Headers.Add('Accept-Charset: utf-8;q=0.7,*;q=0.7'); // ISO-8859-1,
|
||||
Client.UserAgent := comboUserAgent.Text;
|
||||
if editProxy.Text <> '' then
|
||||
if checkProxy.Checked then
|
||||
begin
|
||||
Client.ProxyHost := editProxy.Text;
|
||||
Client.ProxyPort := '80';
|
||||
end;
|
||||
|
||||
Client.HttpMethod('GET', AURL);
|
||||
|
||||
// Client.Headers;
|
||||
// Make the syncronous request via Synapse
|
||||
Client.HttpMethod(comboRequest.Text, AURL);
|
||||
|
||||
Client.Document.Position := 0;
|
||||
ContentsList.Clear();
|
||||
ContentsList.LoadFromStream(Client.Document);
|
||||
memoTestHttpDebug.Clear();
|
||||
memoTestHttpDebug.Lines.Add(Format('Loading page: %s', [AURL]));
|
||||
memoTestHttpDebug.Lines.Add(Format('Requesting HTTP %s to: %s', [comboRequest.Text, AURL]));
|
||||
memoTestHttpDebug.Lines.Add('');
|
||||
memoTestHttpDebug.Lines.Add('HTTP Headers:');
|
||||
memoTestHttpDebug.Lines.Add('');
|
||||
|
Reference in New Issue
Block a user