It is currently Mon May 25, 2020 10:09 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject:
PostPosted: Sat Aug 11, 2001 1:16 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by ferryman.

I loaded the beta console version of PureBasic and it works well when creating console programs, but still no joy with CGI. There is something I am missing . I will continue to look.

ferryman.

Edited by - ferryman on 13 August 2001 18:51:57


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Aug 11, 2001 6:43 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by Mr.Skunk.

I don't know about HTTP header, but i found this link, hope it can help you

http://www.stars.com/Internet/Protocols/HTTP/Headers.html

The header lines received from the client, if any, are placed by the server into the CGI environment variables with the prefix HTTP_ followed by the header name. Any - characters in the header name are changed to _ characters. The server may exclude any headers which it has already processed, such as Authorization, Content-type, and Content-length.

Mr Skunk

Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Aug 11, 2001 7:56 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by ferryman.

The first two lines are the CGI headers:

Status: 200 OK
Content-Type:text/html

There can be a lot more than just two lines if required. For example you could set cookies at this point. There is then a blank line followed by the text or HTML. In the example:

Hello. It worked !!


I have tried writing the same program in PowerBasic and RapidQ and both work correctly. The reasons I can't use these languages are: PowerBasic only works under Windows but the target system is Linux. RapidQ compiles to byte-code and takes 20-30 seconds to create the page I require. There is almost no I/O it's all CPU. As PureBasic run on both Windows and Linux, compiles to real code, is easy to use and if I can get this problem sorted, it looks the best language for this development.

Sorry I've gone off the point

The problem is not within the headers, it is more likely to be with the STDOUT stream.

Ferryman.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Aug 12, 2001 2:42 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by wavemaker.

Hi,

Ferryman, you're trying to deal exactly with the same library I've been fighting with: CGI. I haven't been able to write a working Stdin/Stdout function, although it should be possible using the Api or the C function you provide. I write libraries in Asm because I don't understand how Lcc works -I use djgpp for C-, and Asm is faster, but if you find a way in C, it will be welcome!

I wrote two functions in Asm for CGI handling: URLEncode and URLDecode, which explain themselves but are quite useless without stdin data to process. I'll send them to you if you want, when I return home, two weeks from now.

By the way, shouldn't Http headers start with "Content-type: text/html"? What does "Status: 200 OK" stand for? Anyway, I can't figure out why your function isn't working. If you need any help, feel free to ask.

Regards,

Wavemaker

Juan Calderón Alonso
Registered user


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Aug 12, 2001 5:42 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by fred.

Quote:
The first two lines are the CGI headers:

Status: 200 OK
Content-Type:text/html

There can be a lot more than just two lines if required. For example you could set cookies at this point. There is then a blank line followed by the text or HTML. In the example:

Hello. It worked !!


I have tried writing the same program in PowerBasic and RapidQ and both work correctly. The reasons I can't use these languages are: PowerBasic only works under Windows but the target system is Linux. RapidQ compiles to byte-code and takes 20-30 seconds to create the page I require. There is almost no I/O it's all CPU. As PureBasic run on both Windows and Linux, compiles to real code, is easy to use and if I can get this problem sorted, it looks the best language for this development.

Sorry I've gone off the point

The problem is not within the headers, it is more likely to be with the STDOUT stream.

Ferryman.





Hi !

I like to see than CGI stuff could be done in PureBasic. About the stdin/stdout stuff, that's because PureBasic create only Win32 applications, not console applications (there is a difference under MS Windows between these the both format). So the only way I see is to produce console apps. BTW, if you test your code under Linux/AmigaOS, it SHOULD work, as printf() output on the console... Please e-mail me personnaly ([url]mailto:alphasnd@purebasic.com[/url]) to get the beta version of PureBasic/Console so you could do your tests..



Fred - AlphaSND


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 13, 2001 11:22 am 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by ferryman.

The "Status: 200 OK" is just part of the CGI standard. There are other error codes that could be sent but I normally create my own error pages.

The MKCON routine should change the flag in the EXE to mark it as a console application. This is how I can run it from a command prompt. Normally anything that works this way also works using CGI.

The idea I had for a library was the smallest amount I can get away with in C and do everthing else in Basic using an "IncludeFile".

Fred. Thank you for the offer, I will forward you my email address.

Ferryman.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 13, 2001 5:53 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by ferryman.

Sorry last post went to top of list should of been at bottom.

ferryman.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 14, 2001 12:54 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by ferryman.

Got it !!!

After doing a bit of searching on the Internet I found a page where someone else was having this problem. So I change my library to:

printf(OutputString);
fflush(stdout);


and it worked. The Environment variables work first time, so all I now need it to get the STDIN working.

ferryman.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye