fpbrowser: Some fixes for image loading

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1733 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-07-04 12:14:10 +00:00
parent eb3ecee187
commit 63c77c7417
5 changed files with 104 additions and 101 deletions

View File

@ -86,6 +86,9 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="10"/>
<SearchPaths>
<OtherUnitFiles Value="../../components/thtmlport/package"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>

View File

@ -3,7 +3,7 @@ object formBrowser: TformBrowser
Height = 439
Top = 267
Width = 621
ClientHeight = 439
ClientHeight = 419
ClientWidth = 621
Color = clBtnFace
Font.Color = clWindowText
@ -13,11 +13,12 @@ object formBrowser: TformBrowser
OnCreate = FormCreate
OnDestroy = FormDestroy
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '0.9.31'
object Panel1: TPanel
Left = 0
Height = 18
Top = 421
Top = 401
Width = 621
Align = alBottom
Alignment = taLeftJustify
@ -48,9 +49,10 @@ object formBrowser: TformBrowser
TabOrder = 1
object editURL: TEdit
Left = 190
Height = 22
Height = 24
Top = 4
Width = 337
AutoSize = False
OnKeyDown = editURLKeyDown
TabStop = False
TabOrder = 3
@ -88,19 +90,19 @@ object formBrowser: TformBrowser
end
object Panel3: TPanel
Left = 0
Height = 388
Height = 368
Top = 33
Width = 621
Align = alClient
BevelInner = bvLowered
BevelOuter = bvNone
Caption = 'Panel3'
ClientHeight = 388
ClientHeight = 368
ClientWidth = 621
TabOrder = 2
object Viewer: THTMLViewer
Left = 1
Height = 386
Height = 366
Top = 1
Width = 619
OnHotSpotCovered = HotSpotChange

View File

