Re: [fpc-pascal] Free Pascal 2.6.2 rc1
Mark Morgan Lloyd wrote / napísal(a): Marco van de Voort wrote: Hello, We have placed the first release-candidate of the Free Pascal Compiler version 2.6.2 on our ftp-servers. You can help improve the upcoming 2.6.2 release by downloading and testing this release. If you want you can report what you have done here: http://wiki.freepascal.org/Testers_2.6.2 I don't like raising my head above the parapet on this one, but running on Linux x86 (32-bit): If Lazarus trunk is built with 2.6.0 the bug described at http://bugs.freepascal.org/view.php?id=22463 does not occur. If Lazarus trunk is built with 2.6.2 rc1 the bug is reproducible. *Is it reproducible also when you compile Lazarus trunk with FPC trunk ? L. * The SQL in the attachment can be simplified to the six lines given in one of the notes. LacaK2 appears to have demonstrated that the error does not occur if the SQL is forced in as part of the program rather than from the Lazarus IDE, but this bug still appears to be something to do with the compiler version. The error can be seen simply by reading the project into the Lazarus IDE, it's not necessary to compile/run. I've not managed to get anywhere tracking this down myself. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] A simple HTTP request with FPC standard units
Hello listers, Using Synapse, the developer has very good features to deal with the HTTP protocol. But imagine you want only to do a "get" in a URL and take a string back. I imagine it can be done with the standard units of Freepascal. Is it true? How could I do it with FPC 2.7.1? Best regards, Luciano ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A simple HTTP request with FPC standard units
On Fri, 23 Nov 2012, luciano de souza wrote: Hello listers, Using Synapse, the developer has very good features to deal with the HTTP protocol. But imagine you want only to do a "get" in a URL and take a string back. I imagine it can be done with the standard units of Freepascal. Is it true? How could I do it with FPC 2.7.1? very simple: uses fphttpclient; Var S : String; begin With TFPHttpClient.Create(Nil) do try S:=Get(ParamStr(1)); finally Free; end; Writeln('Got : ',S); end. home: >fpc -S2 th.pp /usr/bin/ld: warning: link.res contains output sections; did you forget -T? home: >th http://www.freepascal.org/ Got :
Re: [fpc-pascal] A simple HTTP request with FPC standard units
Yes, when I ask for a simple way, I could not imagine something so simpler! Thank you. Your tip help me a lot. The success of your answer is so that I add a question: is there also a FPC native unit dealing with SMTP? Em 23-11-2012 14:15, Michael Van Canneyt escreveu: On Fri, 23 Nov 2012, luciano de souza wrote: Hello listers, Using Synapse, the developer has very good features to deal with the HTTP protocol. But imagine you want only to do a "get" in a URL and take a string back. I imagine it can be done with the standard units of Freepascal. Is it true? How could I do it with FPC 2.7.1? very simple: uses fphttpclient; Var S : String; begin With TFPHttpClient.Create(Nil) do try S:=Get(ParamStr(1)); finally Free; end; Writeln('Got : ',S); end. home: >fpc -S2 th.pp /usr/bin/ld: warning: link.res contains output sections; did you forget -T? home: >th http://www.freepascal.org/ Got :
Re: [fpc-pascal] A simple HTTP request with FPC standard units
GREAT unit, I love Free Pascal! Two errors, with: program project1; {$mode objfpc}{$H+} uses fphttpclient; var S: string; begin with TFPHttpClient.Create(nil) do try S := Get(ParamStr(1)); finally Free; end; WriteLn('Got : ', S); end. I got: C:\Users\silvioprog\Desktop\test>project1.exe An unhandled exception occurred at $004115F1: EHTTPClient: Invalid protocol : "" $004115F1 $0041189E $004118FE $0040167F main, line 13 of project1.lpr With: program project1; {$mode objfpc}{$H+} uses fphttpclient; var S: string; begin with TFPHttpClient.Create(nil) do try S := Get('http://silvioprog.com.br'); finally Free; end; WriteLn('Got : ', S); end. I got: C:\Users\silvioprog\Desktop\test>project1.exe An unhandled exception occurred at $0040FE72: EAccessViolation: Access violation $0040FE72 $00410042 $00411576 $004117CE $0041182E $0040166D main, line 13 of project1.lpr What I'm is wrong? My environment: Lazarus 1.1 r38836 FPC 2.7.1 i386-win32-win32/win64 2012/11/23 Michael Van Canneyt > > > On Fri, 23 Nov 2012, luciano de souza wrote: > > Hello listers, >> Using Synapse, the developer has very good features to deal with the >> HTTP protocol. But imagine you want only to do a "get" in a URL and >> take a string back. I imagine it can be done with the standard units >> of Freepascal. Is it true? How could I do it with FPC 2.7.1? >> > > very simple: > > uses fphttpclient; > > Var > S : String; > > begin > With TFPHttpClient.Create(Nil) do > try > S:=Get(ParamStr(1)); > finally > Free; > end; > Writeln('Got : ',S); > end. > > home: >fpc -S2 th.pp > /usr/bin/ld: warning: link.res contains output sections; did you forget -T? > home: >th http://www.freepascal.org/ > Got : > >
Re: [fpc-pascal] A simple HTTP request with FPC standard units
> > From: silvioprog >To: FPC-Pascal users discussions >Sent: Friday, November 23, 2012 2:38 PM >Subject: Re: [fpc-pascal] A simple HTTP request with FPC standard units > > >Done: > > >http://bugs.freepascal.org/view.php?id=23372 > > > > >2012/11/23 silvioprog > >I solved the error. In: >> >> >>fphttpclient.pas:line285 >> >>Function TFPCustomHTTPClient.GetServerURL(URI : TURI) : String; >> >> >>Var >> D : String; >> >> >>begin >> D:=URI.Path; >> If (D[1]<>'/') then >> D:='/'+D; >> If (D[Length(D)]<>'/') then >> D:=D+'/'; >> Result:=D+URI.Document; >> if (URI.Params<>'') then >> Result:=Result+'?'+URI.Params; >>end; >> >> The code needed to execute the function could be even smaller if this is changed to a class function. Instead of needing to create an instance, then using, then freeing, the whole thing could something like this: ... begin s := TFPCustomHTTPClient.GetServerURL('http://a_site/a_page'); writeln(s); end; ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A simple HTTP request with FPC standard units
On Fri, 23 Nov 2012, Leonardo M. Ramé wrote: From: silvioprog To: FPC-Pascal users discussions Sent: Friday, November 23, 2012 2:38 PM Subject: Re: [fpc-pascal] A simple HTTP request with FPC standard units Done: http://bugs.freepascal.org/view.php?id=23372 2012/11/23 silvioprog I solved the error. In: fphttpclient.pas:line285 Function TFPCustomHTTPClient.GetServerURL(URI : TURI) : String; Var D : String; begin D:=URI.Path; If (D[1]<>'/') then D:='/'+D; If (D[Length(D)]<>'/') then D:=D+'/'; Result:=D+URI.Document; if (URI.Params<>'') then Result:=Result+'?'+URI.Params; end; The code needed to execute the function could be even smaller if this is changed to a class function. Instead of needing to create an instance, then using, then freeing, the whole thing could something like this: ... begin s := TFPCustomHTTPClient.GetServerURL('http://a_site/a_page'); writeln(s); You mean probably s := TFPCustomHTTPClient.Get('http://a_site/a_page'); It could be done, but it will need to create an instance anyway. Although I suspect such a simple case is a minority. Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A simple HTTP request with FPC standard units
- Original Message - > From: Michael Van Canneyt > To: FPC-Pascal users discussions > Cc: > Sent: Friday, November 23, 2012 5:07 PM > Subject: Re: [fpc-pascal] A simple HTTP request with FPC standard units > > > > On Fri, 23 Nov 2012, Leonardo M. Ramé wrote: > >> >> >>> >>> From: silvioprog >>> To: FPC-Pascal users discussions > >>> Sent: Friday, November 23, 2012 2:38 PM >>> Subject: Re: [fpc-pascal] A simple HTTP request with FPC standard units >>> >>> >>> Done: >>> >>> >>> http://bugs.freepascal.org/view.php?id=23372 >>> >>> >>> >>> >>> 2012/11/23 silvioprog >>> >>> I solved the error. In: fphttpclient.pas:line285 Function TFPCustomHTTPClient.GetServerURL(URI : TURI) : String; Var D : String; begin D:=URI.Path; If (D[1]<>'/') then D:='/'+D; If (D[Length(D)]<>'/') then D:=D+'/'; Result:=D+URI.Document; if (URI.Params<>'') then Result:=Result+'?'+URI.Params; end; >> >> The code needed to execute the function could be even smaller if this is > changed to a class function. Instead of needing to create an instance, then > using, then freeing, the whole thing could something like this: >> >> ... >> begin >> s := TFPCustomHTTPClient.GetServerURL('http://a_site/a_page'); >> writeln(s); > > You mean probably > s := TFPCustomHTTPClient.Get('http://a_site/a_page'); > > It could be done, but it will need to create an instance anyway. > Although I suspect such a simple case is a minority. > > Michael. > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal Yes, I said this because the original poster wrote he needed the very little code to accomplish this. Leonardo M. Ramé http://leonardorame.blogspot.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A simple HTTP request with FPC standard units
On Fri, 23 Nov 2012, Leonardo M. Ramé wrote: You mean probably s := TFPCustomHTTPClient.Get('http://a_site/a_page'); It could be done, but it will need to create an instance anyway. Although I suspect such a simple case is a minority. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal Yes, I said this because the original poster wrote he needed the very little code to accomplish this. I implemented the class methods for all forms of Get/Post/Formpost, so now you can do: s := TFPCustomHTTPClient.SimpleGet('http://a_site/a_page'); You can't get more simple than that. Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A simple HTTP request with FPC standard units
Among its hundreds of units, the Freepascal always keeps surprises for us. FPHTTPClient was a pleasant surprise. The talk has followed freely and perhaps my question has been skipped: is there Freepascal native routines to deal with SMTP protocol? In other words, is there a native way to send an e-mail with Freepascal? 2012/11/23, Michael Van Canneyt : > > > On Fri, 23 Nov 2012, Leonardo M. Ramé wrote: > >>> You mean probably >>>s := TFPCustomHTTPClient.Get('http://a_site/a_page'); >>> >>> It could be done, but it will need to create an instance anyway. >>> Although I suspect such a simple case is a minority. >>> >>> Michael. >>> ___ >>> fpc-pascal maillist - fpc-pascal@lists.freepascal.org >>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >> >> >> Yes, I said this because the original poster wrote he needed the very >> little code to accomplish this. > > I implemented the class methods for all forms of Get/Post/Formpost, so now > you can do: > > s := TFPCustomHTTPClient.SimpleGet('http://a_site/a_page'); > > You can't get more simple than that. > > Michael. -- Luciano de Souza ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A simple HTTP request with FPC standard units
luciano de souza wrote: Among its hundreds of units, the Freepascal always keeps surprises for us. FPHTTPClient was a pleasant surprise. The talk has followed freely and perhaps my question has been skipped: is there Freepascal native routines to deal with SMTP protocol? In other words, is there a native way to send an e-mail with Freepascal? Here is the most simple way I know of (but I'd be glad to learn of a more simple way): http://www.turbocontrol.com/easyemail.htm -- Regards, Paul Breneman www.dbReplication.com - VCL database replication components www.TurboControl.com - Hardware and software development services - Educational programming project for environment monitoring - Information on using FreePascal for embedded systems - Support information for the TurboPower open source libraries ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A simple HTTP request with FPC standard units
2012/11/23 Michael Van Canneyt > On Fri, 23 Nov 2012, luciano de souza wrote: > > Hello listers, >> Using Synapse, the developer has very good features to deal with the >> HTTP protocol. But imagine you want only to do a "get" in a URL and >> take a string back. I imagine it can be done with the standard units >> of Freepascal. Is it true? How could I do it with FPC 2.7.1? >> > > very simple: > > uses fphttpclient; > > Var > S : String; > > begin > With TFPHttpClient.Create(Nil) do > try > S:=Get(ParamStr(1)); > finally > Free; > end; > Writeln('Got : ',S); > end. > > > home: >fpc -S2 th.pp > /usr/bin/ld: warning: link.res contains output sections; did you forget -T? > home: >th http://www.freepascal.org/ > Got : > >