HTTP:X
11 Attachment(s)
HTTP:X
This plugin is an API to download files and web content to the server and/or send commands using the HTTP protocol through other plugins. It is not used to send files to clients. That is impossible. This plugin will always keep itself up to date by automatically downloading the latest version whenever a new one is available. This means that you as a developer can be relatively sure that the client has the correct version if your plugin requires possibly new functions. This can be disabled by cvar. You can also use this plugin to update your own plugin automatically. I suggest adding a version check first. Examples can be found below. Remember that floats in PAWN are not 100% accurate so integers or strings should be used for checking if there is a new version available. Also remember that for your plugin to be updated (downloaded) it has to compile without custom includes on this site. So any external functions has to be included inside the source of your plugin. This can also be disabled by cvar.
Examples
httpx.inc
Changelog
Additional notes: I'm always open to suggestions, feedback and criticism. Please share your thoughts. |
Re: HTTP:X
How i spoke
You're not human You're a E.T You're awesome |
Re: HTTP:X
Thanks. Its very useful for working with json api.
|
Re: HTTP:X
Didn't really look through your code thoroughly, but I noticed something. Why do you use callfunc_* natives in your auto-updater? Fake natives were made to avoid that, I believe, and it would make it simpler and easier to remember.
Also, here's something interesting you might want to take a look at: https://github.com/rsKliPPy/webserver_amxx. You could look at it as a server for the client you just wrote here, so it would allow cross-server communication with HTTP, almost like JS/AJAX. I was just too lazy past couple of months to add some finishing touches and release it. :/ Tell me what do you think about it. Great job overall! |
Re: HTTP:X
I use callfunc_* because it doesn't make a plugin fail if the function doesn't exist.
That way, people can build autoupdate into their plugins but not make HTTP:X a requirement for it to run, just an option. Honestly, I don't understand what the webserver is for. Communication plugins are already out there with less overhead and more flexibility. This was not made to compete with them. |
Re: HTTP:X
There is set_module_filter() if the API user decides he wants it optional when using natives.
Even if you want it to stay that way, you should wrap it into a stock functions in your include file. Along the lines of: PHP Code:
I know this may be going a bit offtopic, but the webserver is basically a module for hosting a HTTP server on top of a HL server. It's a GoldSrc/HL counterpart of Asherkin's HTTP server. It lets one program dynamic web pages with Pawn, just like you would do with PHP for example. Just a fun project and I brought that up as your plugin revolves around HTTP. Cross-server communication was just an example what those two could do if they got their powers combined. |
Re: HTTP:X
If a plugin was using the include there would be no point of autoupdating since it wouldn't pass the compiler. This is done intentionally.
I don't see how set_module_filter() would help in this case. I have never used that function and I'm having a hard time understanding what it actually does. If you can show me what your thoughts were I would appreciate it. Thank you for your feedback. I'm not very experienced in C(#/++). But as far as I can tell your HTTP server looks professional. |
Re: HTTP:X
Quote:
But here's the question then - what if a plugin includes a non-standard include file? Just like your own? That could be solved by copying include file's contents onto the top of the code, but that's not really the solution. Quote:
|
Re: HTTP:X
It depends on the include. Some things are just stupid to move into an include. ColorChat is a great example. One small, simple function that comes in too many different versions.
If people copied the code instead they would compile fine online and it wouldn't be so hard to find the right version of colorchat. It got me thinking and I'm gonna create an add-on that will update plugins instead. I think that will be easier for everyone. But that still won't work with custom includes. This can be solved by using another compiler with the proper includes but I will not use anything else than downloads from AM. Mainly because malicious code is rare and will be removed but also for the sake of the GPL being enforced here. |
Re: HTTP:X
Why don't you make a Multi-threaded solution too instead of entity thinks ? ThreadedSocks
|
Re: HTTP:X
If I would include a module I want the whole thing to be a module instead.
But it's never too late. I will see what I can do with it when I get the time. |
Re: HTTP:X
It would be just a waste of time for you to code Multi threaded sockets again, + Httpx would be a specific module, and ThreadedSocks will get added into Amxmodx eventually, so since this is a new plugin, i recommend you to even support Threaded mode.
|
Re: HTTP:X
What will be added is not interesting. 1.8.3 is not really being released anytime soon. You also have to concider the adaptation. To support all servers I'm aiming for 1.8.2 compatibility. That is still the last "stable" release.
But I've already said I will take a look at it. |
Re: HTTP:X
lmao xDD
|
Re: HTTP:X
Quote:
I use 1B when getting the header and scanning for chunk sizes. Other than that I use 64KB. If you want threaded sockets to be included, you have to change this. |
Re: HTTP:X
socket_recv_t( const iThreadHandle, const CallBackHandler[], const iRecvDataLen ); ? iRecvDataLen ?
How could you achieve "dynamically changing size" with default sockets ? Could you give me an example to understand your problem better and if possible references in your code ? I guess its better to discuss this issue in Module's thread ? |
Re: HTTP:X
i want to download a file for specific player is there is a way to have played index added to complete handler for now i m looping through all players to find the related player file:
PHP Code:
|
Re: HTTP:X
Looping through indexes in this way is really no problem at all. I guarantee you that you will never notice a difference.
However I do like the idea of passing and retrieving custom data and I will add this as a feature unless problems arise. The question becomes "how much". Infinite would be nice but that will require dynamic arrays or tries. A good option could be to enable an integer to be passed where you could supply an array index if you wanted to which would require some more work from the user but will create more freedom without all the back-end. I will take a look at this ASAP. Thank you for your suggestion. |
Re: HTTP:X
If you don't mind making 1.8.3 a requirement, you could use DataPacks, they were made exactly for that.
|
Re: HTTP:X
I do mind. I'm not developing for unofficial releases. Especially if it doesn't update automatically.
|
Re: HTTP:X
I guess you could emulate a datapack with a cellarray then, that should work.
|
Re: HTTP:X
Quote:
|
Re: HTTP:X
JustGo,
PHP Code:
|
Re: HTTP:X
Quote:
|
Re: HTTP:X
Quote:
Edit: It's done. HTTPX_SetCustom(DownloadID, any:val) any:HTTPX_GetCustom(DownloadID) HTTP:X will update automatically, you don't need to download it manually. I also tested the time it took to completely download a different number of files at the same time. Don't run this yourself as I got banned doing it. Allthough I ran it using 1s delay between each run. Code:
Code:
1 download : 261ms (261ms/download)When reaching the end of the maximum number of downloads (10) the que is activated for the 11th entry and the time per download gets a small bump but then settles down and passes the previous results. It will probably continue to get more effective throughout. Theoretically the only bump should be at 10 downloads. After that the que will keep active at all times and shouldn't affect the time in a negative way anymore. Without following the pattern too much, assuming it will stagnate at 50ms/download you're looking at 1.6s for 32 players. Edit: I ran a second test using my own HTTP server (about 2m away on a gigabit LAN) and the result was interesting. For every download added ~10ms was added to the time. And after every tenth an extra 100ms was added. Most likely due to the que work. This is more or less the time of the internal works of the plugin. The other factor being response time and connection speed to the server. Code:
1 download : 209ms(~210) (209 ms/download) +~210 |
Re: HTTP:X
Hi.
I tried to use it but I get this error: L 04/22/2018 - 21:51:14: [AMXX] Plugin "test.amxx" failed to load: Plugin uses an unknown function (name "HTTPX_Download") - check your modules.ini. |
Re: HTTP:X
It seems like you're not running the core plugin.
Double-check that...
|
Re: HTTP:X
Hi!
I have been using this for a long time already, but it seems that your website has gone offline and I get this message in logs: Quote:
|
Re: HTTP:X
Quote:
|
Re: HTTP:X
i also tryed this plugin some days ago and got the same error...guys go with curl :)
|
Re: HTTP:X
You can disable the check, I don't see a reason for updating it in the near future.
|
Re: HTTP:X
"D:\CounterStrike\Server\cs_16_server\cstrike \addons\amxmodx\scripting\httpx.sma(706) : warning 233: symbol "socket_change" is marked as deprecated: Use socket_is_readable() instead"
how to fix this fatal error??? |
Re: HTTP:X
Quote:
>fatal error Pick one. |
Re: HTTP:X
Quote:
1. Not a stable release. If you use this release you should be able to handle these warnings/errors yourself. If you are unable to do so, use the stable release. 2. For the idiotic choice of naming it 1.10. |
Re: HTTP:X
I get a new error that was never present before:
[httpx.amxx] [HTTP:X] Socket error: Couldn't connect to host. (proxycheck.io:80) There was no change in the code neither in the server (same plugins for 1+ year). Any ideas? :D Website is up and working when opening manually, plugin also works on local windows server, but not on linux dedicated. |
Re: HTTP:X
Do you have any iptables/firewall rules that could block the connection?
|
Re: HTTP:X
Not that I am aware of.
Going to ask the host if the did add anything new. I have tried with other website ( https://ip.teoh.io ) but got the same results. |
Re: HTTP:X
the plugin is updating only when i upload it. i did a debug but didn t even read the version of plugin
PHP Code:
|
Re: HTTP:X
Quote:
Quote:
|
Re: HTTP:X
...
|
| All times are GMT -4. The time now is 20:05. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.