~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/utils/fppkg/pkgocurl.pp

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{$mode objfpc}
 
2
{$h+}
 
3
unit pkgoCurl;
 
4
 
 
5
interface
 
6
 
 
7
uses Classes,pkgdownload;
 
8
 
 
9
Type
 
10
  TOCurlDownloader = Class(TBaseDownloader)
 
11
  Private
 
12
    FCurl : String;
 
13
  Protected
 
14
    Procedure OCurlDownload(Const URL : String; Dest : TStream); virtual;
 
15
    Procedure FTPDownload(Const URL : String; Dest : TStream); override;
 
16
    Procedure HTTPDownload(Const URL : String; Dest : TStream); override;
 
17
 Public
 
18
    Property Curl : String Read FCurl Write FCurl;
 
19
 end;
 
20
 
 
21
implementation
 
22
 
 
23
uses sysutils,curlobj,pkgmessages;
 
24
 
 
25
Procedure TOCurlDownloader.OCurlDownload(Const URL : String; Dest : TStream);
 
26
 
 
27
Var
 
28
  ACurl : TCurl;
 
29
  FN : String;
 
30
  F : TFileStream;
 
31
 
 
32
begin
 
33
  FN:=GetTempFileName();
 
34
  Try
 
35
    ACurl:=TCurl.Create(Nil);
 
36
    Try
 
37
      ACurl.URL:=URL;
 
38
      ACurl.OutputFile:=FN;
 
39
      ACurl.NoProgress:=True;
 
40
      ACurl.Verbose:=False;
 
41
      ACurl.FollowLocation:=True;
 
42
      If Not ACurl.Perform then
 
43
        Error(ACurl.ErrorString);
 
44
    Finally
 
45
      ACurl.Free;
 
46
    end;
 
47
    F:=TFileStream.Create(FN,fmOpenRead);
 
48
    Try
 
49
      Dest.CopyFrom(F,0);
 
50
    Finally
 
51
      F.Free;
 
52
    end;
 
53
  Finally
 
54
    If FileExists(FN) then
 
55
      DeleteFile(FN);
 
56
  end;
 
57
end;
 
58
 
 
59
Procedure TOCurlDownloader.FTPDownload(Const URL : String; Dest : TStream);
 
60
 
 
61
begin
 
62
  OCurlDownload(URL,Dest);
 
63
end;
 
64
 
 
65
Procedure TOCurlDownloader.HTTPDownload(Const URL : String; Dest : TStream);
 
66
 
 
67
begin
 
68
  OCurlDownload(URL,Dest);
 
69
end;
 
70
 
 
71
end.
 
 
b'\\ No newline at end of file'