diff --git a/.gitattributes b/.gitattributes index 818045d1bb..96b83a58f1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2372,6 +2372,10 @@ packages/fcl-web/examples/combined/wmusers.lrs svneol=native#text/plain packages/fcl-web/examples/combined/wmusers.pp svneol=native#text/plain packages/fcl-web/examples/httpclient/httpget.lpi svneol=native#text/plain packages/fcl-web/examples/httpclient/httpget.pas svneol=native#text/plain +packages/fcl-web/examples/httpclient/httppost.lpi svneol=native#text/plain +packages/fcl-web/examples/httpclient/httppost.pp svneol=native#text/plain +packages/fcl-web/examples/httpclient/httppostfile.lpi svneol=native#text/plain +packages/fcl-web/examples/httpclient/httppostfile.pp svneol=native#text/plain packages/fcl-web/examples/httpserver/simplehttpserver.lpi svneol=native#text/plain packages/fcl-web/examples/httpserver/simplehttpserver.pas svneol=native#text/plain packages/fcl-web/examples/jsonrpc/demo1/README.txt svneol=native#text/plain diff --git a/packages/fcl-web/examples/httpclient/httpget.lpi b/packages/fcl-web/examples/httpclient/httpget.lpi index eb5cb1917d..b31a8fec7e 100644 --- a/packages/fcl-web/examples/httpclient/httpget.lpi +++ b/packages/fcl-web/examples/httpclient/httpget.lpi @@ -13,7 +13,6 @@ <ResourceType Value="res"/> <UseXPManifest Value="True"/> - <Icon Value="0"/> </General> <i18n> <EnableI18N LFM="False"/> @@ -35,17 +34,12 @@ <LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> </local> </RunParams> - <Units Count="2"> + <Units Count="1"> <Unit0> <Filename Value="httpget.pas"/> <IsPartOfProject Value="True"/> <UnitName Value="httpget"/> </Unit0> - <Unit1> - <Filename Value="fphttpclient.pp"/> - <IsPartOfProject Value="True"/> - <UnitName Value="fphttpclient"/> - </Unit1> </Units> </ProjectOptions> <CompilerOptions> diff --git a/packages/fcl-web/examples/httpclient/httppost.lpi b/packages/fcl-web/examples/httpclient/httppost.lpi new file mode 100644 index 0000000000..14bbde1b58 --- /dev/null +++ b/packages/fcl-web/examples/httpclient/httppost.lpi @@ -0,0 +1,76 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="Form post example"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <Icon Value="0"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="httppost.pp"/> + <IsPartOfProject Value="True"/> + <UnitName Value="httppost"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <UseAnsiStrings Value="False"/> + </SyntaxOptions> + </Parsing> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/httpclient/httppost.pp b/packages/fcl-web/examples/httpclient/httppost.pp new file mode 100644 index 0000000000..9ecc3b1c08 --- /dev/null +++ b/packages/fcl-web/examples/httpclient/httppost.pp @@ -0,0 +1,30 @@ +program httppost; + +{$mode objfpc}{$H+} + +uses + SysUtils, Classes, fphttpclient; + +Var + F : TFileStream; + Vars : TStrings; + i : integer; +begin + With TFPHTTPClient.Create(Nil) do + begin + F:=TFileStream.Create('response.html',fmCreate); + try + Vars:=TstringList.Create; + try + For i:=1 to 10 do + Vars.Add(Format('Var%d=Value %d',[i,i])); + FormPost(ParamStr(1),vars,f); + finally + Vars.Free; + end; + finally + F.Free; + end; + end; +end. + diff --git a/packages/fcl-web/examples/httpclient/httppostfile.lpi b/packages/fcl-web/examples/httpclient/httppostfile.lpi new file mode 100644 index 0000000000..ff10fe92eb --- /dev/null +++ b/packages/fcl-web/examples/httpclient/httppostfile.lpi @@ -0,0 +1,77 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <UseDefaultCompilerOptions Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="Form post file example"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <Icon Value="0"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="httppostfile.pp"/> + <IsPartOfProject Value="True"/> + <UnitName Value="httppostfile"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <UseAnsiStrings Value="False"/> + </SyntaxOptions> + </Parsing> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/httpclient/httppostfile.pp b/packages/fcl-web/examples/httpclient/httppostfile.pp new file mode 100644 index 0000000000..4d3202a64f --- /dev/null +++ b/packages/fcl-web/examples/httpclient/httppostfile.pp @@ -0,0 +1,28 @@ +program httppostfile; + +{$mode objfpc}{$H+} + +uses + SysUtils, Classes, fphttpclient; + +Var + F : TFileStream; + Vars : TStrings; + i : integer; +begin + With TFPHTTPClient.Create(Nil) do + begin + F:=TFileStream.Create('response.html',fmCreate); + try + Vars:=TstringList.Create; + try + FileFormPost(ParamStr(1),'myfile',paramstr(2),f); + finally + Vars.Free; + end; + finally + F.Free; + end; + end; +end. +