@ -2,83 +2,84 @@
LazarusResources.Add('TformBrowser','FORMDATA',[
'TPF0'#12'TformBrowser'#11'formBrowser'#4'Left'#3't'#1#6'Height'#3#183#1#3'To'
+'p'#3#11#1#5'Width'#3'm'#2#12'ClientHeight'#3#183#1#11'ClientWidth'#3'm'#2#5
+'p'#3#11#1#5'Width'#3'm'#2#12'ClientHeight'#3#163#1#11'ClientWidth'#3'm'#2#5
+'Color'#7#9'clBtnFace'#10'Font.Color'#7#12'clWindowText'#11'Font.Height'#2
+#243#9'Font.Name'#6#5'Arial'#4'Menu'#7#8'MainMenu'#8'OnCreate'#7#10'FormCrea'
+'te'#9'OnDestroy'#7#11'FormDestroy'#6'OnShow'#7#8'FormShow'#10'LCLVersion'#6
+#6'0.9.31'#0#6'TPanel'#6'Panel1'#4'Left'#2#0#6'Height'#2#18#3'Top'#3#165#1#5
+'Width'#3'm'#2#5'Align'#7#8'alBottom'#9'Alignment'#7#13'taLeftJustify'#10'Be'
+'velInner'#7#9'bvLowered'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2#18#11
+'ClientWidth'#3'm'#2#8'TabOrder'#2#0#0#12'TProgressBar'#11'ProgressBar'#4'Le'
+'ft'#3#214#1#6'Height'#2#16#3'Top'#2#1#5'Width'#3#150#0#5'Align'#7#7'alRight'
+#8'TabOrder'#2#0#7'Visible'#8#0#0#0#6'TPanel'#6'Panel2'#4'Left'#2#0#6'Height'
+#2'!'#3'Top'#2#0#5'Width'#3'm'#2#5'Align'#7#5'alTop'#10'BevelOuter'#7#6'bvNo'
+'ne'#12'ClientHeight'#2'!'#11'ClientWidth'#3'm'#2#8'TabOrder'#2#1#0#5'TEdit'
+#7'editURL'#4'Left'#3#190#0#6'Height'#2#22#3'Top'#2#4#5'Width'#3'Q'#1#9'OnKe'
+'yDown'#7#14'editURLKeyDown'#7'TabStop'#8#8'TabOrder'#2#3#0#0#7'TButton'#12
+'ReloadButton'#4'Left'#2#10#6'Height'#2#24#3'Top'#2#4#5'Width'#2';'#7'Captio'
+'n'#6#7'&Reload'#7'Enabled'#8#7'OnClick'#7#17'ReloadButtonClick'#8'TabOrder'
+#2#0#0#0#7'TButton'#10'BackButton'#4'Left'#2'E'#6'Height'#2#24#3'Top'#2#4#5
+'Width'#2';'#7'Caption'#6#5'&Back'#7'Enabled'#8#7'OnClick'#7#12'FwdBackClick'
+#8'TabOrder'#2#1#0#0#7'TButton'#9'FwdButton'#4'Left'#3#128#0#6'Height'#2#24#3
+'Top'#2#4#5'Width'#2';'#7'Caption'#6#8'&Forward'#7'Enabled'#8#7'OnClick'#7#12
+'FwdBackClick'#8'TabOrder'#2#2#0#0#0#6'TPanel'#6'Panel3'#4'Left'#2#0#6'Heigh'
+'t'#3#132#1#3'Top'#2'!'#5'Width'#3'm'#2#5'Align'#7#8'alClient'#10'BevelInner'
+#7#9'bvLowered'#10'BevelOuter'#7#6'bvNone'#7'Caption'#6#6'Panel3'#12'ClientH'
+'eight'#3#132#1#11'ClientWidth'#3'm'#2#8'TabOrder'#2#2#0#11'THTMLViewer'#6'V'
+'iewer'#4'Left'#2#1#6'Height'#3#130#1#3'Top'#2#1#5'Width'#3'k'#2#16'OnHotSpo'
+'tCovered'#7#13'HotSpotChange'#14'OnHotSpotClick'#7#12'HotSpotClick'#14'OnIm'
+'ageRequest'#7#18'ViewerImageRequest'#12'OnFormSubmit'#7#11'SubmitEvent'#15
+'OnHistoryChange'#7#13'HistoryChange'#10'OnProgress'#7#14'ViewerProgress'#7
+'TabStop'#9#8'TabOrder'#2#0#5'Align'#7#8'alClient'#13'DefBackground'#7#8'clW'
+'indow'#11'BorderStyle'#7#9'htFocused'#15'HistoryMaxCount'#2#6#11'DefFontNam'
+'e'#6#15'Times New Roman'#14'DefPreFontName'#6#11'Courier New'#12'DefFontCol'
+'or'#7#12'clWindowText'#16'DefOverLinkColor'#7#9'clFuchsia'#15'ImageCacheCou'
+'nt'#2#6#8'NoSelect'#8#7'CharSet'#7#15'DEFAULT_CHARSET'#15'PrintMarginLeft'#5
+#0#0#0#0#0#0#0#128#0'@'#16'PrintMarginRight'#5#0#0#0#0#0#0#0#128#0'@'#14'Pri'
+'ntMarginTop'#5#0#0#0#0#0#0#0#128#0'@'#17'PrintMarginBottom'#5#0#0#0#0#0#0#0
+#128#0'@'#10'PrintScale'#5#0#0#0#0#0#0#0#128#255'?'#11'OnMouseMove'#7#15'Vie'
+'werMouseMove'#12'OnProcessing'#7#17'ProcessingHandler'#17'OnPrintHTMLHeader'
+#7#21'ViewerPrintHTMLHeader'#17'OnPrintHTMLFooter'#7#21'ViewerPrintHTMLFoote'
+'r'#9'OnInclude'#7#13'ViewerInclude'#14'OnSoundRequest'#7#12'SoundRequest'#13
+'OnMetaRefresh'#7#16'MetaRefreshEvent'#13'OnObjectClick'#7#11'ObjectClick'#12
+'OnRightClick'#7#10'RightClick'#0#0#0#11'TOpenDialog'#10'OpenDialog'#10'Defa'
+'ultExt'#6#4'.htm'#6'Filter'#6'%html files|*.htm;*.html|all files|*.*'#7'Opt'
+'ions'#11#14'ofHideReadOnly'#15'ofPathMustExist'#15'ofFileMustExist'#0#4'lef'
+'t'#3'I'#1#3'top'#2#2#0#0#9'TMainMenu'#8'MainMenu'#4'left'#3'#'#1#3'top'#2#4
+#0#9'TMenuItem'#5'File1'#7'Caption'#6#5'&File'#0#9'TMenuItem'#4'Open'#7'Capt'
+'ion'#6#5'&Open'#8'ShortCut'#2'r'#7'OnClick'#7#13'OpenFileClick'#0#0#9'TMenu'
+'Item'#12'OpenTextFile'#7'Caption'#6#15'Open &Text File'#7'OnClick'#7#17'Ope'
+'nTextFileClick'#0#0#9'TMenuItem'#13'OpenImageFile'#7'Caption'#6#16'Open &Im'
+'age File'#7'OnClick'#7#18'OpenImageFileClick'#0#0#9'TMenuItem'#13'PrinterSe'
+'tup1'#7'Caption'#6#16'Printer Setup...'#7'OnClick'#7#18'PrinterSetup1Click'
+#0#0#9'TMenuItem'#12'Printpreview'#7'Caption'#6#14'Print pre&view'#7'Enabled'
+#8#7'OnClick'#7#17'PrintpreviewClick'#0#0#9'TMenuItem'#6'Print1'#7'Caption'#6
+#9'&Print...'#7'Enabled'#8#7'OnClick'#7#11'Print1Click'#0#0#9'TMenuItem'#2'N'
+'1'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#5'Exit1'#7'Caption'#6#5'E&xit'#7'OnCl'
+'ick'#7#10'Exit1Click'#0#0#0#9'TMenuItem'#5'Edit2'#7'Caption'#6#5'&Edit'#7'O'
+'nClick'#7#10'Edit2Click'#0#9'TMenuItem'#5'Find1'#7'Caption'#6#5'&Find'#7'En'
+'abled'#8#7'OnClick'#7#10'Find1Click'#0#0#9'TMenuItem'#8'CopyItem'#7'Caption'
+#6#5'&Copy'#8'ShortCut'#3'C@'#7'OnClick'#7#13'CopyItemClick'#0#0#9'TMenuItem'
+#2'N2'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'SelectAllItem'#7'Caption'#6#11
+'Select &All'#7'Enabled'#8#7'OnClick'#7#18'SelectAllItemClick'#0#0#0#9'TMenu'
+'Item'#8'options1'#7'Caption'#6#8'&Options'#0#9'TMenuItem'#10'ShowImages'#7
+'Caption'#6#12'&Show images'#7'OnClick'#7#15'ShowImagesClick'#0#0#9'TMenuIte'
+'m'#5'Fonts'#7'Caption'#6#23'Default &Font/Colors...'#7'OnClick'#7#15'FontCo'
,'lorsClick'#0#0#0#9'TMenuItem'#15'HistoryMenuItem'#7'Caption'#6#8'&History'#7
+'Visible'#8#0#0#9'TMenuItem'#6'About1'#7'Caption'#6#6'&About'#7'OnClick'#7#11
+'About1Click'#0#0#0#12'TPrintDialog'#11'PrintDialog'#8'FromPage'#2#1#7'MinPa'
+'ge'#2#1#7'MaxPage'#3#15''''#7'Options'#11#10'poPageNums'#0#6'ToPage'#2#1#4
+'left'#3'j'#1#3'top'#2#1#0#0#11'TFindDialog'#10'FindDialog'#7'Options'#11#6
+'frDown'#15'frHideWholeWord'#18'frDisableWholeWord'#0#6'OnFind'#7#14'FindDia'
+'logFind'#4'left'#3#249#0#3'top'#4#255#255#0#0#0#0#10'TPopupMenu'#9'PopupMen'
+'u'#4'left'#3#144#1#3'top'#2#1#0#9'TMenuItem'#9'Viewimage'#7'Caption'#6#11'&'
+'View image'#7'OnClick'#7#14'ViewimageClick'#0#0#9'TMenuItem'#20'CopyImageTo'
+'Clipboard'#7'Caption'#6#24'&Copy image to clipboard'#7'OnClick'#7#25'CopyIm'
+'ageToClipboardClick'#0#0#9'TMenuItem'#2'N3'#7'Caption'#6#1'-'#0#0#9'TMenuIt'
+'em'#15'OpenInNewWindow'#7'Caption'#6#19'&Open in new window'#7'OnClick'#7#20
+'OpenInNewWindowClick'#0#0#0#6'TTimer'#9'MetaTimer'#7'Enabled'#8#7'OnTimer'#7
+#14'MetaTimerTimer'#4'left'#3#242#0#3'top'#2'K'#0#0#6'TTimer'#6'Timer1'#8'In'
+'terval'#3#200#0#7'OnTimer'#7#11'Timer1Timer'#4'left'#3'#'#1#3'top'#2'G'#0#0
+#19'TPrinterSetupDialog'#18'PrinterSetupDialog'#4'left'#3#192#1#0#0#0
+'te'#9'OnDestroy'#7#11'FormDestroy'#6'OnShow'#7#8'FormShow'#8'Position'#7#14
+'poScreenCenter'#10'LCLVersion'#6#6'0.9.31'#0#6'TPanel'#6'Panel1'#4'Left'#2#0
+#6'Height'#2#18#3'Top'#3#145#1#5'Width'#3'm'#2#5'Align'#7#8'alBottom'#9'Alig'
+'nment'#7#13'taLeftJustify'#10'BevelInner'#7#9'bvLowered'#10'BevelOuter'#7#6
+'bvNone'#12'ClientHeight'#2#18#11'ClientWidth'#3'm'#2#8'TabOrder'#2#0#0#12'T'
+'ProgressBar'#11'ProgressBar'#4'Left'#3#214#1#6'Height'#2#16#3'Top'#2#1#5'Wi'
+'dth'#3#150#0#5'Align'#7#7'alRight'#8'TabOrder'#2#0#7'Visible'#8#0#0#0#6'TPa'
+'nel'#6'Panel2'#4'Left'#2#0#6'Height'#2'!'#3'Top'#2#0#5'Width'#3'm'#2#5'Alig'
+'n'#7#5'alTop'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2'!'#11'ClientWid'
+'th'#3'm'#2#8'TabOrder'#2#1#0#5'TEdit'#7'editURL'#4'Left'#3#190#0#6'Height'#2
+#24#3'Top'#2#4#5'Width'#3'Q'#1#8'AutoSize'#8#9'OnKeyDown'#7#14'editURLKeyDow'
+'n'#7'TabStop'#8#8'TabOrder'#2#3#0#0#7'TButton'#12'ReloadButton'#4'Left'#2#10
+#6'Height'#2#24#3'Top'#2#4#5'Width'#2';'#7'Caption'#6#7'&Reload'#7'Enabled'#8
+#7'OnClick'#7#17'ReloadButtonClick'#8'TabOrder'#2#0#0#0#7'TButton'#10'BackBu'
+'tton'#4'Left'#2'E'#6'Height'#2#24#3'Top'#2#4#5'Width'#2';'#7'Caption'#6#5'&'
+'Back'#7'Enabled'#8#7'OnClick'#7#12'FwdBackClick'#8'TabOrder'#2#1#0#0#7'TBut'
+'ton'#9'FwdButton'#4'Left'#3#128#0#6'Height'#2#24#3'Top'#2#4#5'Width'#2';'#7
+'Caption'#6#8'&Forward'#7'Enabled'#8#7'OnClick'#7#12'FwdBackClick'#8'TabOrde'
+'r'#2#2#0#0#0#6'TPanel'#6'Panel3'#4'Left'#2#0#6'Height'#3'p'#1#3'Top'#2'!'#5
+'Width'#3'm'#2#5'Align'#7#8'alClient'#10'BevelInner'#7#9'bvLowered'#10'Bevel'
+'Outer'#7#6'bvNone'#7'Caption'#6#6'Panel3'#12'ClientHeight'#3'p'#1#11'Client'
+'Width'#3'm'#2#8'TabOrder'#2#2#0#11'THTMLViewer'#6'Viewer'#4'Left'#2#1#6'Hei'
+'ght'#3'n'#1#3'Top'#2#1#5'Width'#3'k'#2#16'OnHotSpotCovered'#7#13'HotSpotCha'
+'nge'#14'OnHotSpotClick'#7#12'HotSpotClick'#14'OnImageRequest'#7#18'ViewerIm'
+'ageRequest'#12'OnFormSubmit'#7#11'SubmitEvent'#15'OnHistoryChange'#7#13'His'
+'toryChange'#10'OnProgress'#7#14'ViewerProgress'#7'TabStop'#9#8'TabOrder'#2#0
+#5'Align'#7#8'alClient'#13'DefBackground'#7#8'clWindow'#11'BorderStyle'#7#9
+'htFocused'#15'HistoryMaxCount'#2#6#11'DefFontName'#6#15'Times New Roman'#14
+'DefPreFontName'#6#11'Courier New'#12'DefFontColor'#7#12'clWindowText'#16'De'
+'fOverLinkColor'#7#9'clFuchsia'#15'ImageCacheCount'#2#6#8'NoSelect'#8#7'Char'
+'Set'#7#15'DEFAULT_CHARSET'#15'PrintMarginLeft'#5#0#0#0#0#0#0#0#128#0'@'#16
+'PrintMarginRight'#5#0#0#0#0#0#0#0#128#0'@'#14'PrintMarginTop'#5#0#0#0#0#0#0
+#0#128#0'@'#17'PrintMarginBottom'#5#0#0#0#0#0#0#0#128#0'@'#10'PrintScale'#5#0
+#0#0#0#0#0#0#128#255'?'#11'OnMouseMove'#7#15'ViewerMouseMove'#12'OnProcessin'
+'g'#7#17'ProcessingHandler'#17'OnPrintHTMLHeader'#7#21'ViewerPrintHTMLHeader'
+#17'OnPrintHTMLFooter'#7#21'ViewerPrintHTMLFooter'#9'OnInclude'#7#13'ViewerI'
+'nclude'#14'OnSoundRequest'#7#12'SoundRequest'#13'OnMetaRefresh'#7#16'MetaRe'
+'freshEvent'#13'OnObjectClick'#7#11'ObjectClick'#12'OnRightClick'#7#10'Right'
+'Click'#0#0#0#11'TOpenDialog'#10'OpenDialog'#10'DefaultExt'#6#4'.htm'#6'Filt'
+'er'#6'%html files|*.htm;*.html|all files|*.*'#7'Options'#11#14'ofHideReadOn'
+'ly'#15'ofPathMustExist'#15'ofFileMustExist'#0#4'left'#3'I'#1#3'top'#2#2#0#0
+#9'TMainMenu'#8'MainMenu'#4'left'#3'#'#1#3'top'#2#4#0#9'TMenuItem'#5'File1'#7
+'Caption'#6#5'&File'#0#9'TMenuItem'#4'Open'#7'Caption'#6#5'&Open'#8'ShortCut'
+#2'r'#7'OnClick'#7#13'OpenFileClick'#0#0#9'TMenuItem'#12'OpenTextFile'#7'Cap'
+'tion'#6#15'Open &Text File'#7'OnClick'#7#17'OpenTextFileClick'#0#0#9'TMenuI'
+'tem'#13'OpenImageFile'#7'Caption'#6#16'Open &Image File'#7'OnClick'#7#18'Op'
+'enImageFileClick'#0#0#9'TMenuItem'#13'PrinterSetup1'#7'Caption'#6#16'Printe'
+'r Setup...'#7'OnClick'#7#18'PrinterSetup1Click'#0#0#9'TMenuItem'#12'Printpr'
+'eview'#7'Caption'#6#14'Print pre&view'#7'Enabled'#8#7'OnClick'#7#17'Printpr'
+'eviewClick'#0#0#9'TMenuItem'#6'Print1'#7'Caption'#6#9'&Print...'#7'Enabled'
+#8#7'OnClick'#7#11'Print1Click'#0#0#9'TMenuItem'#2'N1'#7'Caption'#6#1'-'#0#0
+#9'TMenuItem'#5'Exit1'#7'Caption'#6#5'E&xit'#7'OnClick'#7#10'Exit1Click'#0#0
+#0#9'TMenuItem'#5'Edit2'#7'Caption'#6#5'&Edit'#7'OnClick'#7#10'Edit2Click'#0
+#9'TMenuItem'#5'Find1'#7'Caption'#6#5'&Find'#7'Enabled'#8#7'OnClick'#7#10'Fi'
+'nd1Click'#0#0#9'TMenuItem'#8'CopyItem'#7'Caption'#6#5'&Copy'#8'ShortCut'#3
+'C@'#7'OnClick'#7#13'CopyItemClick'#0#0#9'TMenuItem'#2'N2'#7'Caption'#6#1'-'
+#0#0#9'TMenuItem'#13'SelectAllItem'#7'Caption'#6#11'Select &All'#7'Enabled'#8
+#7'OnClick'#7#18'SelectAllItemClick'#0#0#0#9'TMenuItem'#8'options1'#7'Captio'
+'n'#6#8'&Options'#0#9'TMenuItem'#10'ShowImages'#7'Caption'#6#12'&Show images'
+#7'OnClick'#7#15'ShowImagesClick'#0#0#9'TMenuItem'#5'Fonts'#7'Caption'#6#23
,'Default &Font/Colors...'#7'OnClick'#7#15'FontColorsClick'#0#0#0#9'TMenuItem'
+#15'HistoryMenuItem'#7'Caption'#6#8'&History'#7'Visible'#8#0#0#9'TMenuItem'#6
+'About1'#7'Caption'#6#6'&About'#7'OnClick'#7#11'About1Click'#0#0#0#12'TPrint'
+'Dialog'#11'PrintDialog'#8'FromPage'#2#1#7'MinPage'#2#1#7'MaxPage'#3#15''''#7
+'Options'#11#10'poPageNums'#0#6'ToPage'#2#1#4'left'#3'j'#1#3'top'#2#1#0#0#11
+'TFindDialog'#10'FindDialog'#7'Options'#11#6'frDown'#15'frHideWholeWord'#18
+'frDisableWholeWord'#0#6'OnFind'#7#14'FindDialogFind'#4'left'#3#249#0#3'top'
+#4#255#255#0#0#0#0#10'TPopupMenu'#9'PopupMenu'#4'left'#3#144#1#3'top'#2#1#0#9
+'TMenuItem'#9'Viewimage'#7'Caption'#6#11'&View image'#7'OnClick'#7#14'Viewim'
+'ageClick'#0#0#9'TMenuItem'#20'CopyImageToClipboard'#7'Caption'#6#24'&Copy i'
+'mage to clipboard'#7'OnClick'#7#25'CopyImageToClipboardClick'#0#0#9'TMenuIt'
+'em'#2'N3'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#15'OpenInNewWindow'#7'Caption'
+#6#19'&Open in new window'#7'OnClick'#7#20'OpenInNewWindowClick'#0#0#0#6'TTi'
+'mer'#9'MetaTimer'#7'Enabled'#8#7'OnTimer'#7#14'MetaTimerTimer'#4'left'#3#242
+#0#3'top'#2'K'#0#0#6'TTimer'#6'Timer1'#8'Interval'#3#200#0#7'OnTimer'#7#11'T'
+'imer1Timer'#4'left'#3'#'#1#3'top'#2'G'#0#0#19'TPrinterSetupDialog'#18'Print'
+'erSetupDialog'#4'left'#3#192#1#0#0#0
]);

