Raised This Month: $100 Target: $400
 25% 

HTTP Server Lib :)


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands        Approver:   Zenith77 (34)
hackziner
Senior Member
Join Date: Sep 2006
Location: France
Old 11-23-2007 , 12:19   HTTP Server Lib :)
Reply With Quote #1

HTTP Server lib ...


This plugin allows to do a small HTTP server that manage ONLY text pages.
the default port of the server is 8081.

Principle: When you try to open a page (for example you try to open http://192.168.0.69:8081/players.html), the plugin accept the connection, call a forward. Each plugin with the forwarded function check if the request is for it, If yes the plugin set the content of the page.

There are two sample:

The first one just display a page when you try to open a file called about.txt

The second one is a page with AJAX, that display and refresh the ingame chat.


thks Alka



Required module: Sockets_hz

Attached Files
File Type: amxx httplib_chat_view.amxx (3.4 KB, 460 views)
File Type: sma Get Plugin or Get Source (httplib_chat_view.sma - 1189 views - 1.7 KB)
File Type: amxx httplib_sample.amxx (1.4 KB, 419 views)
File Type: sma Get Plugin or Get Source (httplib_sample.sma - 1265 views - 417 Bytes)
File Type: dll sockets_hz_amxx.dll (76.0 KB, 501 views)
File Type: inc sockets_hz.inc (2.2 KB, 482 views)
File Type: so sockets_hz_amxx_i386.so (10.6 KB, 304 views)
File Type: sma Get Plugin or Get Source (httplib.sma - 1279 views - 3.8 KB)
File Type: amxx httplib.amxx (6.8 KB, 301 views)
File Type: inc http_sys.inc (368 Bytes, 540 views)
__________________

Last edited by hackziner; 11-24-2007 at 09:08.
hackziner is offline
Send a message via ICQ to hackziner Send a message via AIM to hackziner Send a message via MSN to hackziner Send a message via Yahoo to hackziner Send a message via Skype™ to hackziner
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 11-23-2007 , 12:27   Re: HTTP ..... ... :) (aka another useless plugin)
Reply With Quote #2

nice but, there are 2 things i dont really like^^
1) put in http_sys.inc the http_page forward
2) Dont create & destroy the forward everytime. just do it in plugin_init/end

regards
green
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
hackziner
Senior Member
Join Date: Sep 2006
Location: France
Old 11-23-2007 , 12:44   Re: HTTP ..... ... :) (aka another useless plugin)
Reply With Quote #3

Thank you

Corrected ^^
__________________
hackziner is offline
Send a message via ICQ to hackziner Send a message via AIM to hackziner Send a message via MSN to hackziner Send a message via Yahoo to hackziner Send a message via Skype™ to hackziner
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 11-23-2007 , 13:12   Re: HTTP ..... ... :) (aka another useless plugin)
Reply With Quote #4

and now change
Code:
//public http_page(requestedfile[128])
to
Code:
forward http_page(requestedfile[128])
thats what i meanth b4
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
hackziner
Senior Member
Join Date: Sep 2006
Location: France
Old 11-23-2007 , 13:28   Re: HTTP ..... ... :) (aka another useless plugin)
Reply With Quote #5

^^

corrected ...

Is there a difference if the forward is declared in the include or not ?
__________________
hackziner is offline
Send a message via ICQ to hackziner Send a message via AIM to hackziner Send a message via MSN to hackziner Send a message via Yahoo to hackziner Send a message via Skype™ to hackziner
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 11-23-2007 , 14:01   Re: HTTP ..... ... :) (aka another useless plugin)
Reply With Quote #6

Huh, so woot! , gj

Quote:
Originally Posted by hackziner
another useless plugin
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 11-23-2007 , 14:04   Re: HTTP ..... ... :) (aka another useless plugin)
Reply With Quote #7

yes
forward is syntax highlighted in the ide^^
and you can easier find them if you search for it.
also if an ide searches for a list of all forwards it would parse functions that have the forward keyword and it would ignore the commented ones.
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
hackziner
Senior Member
Join Date: Sep 2006
Location: France
Old 11-27-2007 , 05:46   Re: HTTP Server Lib :)
Reply With Quote #8

unfortunately nano does'nt highlight anything
__________________
hackziner is offline
Send a message via ICQ to hackziner Send a message via AIM to hackziner Send a message via MSN to hackziner Send a message via Yahoo to hackziner Send a message via Skype™ to hackziner
CAMEL
BANNED
Join Date: Dec 2007
Location: ANEAXSLAND
Old 12-04-2007 , 00:38   Re: HTTP Server Lib :)
Reply With Quote #9

Great ! =) I were waiting for these too long, I think that the futures versions are going to be more short in files... Great work..

Ps. Put a how to install =)..
CAMEL is offline
Old 04-24-2008, 20:13
Ser_UFL
This message has been deleted by Ser_UFL.
hackziner
Senior Member
Join Date: Sep 2006
Location: France
Old 04-24-2008 , 20:18   Re: HTTP Server Lib :)
Reply With Quote #10

It's a library ... You're supposed to write the plugin which generate the html page ...I've done two sample, the first with only the sentence about Osaka and the second one which is a page using ajax to display in real time the ingame chat in a page.
__________________
hackziner is offline
Send a message via ICQ to hackziner Send a message via AIM to hackziner Send a message via MSN to hackziner Send a message via Yahoo to hackziner Send a message via Skype™ to hackziner
Old 04-26-2008, 18:02
Ser_UFL
This message has been deleted by Ser_UFL.
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:15.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode