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
|
ClientHeight = 401
|
||||||
ClientWidth = 462
|
ClientWidth = 462
|
||||||
LCLVersion = '1.1'
|
LCLVersion = '1.1'
|
||||||
object buttonVideoHEADTest: TButton
|
object buttonHttpTest: TButton
|
||||||
Left = 8
|
Left = 120
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 88
|
Top = 120
|
||||||
Width = 195
|
Width = 195
|
||||||
Caption = 'Test HTTP HEAD to Video'
|
Caption = 'Test HTTP'
|
||||||
OnClick = buttonVideoHEADTestClick
|
OnClick = buttonHttpTestClick
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object memoTestHttpDebug: TMemo
|
object memoTestHttpDebug: TMemo
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 274
|
Height = 242
|
||||||
Top = 120
|
Top = 152
|
||||||
Width = 448
|
Width = 448
|
||||||
Lines.Strings = (
|
Lines.Strings = (
|
||||||
'memoTestHttpDebug'
|
'memoTestHttpDebug'
|
||||||
@ -81,11 +81,41 @@ object formTestHttp: TformTestHttp
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object editProxy: TEdit
|
object editProxy: TEdit
|
||||||
Left = 81
|
Left = 160
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 58
|
Top = 58
|
||||||
Width = 168
|
Width = 168
|
||||||
TabOrder = 4
|
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
|
||||||
end
|
end
|
||||||
|
@ -3,30 +3,36 @@
|
|||||||
LazarusResources.Add('TformTestHttp','FORMDATA',[
|
LazarusResources.Add('TformTestHttp','FORMDATA',[
|
||||||
'TPF0'#13'TformTestHttp'#12'formTestHttp'#4'Left'#3#241#0#6'Height'#3#145#1#3
|
'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'
|
+'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'
|
+#3#145#1#11'ClientWidth'#3#206#1#10'LCLVersion'#6#3'1.1'#0#7'TButton'#14'but'
|
||||||
+'tonVideoHEADTest'#4'Left'#2#8#6'Height'#2#25#3'Top'#2'X'#5'Width'#3#195#0#7
|
+'tonHttpTest'#4'Left'#2'x'#6'Height'#2#25#3'Top'#2'x'#5'Width'#3#195#0#7'Cap'
|
||||||
+'Caption'#6#23'Test HTTP HEAD to Video'#7'OnClick'#7#24'buttonVideoHEADTestC'
|
+'tion'#6#9'Test HTTP'#7'OnClick'#7#19'buttonHttpTestClick'#8'TabOrder'#2#0#0
|
||||||
+'lick'#8'TabOrder'#2#0#0#0#5'TMemo'#17'memoTestHttpDebug'#4'Left'#2#8#6'Heig'
|
+#0#5'TMemo'#17'memoTestHttpDebug'#4'Left'#2#8#6'Height'#3#242#0#3'Top'#3#152
|
||||||
+'ht'#3#18#1#3'Top'#2'x'#5'Width'#3#192#1#13'Lines.Strings'#1#6#17'memoTestHt'
|
+#0#5'Width'#3#192#1#13'Lines.Strings'#1#6#17'memoTestHttpDebug'#0#10'ScrollB'
|
||||||
+'tpDebug'#0#10'ScrollBars'#7#10'ssVertical'#8'TabOrder'#2#1#0#0#6'TLabel'#6
|
+'ars'#7#10'ssVertical'#8'TabOrder'#2#1#0#0#6'TLabel'#6'Label1'#4'Left'#2#10#6
|
||||||
+'Label1'#4'Left'#2#10#6'Height'#2#15#3'Top'#2#11#5'Width'#2#24#7'Caption'#6#4
|
+'Height'#2#15#3'Top'#2#11#5'Width'#2#24#7'Caption'#6#4'URL:'#11'ParentColor'
|
||||||
+'URL:'#11'ParentColor'#8#0#0#9'TComboBox'#8'comboURL'#4'Left'#2'('#6'Height'
|
+#8#0#0#9'TComboBox'#8'comboURL'#4'Left'#2'('#6'Height'#2#23#3'Top'#2#8#5'Wid'
|
||||||
+#2#23#3'Top'#2#8#5'Width'#3#160#1#10'ItemHeight'#2#15#9'ItemIndex'#2#0#13'It'
|
+'th'#3#160#1#10'ItemHeight'#2#15#9'ItemIndex'#2#0#13'Items.Strings'#1#6'bhtt'
|
||||||
+'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'
|
|
||||||
+'p://file31.content-video.ru/Volume18/mp4/2013/08/20/2013_08_20_RIAMERCEDESm'
|
+'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
|
+'ix1_mwyitzcc.0il.mp4'#0#8'TabOrder'#2#2#4'Text'#6'bhttp://file31.content-vi'
|
||||||
+'Top'#2'$'#5'Width'#2'='#7'Caption'#6#11'User Agent:'#11'ParentColor'#8#0#0#9
|
+'deo.ru/Volume18/mp4/2013/08/20/2013_08_20_RIAMERCEDESmix1_mwyitzcc.0il.mp4'
|
||||||
+'TComboBox'#14'comboUserAgent'#4'Left'#2'P'#6'Height'#2#23#3'Top'#2' '#5'Wid'
|
+#0#0#6'TLabel'#6'Label2'#4'Left'#2#10#6'Height'#2#15#3'Top'#2'$'#5'Width'#2
|
||||||
+'th'#3'x'#1#10'ItemHeight'#2#15#9'ItemIndex'#2#3#13'Items.Strings'#1#6' FPBr'
|
+'='#7'Caption'#6#11'User Agent:'#11'ParentColor'#8#0#0#9'TComboBox'#14'combo'
|
||||||
+'owser/1.0 (Mobile; U; en-GB)'#6'WOpera/9.80 (iPhone; Opera Mini/6.5.1.23995'
|
+'UserAgent'#4'Left'#2'P'#6'Height'#2#23#3'Top'#2' '#5'Width'#3'x'#1#10'ItemH'
|
||||||
+'/27.1227; U; pt) Presto/2.8.119 Version/11.10'#6'OMozilla/5.0 (X11; U; Linu'
|
+'eight'#2#15#9'ItemIndex'#2#3#13'Items.Strings'#1#6' FPBrowser/1.0 (Mobile; '
|
||||||
+'x i686; en-US; rv:1.7.12) Gecko/20060101 Firefox/1.0.8'#6'lMozilla/5.0 (Win'
|
+'U; en-GB)'#6'WOpera/9.80 (iPhone; Opera Mini/6.5.1.23995/27.1227; U; pt) Pr'
|
||||||
+'dows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547'
|
+'esto/2.8.119 Version/11.10'#6'OMozilla/5.0 (X11; U; Linux i686; en-US; rv:1'
|
||||||
+'.66 Safari/537.36'#0#8'TabOrder'#2#3#4'Text'#6'lMozilla/5.0 (Windows NT 6.1'
|
+'.7.12) Gecko/20060101 Firefox/1.0.8'#6'lMozilla/5.0 (Windows NT 6.1; WOW64)'
|
||||||
+'; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/'
|
+' AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36'#0
|
||||||
+'537.36'#0#0#6'TLabel'#6'Label3'#4'Left'#2#10#6'Height'#2#15#3'Top'#2'@'#5'W'
|
+#8'TabOrder'#2#3#4'Text'#6'lMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/'
|
||||||
+'idth'#2' '#7'Caption'#6#6'Proxy:'#11'ParentColor'#8#0#0#5'TEdit'#9'editProx'
|
+'537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36'#0#0#6'TLabel'
|
||||||
+'y'#4'Left'#2'Q'#6'Height'#2#23#3'Top'#2':'#5'Width'#3#168#0#8'TabOrder'#2#4
|
+#6'Label3'#4'Left'#2#10#6'Height'#2#15#3'Top'#2'@'#5'Width'#2' '#7'Caption'#6
|
||||||
+#4'Text'#6#9'editProxy'#0#0#0
|
+#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 }
|
||||||
|
|
||||||
TformTestHttp = class(TForm)
|
TformTestHttp = class(TForm)
|
||||||
buttonVideoHEADTest: TButton;
|
buttonHttpTest: TButton;
|
||||||
|
checkProxy: TCheckBox;
|
||||||
|
comboRequest: TComboBox;
|
||||||
comboUserAgent: TComboBox;
|
comboUserAgent: TComboBox;
|
||||||
comboURL: TComboBox;
|
comboURL: TComboBox;
|
||||||
editProxy: TEdit;
|
editProxy: TEdit;
|
||||||
Label1: TLabel;
|
Label1: TLabel;
|
||||||
Label2: TLabel;
|
Label2: TLabel;
|
||||||
Label3: TLabel;
|
Label3: TLabel;
|
||||||
|
Label4: TLabel;
|
||||||
memoTestHttpDebug: TMemo;
|
memoTestHttpDebug: TMemo;
|
||||||
procedure buttonVideoHEADTestClick(Sender: TObject);
|
procedure buttonHttpTestClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
public
|
public
|
||||||
@ -50,7 +53,7 @@ uses httpsend;
|
|||||||
|
|
||||||
{ TformTestHttp }
|
{ TformTestHttp }
|
||||||
|
|
||||||
procedure TformTestHttp.buttonVideoHEADTestClick(Sender: TObject);
|
procedure TformTestHttp.buttonHttpTestClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
Client: THttpSend;
|
Client: THttpSend;
|
||||||
ContentsList: TStringList;
|
ContentsList: TStringList;
|
||||||
@ -61,26 +64,26 @@ begin
|
|||||||
Client := THttpSend.Create;
|
Client := THttpSend.Create;
|
||||||
ContentsList := TStringList.Create;
|
ContentsList := TStringList.Create;
|
||||||
try
|
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: 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-Language: en-gb,en;q=0.5');
|
||||||
//Client.Headers.Add('Accept-Encoding: gzip,deflate');
|
//Client.Headers.Add('Accept-Encoding: gzip,deflate');
|
||||||
Client.Headers.Add('Accept-Charset: utf-8;q=0.7,*;q=0.7'); // ISO-8859-1,
|
Client.Headers.Add('Accept-Charset: utf-8;q=0.7,*;q=0.7'); // ISO-8859-1,
|
||||||
Client.UserAgent := comboUserAgent.Text;
|
Client.UserAgent := comboUserAgent.Text;
|
||||||
if editProxy.Text <> '' then
|
if checkProxy.Checked then
|
||||||
begin
|
begin
|
||||||
Client.ProxyHost := editProxy.Text;
|
Client.ProxyHost := editProxy.Text;
|
||||||
Client.ProxyPort := '80';
|
Client.ProxyPort := '80';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Client.HttpMethod('GET', AURL);
|
// Make the syncronous request via Synapse
|
||||||
|
Client.HttpMethod(comboRequest.Text, AURL);
|
||||||
// Client.Headers;
|
|
||||||
|
|
||||||
Client.Document.Position := 0;
|
Client.Document.Position := 0;
|
||||||
ContentsList.Clear();
|
ContentsList.Clear();
|
||||||
ContentsList.LoadFromStream(Client.Document);
|
ContentsList.LoadFromStream(Client.Document);
|
||||||
memoTestHttpDebug.Clear();
|
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('');
|
||||||
memoTestHttpDebug.Lines.Add('HTTP Headers:');
|
memoTestHttpDebug.Lines.Add('HTTP Headers:');
|
||||||
memoTestHttpDebug.Lines.Add('');
|
memoTestHttpDebug.Lines.Add('');
|
||||||
|
Reference in New Issue
Block a user