atomic web server threads

Share your advanced PureBasic knowledge/code with the community.
pjay
Enthusiast
Enthusiast
Posts: 251
Joined: Thu Mar 30, 2006 11:14 am

Re: atomic web server threads

Post by pjay »

Thanks, I think I may have a use for this in the very near future.

You post so much useful code; I'm sure others have said before, but 'Idle' is not the correct username for someone so productive :lol:
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

pjay wrote: Thu Mar 28, 2024 7:56 am Thanks, I think I may have a use for this in the very near future.

You post so much useful code; I'm sure others have said before, but 'Idle' is not the correct username for someone so productive :lol:
Thanks pjay, I've pursued being Idle for 30 odd years and now I get to live it! On an Island near the International Date Line East.
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: atomic web server threads

Post by Caronte3D »

You creature becomes better and better :D
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

Caronte3D wrote: Thu Mar 28, 2024 10:20 am You creature becomes better and better :D

Thanks, it's definitely a creature but it's alive. :lol:
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

added
Atomic_Server_Chr(v.i) ;return a proper surrogate pair for unicode values outside the BMP (Basic Multilingual Plane)

Tarted up the landing page and error page with google fonts and added favicon
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: atomic web server threads

Post by Caronte3D »

On the first Atomic_Server_Init call you wrote "wwww" instead of "www" :wink:
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: atomic web server threads

Post by Caronte3D »

Trying to use the server through internet (not local):

I changed the IPs to match the IP on my VPS.
I Opened the firewall for the atomic server.

Now I can access from internet (I can get simple pages), but...

I try to load a SpiderBasic example (the one called dialog.html) and it doesn't work, the background image start to load slowly, but abort.

Any idea what I'm doing wrong?

https://prnt.sc/5L5T1CXrYWnC
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

Caronte3D wrote: Fri Mar 29, 2024 10:21 am On the first Atomic_Server_Init call you wrote "wwww" instead of "www" :wink:
I did that as a test so it would go to the internal handler.

As for the other issue I don't know, maybe it's a time out or a buffer size 🤔
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

v 3.0.b2
adjusted buffer size and redid mutex
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: atomic web server threads

Post by Caronte3D »

Works nice with the last update :D
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

v3.0.6b3

changed scope of mutex, increased buffer size, still a bit slow across the big ditch, as in geographically opposite me.
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

v3.0.6b4
fixed thread clean up
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

v 3.0.7b1

Added Tag Preprocessor.

It assumes you have an html page with the the tag <?PB ElementsFillTable/> saved as .pbh and it will call the named runtime procedure to fill in the tag with dynamic html content. This eliminates the need for CGI or server side scripting languages as you have all the power of PureBasic to do what ever you want to fill in the content and it also gives you full access to the request and all it's parameters.

I've been thinking about the easiest option to host multiple sites on the same ports and it's really easy to do, so I think that will be the next task.
All you will need to do is name your www folders as the domain name eg -www.foo.com- and -www.bar.com- and then you can host multiple sites with the same server. (minus the - either end )
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: atomic web server threads

Post by Caronte3D »

Awesome! :shock:
benubi
Enthusiast
Enthusiast
Posts: 215
Joined: Tue Mar 29, 2005 4:01 pm

Re: atomic web server threads

Post by benubi »

Very nice "example" piece of work :)

The multi-threaded webserver project I abandoned grew in 16,000-20,000 lines, had many features but ultimately it grew too complex and I shot myself in the foot. It could even read .htaccess files to some degree and the other user/group configuration files "as if" supporting a few of those important basic function for auth or DirectoryIndex, on-the-fly zlib compression, SSL (but I have no valid certificates or don't understand enough of it), cached files, webforms, CGI (but not fast-cgi by the end) etc. I invented a pseudo script/batch to have a similar functionality to the tag preprocessor (I suppose) but perhaps too complicated and restricted in itself. Essentially it would be html pages with embedded batch/script parts but it went ugly :lol:

So hats off to your elegant solutions - I'll peek deeper into it, especially the tag preprocessor which attracts most of my curiosity for now :D
Post Reply