[fpc-pascal] Cannot reuse TFPHTTPClient object for 2 different POST requests
Consider the following program (it's a real program with real parameters, nothing hidden, so you can really just try it out because the target server is public): {$mode objfpc}{$H+} uses fphttpclient; var HTTP: TFPHTTPClient; begin HTTP := TFPHTTPClient.Create(nil); WriteLn('Response 1:'); WriteLn( HTTP.FormPost( 'http://api.jne.co.id:8889/tracing/sirclo/price', 'username=SIRCLO&api_key=4fd0e22535c32eb9e5496c311190760d&from=BOO1&thru=AMI1&weight=1' ) ); WriteLn('Response 2:'); WriteLn( HTTP.FormPost( 'http://api.jne.co.id:8889/tracing/sirclo/price', 'username=SIRCLO&api_key=4fd0e22535c32eb9e5496c311190760d&from=BDO1&thru=AMI1&weight=1' ) ); WriteLn('Response 3:'); WriteLn( HTTP.FormPost( 'http://api.jne.co.id:8889/tracing/sirclo/origin/key/BANDUNG', 'username=SIRCLO&api_key=4fd0e22535c32eb9e5496c311190760d' ) ); HTTP.Free; end. In above program, Response 3 will stuck in infinite loop. Similarly, if we move Response 3 up as the first request and then copy-paste-d: {$mode objfpc}{$H+} uses fphttpclient; var HTTP: TFPHTTPClient; begin HTTP := TFPHTTPClient.Create(nil); WriteLn('Response 1:'); WriteLn( HTTP.FormPost( 'http://api.jne.co.id:8889/tracing/sirclo/origin/key/BANDUNG', 'username=SIRCLO&api_key=4fd0e22535c32eb9e5496c311190760d' ) ); WriteLn('Response 2:'); WriteLn( HTTP.FormPost( 'http://api.jne.co.id:8889/tracing/sirclo/origin/key/BOGOR', 'username=SIRCLO&api_key=4fd0e22535c32eb9e5496c311190760d' ) ); WriteLn('Response 3:'); WriteLn( HTTP.FormPost( 'http://api.jne.co.id:8889/tracing/sirclo/price', 'username=SIRCLO&api_key=4fd0e22535c32eb9e5496c311190760d&from=BOO1&thru=AMI1&weight=1' ) ); HTTP.Free; end. the new Response 3 will result in empty string. As can be seen, the request starts failing (either stuck or empty string) when the URL is changed. Change in FormData is OK as demonstrated above. -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Cannot-reuse-TFPHTTPClient-object-for-2-different-POST-requests-tp5720779.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] OSX x86_64 make problem
Hello free pascal compiler developers, Problem: On OSX the x86_64-darwin compiler "ppcx64" is not being built. Background: I am in the process of writing a series of installers/scripts for Free Pascal 3.0 and Lazarus 1.4 testing. I'm currently writing a unified OSX install script which automates installing up these items on a fresh copy of OSX. Details: The problem I am having is that even on a 64bit Mac, the "make all" command builds i386-darwin. When I try to "make crossinstall OS_TARGET=darwin CPU_TARGET=x86_64 INSTALL_PREFIX=/Users/macuser/Development/Base/fpc" the make command returns success, but no ppcx64 is ever created. When I write a simple test program such as below and compile with "fpc hello.pas", the output is 'SizeOf(Pointer) = 4' program hello; begin WriteLn('SizeOf(Pointer) = ', SizeOf(Pointer)); end. When I compile with 'fpc -Px86_64 hello.pas' i get the error: Fatal: Compilation aborted Error: /usr/local/bin/ppcx64 returned an error exitcode macuser@macpc~/Development/Base/test$ /bin/sh: x86_64-darwin-as: command not found Which tells fpc fell back to the 2.6.4 complier instead of my new 3.0.1 compiler because it couldn't find ppcx64 in my '/Users/macuser/Development/Base/fpc/bin' folder. In fact, no ppcx64 is being generated at all. Here is the out of my make crossinstall command: http://pastebin.com/yBJL4mQi And when I type "find /Users/macuser/Development/Base/fpc name=ppcx64", no result is found. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OSX x86_64 make problem
I forgot to mention, I am using fpc sources from the fixes_3_0 branch, and building using fpc 2.6.4. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OSX x86_64 make problem
On 01/16/2015 10:08 PM, Anthony Walter wrote: > Details: The problem I am having is that even on a 64bit Mac, the > "make all" command builds i386-darwin. When I try to "make > crossinstall OS_TARGET=darwin CPU_TARGET=x86_64 > INSTALL_PREFIX=/Users/macuser/Development/Base/fpc" Have you tried `make CPU_TARGET=x86_64 all` instead of `crossinstall`? That's how I just built the latest revision, 29488. Just a suggestion... -- Ewald ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OSX x86_64 make problem
On 16/01/15 22:08, Anthony Walter wrote: > > Details: The problem I am having is that even on a 64bit Mac, the "make > all" command builds i386-darwin. When I try to "make crossinstall > OS_TARGET=darwin CPU_TARGET=x86_64 > INSTALL_PREFIX=/Users/macuser/Development/Base/fpc" the make command > returns success, but no ppcx64 is ever created. It will install a file called ppcrossx64. My own build script renames it to ppcx64 after "make install" (and before building the installer package). The reason the default is ppcrossx64, is because otherwise inside the compiler dir the built native compiler would overwrite the built cross-compiler, and installing both into the same prefix would not be possible either. However, there is no reason on Darwin to use different name for native and for cross-compilers (you can combine both into a fat binary, if you absolutely want two versions), and always using the same name makes it easier for scripts to call the compiler using a fixed name. > When I compile with 'fpc -Px86_64 hello.pas' i get the error: > > Fatal: Compilation aborted > Error: /usr/local/bin/ppcx64 returned an error exitcode > macuser@macpc~/Development/Base/test$ /bin/sh: x86_64-darwin-as: command > not found > > Which tells fpc fell back to the 2.6.4 complier That error says that some program cannot find a cross-assembler, which is a message emitted by a compiler binary (not by the "fpc" utility). That message is not specific to either FPC 2.6.4 or to 3.x. It suggests that the compiler is not using the default /etc/fpc.cfg configuration file, or an otherwise custom fpc.cfg file that does not contain the necessary ifdefs to prevents a cross-compiling prefix from being added to the assembler and linker when targeting Darwin (any architecture) from a Darwin (any architecture) system. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OSX x86_64 make problem
Zhis is what I use on my Mac: make clean all CPU_TARGET=x86_64 INSTALL_PREFIX=$HOME/3.0.1 Michael Am 16.01.15 um 22:23 schrieb Ewald: On 01/16/2015 10:08 PM, Anthony Walter wrote: Details: The problem I am having is that even on a 64bit Mac, the "make all" command builds i386-darwin. When I try to "make crossinstall OS_TARGET=darwin CPU_TARGET=x86_64 INSTALL_PREFIX=/Users/macuser/Development/Base/fpc" Have you tried `make CPU_TARGET=x86_64 all` instead of `crossinstall`? That's how I just built the latest revision, 29488. Just a suggestion... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal