timschumi / gmod-chttp Goto Github PK
View Code? Open in Web Editor NEWA HTTP()-compatible wrapper for curl in Garry's Mod.
License: MIT License
A HTTP()-compatible wrapper for curl in Garry's Mod.
License: MIT License
You should either be wrapping it in a lock or moving to a queue that is thread safe. C++ does not guarantee thread safety for this class, and even if it looks like there are no ways for something to happen, something will.
See these stackoverflow ansers:
https://stackoverflow.com/questions/34307546/stl-container-for-a-single-produceer-single-consumer-fifo
https://stackoverflow.com/questions/36762248/why-is-stdqueue-not-thread-safe/36763257
Hey, I want to open an issue since I have an issue with cHTTP and the addon Billy's Logs which is a paid addon of gmodstore.com that works with cHTTP for making Discord webhooks work with the logs.
And the issue is that I can't share any private code without the author permission.
The issue happens when cHTTP is present, when is not, the addon starts just fine, but when it is present it throws a lot of lua errors. I told the developer about this issue and he said that it was issue with cHTTP that it's broken.
If you need more info I would be very happy to provide it, but I can't share private code
Hello,
in one of my addons I automatically use CHTTP if it is installed and otherwise I use the normal gmod HTTP implementation. Turns out, people have been complaining about a post request not working when CHTTP is installed. Uninstalling it fixes it. The only odd thing I notice about the request is, it uses both - _GET and _POST
ex:
function http.CPost( url, params, onsuccess, onfailure, header )
local request = {
url = url,
method = "post",
parameters = params,
headers = header or {},
success = function( code, body, headers )
if ( !onsuccess ) then return end
onsuccess( body, body:len(), headers, code )
end,
failed = function( err )
if ( !onfailure ) then return end
onfailure( err )
end
}
OurHTTP( request )
end
local data = {}
for k, v in pairs(player.GetHumans()) do
table.insert(data, {v:Name(), v:SteamID64(), v:TimeConnected()})
end
local curip = game.GetIPAddress()
local iptbl = string.Explode(":", curip)
local post = {
key = serverkey,
address = curip,
ip = iptbl[1],
port = iptbl[2],
hostname = GetHostName(),
gamemode = engine.ActiveGamemode(),
map = game.GetMap(),
players = util.TableToJSON(data),
max_players = tostring(game.MaxPlayers())
}
local url = website .. "/index.php?/api/servers/update"
http.CPost(url, post, function( result )
print('\n---LeyScreenCap.SendServerInfo---')
print('url: '..url)
print(result)
print('---END---\n')
end, function( err )
print('\n---LeyScreenCap.SendServerInfo (error)---')
print('url: '..url)
print(err)
print('---END---\n')
end)
If using a libcurl build with OpenSSL on Windows, we have to provide quite a few additional libraries and a CA bundle.
When using Windows' schannel, we will be able to use the built-in SSL extensions and rely on the internal CA store, providing better integration.
ISteamHTTP joins headers using ,
if multiple headers with the same name are sent. However, this prevents us from easily splitting the header again if the header value already contains ,
. Look into providing a non-joined list of headers without breaking compatibility.
Greetings,
Recently I have the problem that for some reason the latest version of gmod-chttp ceases to function on my server.
So I went ahead and took the version before the latest one (1.3.2) and everything went fine.
Using the 1.4.0-rc1 causes the gmsv_chttp_linux.dll to not work.
I contacted the server host support in a hope that they know what the issue would be. They told me to ask you what dependencies or libraries 1.4.0-rc1 needs to properly function.
Cheers,
Andre19926
Can/Should this be used to consume Server-Sent Events?
This is pretty strange ? Would anyone know how I could fix this ?
Hello there!
When I'm installing Linux 64 version.DLL - bLogs require just Linux version of DLL
When I'm installing Linux version.DLL - it's giving me an error. Attaching screenshot below
When i'm installing Linux-Static.DLL ( obviously with -static delete ), no errors given, but the logs doesn't come to Discord via webhook use.
OC host:
centos-release-7-9.2009.1.el7.centos.x86_64
Linux vps32594 2.6.32-042stab145.3 #1 SMP Thu Jun 11 14:05:04 MSK 2020 x86_64 x86_64 x86_64 GNU/Linux
This would be helpful to deal with ddos protection making HTTP requests not work on the game IP
Hey, so I cant get it to work on my machine thats running Ubuntu 16.04. Regardless of which dll I use(normal 32bit and 32bit debian) it tells me: "Can't load module library". Can anyone help me out here?
I can't add the parameter table, I used the same http.Post only put CHTTP and nothing worked
I got that in my console after adding gmsv_chttp to link my discord to bLogs.
[GmodAdminSuite] [WARN] [bLogs] Could not load gmsv_chttp!
[GmodAdminSuite] [WARN] [bLogs] There are some missing libraries from your server's operating system.
[GmodAdminSuite] [WARN] [bLogs] This is not the fault of bLogs!!
I'm using Linux x64 on a VPS Ubuntu 10
Since upgrading the module to version 1.4.3 and then 1.4.5, I've been experiencing numerous crashes when using the HTTP functions to communicate with webhooks on my Discord server (especially to signal the launch and shutdown of the server).
When using version 1.4.3, it was impossible for me to communicate with my webhook and caused a game crash when I disconnected from a P2P session or a private server (related to ShutDown hook ?). However in 1.4.5, the situation has improved because my webhook seems to work correctly at server startup but when I shutdown the server or my game in singleplayer, I simply crash.
For information, my game and my local server use Windows and Garry's Mod in 32-bit version (public branch). Here is one of the many crash dumps I can have : crash.zip
If the crashdump is not enough for you I can gladly give you some code to reproduce this issue.
Make sure that the timer is either readded in such a case, or that errors don't get propagated outside of the callback at all.
Im working on something but using this module when I start it segmentation faults.
Gives this error only on a URL with the https protocol
While this should still be compatible with the Garry's Mod-internal HTTP method, we can probably make it a bit easier for developers to ensure that they have case-sensitivity-correct behavior (which is "don't assume any case-sensitivity", at least until upstream changes their behavior).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.