View File

@ -788,12 +788,16 @@ begin
J := Pos(':', UpperCase(SRC));
if J = 0 then
begin
URL := MyPageLoader.LastPageURL + Copy(SRC, 2, Length(SRC)-1)
if (Length(MyPageLoader.LastPageURL) > 0) and
(MyPageLoader.LastPageURL[Length(MyPageLoader.LastPageURL)] = '/') then
URL := MyPageLoader.LastPageURL + Copy(SRC, 2, Length(SRC)-1)
else
URL := MyPageLoader.LastPageURL + SRC;
end
else URL := SRC;
else
URL := SRC;
J := Pos('HTTP:', UpperCase(URL));
J := Pos('http:', LowerCase(URL));
if (J > 0) then
begin
MyPageLoader.LoadBinaryResource(URL, Stream);

View File

@ -38,8 +38,12 @@ end;
procedure TPageLoader.LoadFromURL(AURL: string);
var
Client: THttpSend;
J: Integer;
begin
LastPageURL := AURL;
// If there is no protocol, add http
J := Pos(':', AURL);
if (J = 0) then LastPageURL := 'http://' + AURL
else LastPageURL := AURL;
Client := THttpSend.Create;
try
@ -52,7 +56,7 @@ begin
// end;
// Client.UserAgent := AUserAgent;
Client.HttpMethod('GET', AURL);
Client.HttpMethod('GET', LastPageURL);
Client.Document.Position := 0;
ContentsList.LoadFromStream(Client.Document);
@ -63,7 +67,6 @@ begin
end;
end;
{.$define FPB_DEBUG_IMAGE_LOAD}
procedure TPageLoader.LoadBinaryResource(AURL: string; var ADest: TMemoryStream);
var
Client: THttpSend;
@ -82,17 +85,7 @@ begin
Client.Document.Position := 0;
ADest := TMemoryStream.Create;
ADest.CopyFrom(Client.Document, Client.Document.Size);
// ADest.SaveToFile('/Users/felipe/test.gif');
{$IFDEF FPB_DEBUG_IMAGE_LOAD}
ContentsList.LoadFromStream(Client.Document);
WriteLn('Starting to receive image: ' + AURL);
for i := 0 to ContentsList.Count-1 do
WriteLn(ContentsList.Strings[i]);
Contents := ContentsList.Text;
{$ENDIF}
// WriteLn(AURL, ' Size: ', ADest.Size);
finally
Client.Free;
end;