Commit Graph

57 Commits

Author SHA1 Message Date
sfan5 bc4ab8b99e General code refactoring/improvements in server, treegen and connection 2024-03-20 16:37:32 +01:00
sfan5 0d817ff4ff Try to fix httpfetch method bug
see #14394
2024-03-20 16:37:32 +01:00
grorp f07e1026ac
Allow sync HTTP fetches to be interrupted to fix hanging (#14412)
Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
2024-03-12 20:09:43 +01:00
sfan5 e73e562a63 Allow curl to use all content encodings 2024-03-01 18:22:59 +01:00
sfan5 5756d6262e Minor improvements and fixes in httpfetch.cpp 2024-01-17 20:06:11 +01:00
sfan5 56943bef48 Use modern libcurl poll/wait methods 2024-01-17 20:06:11 +01:00
sfan5 e02bf9fb1a Log timeout when a httpfetch times out 2023-10-05 17:29:49 +02:00
sfan5 9ec40ce8e9 Enforce minimum for curl(_file_download)_timeout 2023-10-05 17:29:49 +02:00
Desour dade95e142 Fix curl deprecation warnings, and set minimum curl version to 7.56.0 2023-06-15 13:55:20 +02:00
Desour 08ea467bfe Use unique_ptr for g_httpfetch_thread 2023-06-05 20:43:33 +02:00
Desour cfb1b879e0 Use unique_ptrs for CurlFetchThread::m_all_ongoing 2023-06-05 20:43:33 +02:00
ShadowNinja 29d2b2ccd0
Print announce error response (#11878)
Fix HTTPFetch caller and request ID to 64 bits
Check that allocated caller ID is not DISCARD
Print body if serverlist request returns error
Don't print control characters from HTTP responses
Document special HTTPFetch caller IDs
Allow unicode to be printed
2022-01-01 22:44:56 +01:00
sfan5 c60a146e22
Rework Settings to support arbitrary hierarchies (#11352) 2021-06-23 15:22:31 +02:00
sfan5 34888a914e
Sort out cURL timeouts and increase default 2021-04-02 00:19:39 +02:00
Lejo 715a123a33
Add PUT and DELETE request + specific method value to HTTP API (#9909) 2020-07-29 23:16:21 +02:00
sfan5 426bdba7fb httpfetch: Disable IPv6 here too if requested by settings (#8399) 2019-03-18 15:06:27 +01:00
rubenwardy 87ad4d8e7f
Add online content repository
Replaces mods and texture pack tabs with a single content tab
2018-04-19 20:14:53 +01:00
sfan5 21f3237fe9 httpfetch: Enable gzip support 2017-11-04 22:19:27 +01:00
Loïc Blot bd6b90359c Remove DSTACK support (#6346)
Debugstacks is not useful, we don't really use it, the DebugStack is not pertinent, gdb and lldb are better if we really want to debug.
2017-08-30 08:09:41 +02:00
Loïc Blot c7160cb629 Network cleanup (#6302)
* Cleanup network headers

* Move peerhandler to a specific header to reduce compilation times
* Move socket.cpp/h to network folder

* More work

* Network code cleanups

* Move socket.{cpp,h} to network folder
* Move Address object to network/address.{cpp,h}
* Move network exceptions to network/networkexceptions.h
* Client: use unique_ptr for Connection
* Server/ClientIface: use shared_ptr for Connection

* Format fixes

* Remove socket.cpp socket.h from clang-format whitelist

* Also fix NetworkPacket code style & make it under clang-format
2017-08-24 08:28:54 +02:00
Loïc Blot ae9b5e0098 Modernize code: very last fixes (#6290)
Last modernization fixes
2017-08-20 19:37:29 +02:00
Loïc Blot 8f7785771b Cpp11 initializers 2 (#5999)
* C++11 patchset 10: continue cleanup on constructors

* Drop obsolete bool MainMenuData::enable_public (setting is called with cURL in server loop)

* More classes cleanup

* More classes cleanup + change NULL tests to boolean tests
2017-06-17 19:11:28 +02:00
Loïc Blot d4c0f91275 Use C++11 mutexes only (remove compat code) (#5922)
* Fix event LINT & remove default constructor/destructors
* remove compat code & modernize autolock header
2017-06-06 16:29:28 +02:00
Loïc Blot f98bbe193e Fix various copy instead of const ref reported by cppcheck (part 3) (#5616)
* Also remove 2 non declared but defined functions
* Make some functions around const ref changes const
2017-04-20 00:12:52 +02:00
Loïc Blot f3fe62a0bf Fix various copy instead of const ref reported by cppcheck (#5615)
* Also remove InventoryList::peekItem unused function
* Fix some post increment to preincrement reported by cppcheck
2017-04-19 23:02:07 +02:00
Jeija 31e0667a4a Add Lua interface to HTTPFetchRequest
This allows mods to perform both asynchronous and synchronous HTTP
requests. Mods are only granted access to HTTP APIs if either mod
security is disabled or if they are whitelisted in any of the
the secure.http_mods and secure.trusted_mods settings.

Adds httpfetch_caller_alloc_secure to generate random, non-predictable
caller IDs so that lua mods cannot spy on each others HTTP queries.
2016-02-22 15:39:41 +01:00
Jeija a3892f5a66 Fix HTTPFetchRequest performing a GET request if post_data is supplied
Instead, perform a POST request with post_data.
2016-02-22 15:39:19 +01:00
ShadowNinja 6f2d785d0f Rename macros with two leading underscores
These names are reserved for the compiler/library implementations.
2015-10-14 02:39:37 -04:00
ShadowNinja 6f4d6cb574 Always use errorstream for DEBUG_EXCEPTION_HANDLER 2015-10-14 02:33:30 -04:00
ShadowNinja e4bff8be94 Clean up threading
* Rename everything.
    * Strip J prefix.
    * Change UpperCamelCase functions to lowerCamelCase.
  * Remove global (!) semaphore count mutex on OSX.
  * Remove semaphore count getter (unused, unsafe, depended on internal
    API functions on Windows, and used a hack on OSX).
  * Add `Atomic<type>`.
  * Make `Thread` handle thread names.
  * Add support for C++11 multi-threading.
  * Combine pthread and win32 sources.
  * Remove `ThreadStarted` (unused, unneeded).
  * Move some includes from the headers to the sources.
  * Move all of `Event` into its header (allows inlining with no new includes).
  * Make `Event` use `Semaphore` (except on Windows).
  * Move some porting functions into `Thread`.
  * Integrate logging with `Thread`.
  * Add threading test.
2015-08-23 22:04:06 -04:00
kwolekr da34a2b33e Replace instances of std::map<std::string, std::string> with StringMap
Also, clean up surrounding code style
Replace by-value parameter passing with const refs when possible
Fix post-increment of iterators
2015-05-19 16:10:49 -04:00
sfan5 4ea5a96fff Revert the upper-case PROJECT_NAME nonsense that was part of #2402 2015-04-27 16:24:49 +02:00
Craig Robbins 9527984dbc Move globals from main.cpp to more sane locations
Move debug streams to log.cpp|h

Move GUI-related globals to clientlauncher

Move g_settings and g_settings_path to settings.cpp|h

Move g_menuclouds to clouds.cpp|h

Move g_profiler to profiler.cpp|h
2015-04-01 23:04:25 +10:00
ShadowNinja 93fcab952b Clean up and tweak build system
* Combine client and server man pages.
  * Update unit test options and available databases in man page.
  * Add `--worldname` to man page.
  * Fix a bunch of places where `"Minetest"` was used directly instead of `PROJECT_NAME`.
  * Disable server build by default on all operating systems.
  * Make `ENABLE_FREETYPE` not fail if FreeType isn't found.
  * Enable LevelDB, Redis, and FreeType detection by default.
  * Remove the `VERSION_PATCH_ORIG` hack.
  * Add option to search for and use system JSONCPP.
  * Remove broken LuaJIT version detection.
  * Rename `DISABLE_LUAJIT` to `ENABLE_LUAJIT`.
  * Rename `minetest_*` variables in `version.{h,cpp}` to `g_*`.
  * Clean up style of CMake files.
2015-03-27 15:00:48 -04:00
Craig Robbins ced6d20295 For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives 2015-03-07 22:41:47 +10:00
Loic Blot 3d505b2b5f Use std::queue for HTTPFetchRequest and std::vector for log_output instead of std::list 2015-03-05 16:21:10 +01:00
Loic Blot a19ec3328c Remove unused variables to make clang happy 2015-02-12 11:13:27 +01:00
ShadowNinja 8852333eb3 Use configured bind_address for HTTPFetch 2014-09-18 21:54:23 -04:00
ShadowNinja 86a3c8ce56 Reduce indentation of HTTPFetchOngoing
Also clean up some related things.
2014-09-18 21:54:22 -04:00
ShadowNinja b2dfde8c8c Add support for multipart/form-data to HTTPFetch for server announcing 2014-06-30 13:23:09 -04:00
sapier 1cc40c0a7c Add support for Android 2.3+
There have been plenty of ppl involved in creating this version.
I don't wanna mention names as I'm sure I'd forget someone so I
just tell where help has been done:
- The partial android versions done by various ppl
- Testing on different android devices
- reviewing code (especially the in core changes)
- testing controls
- reviewing texts

A big thank you to everyone helping this to be completed!
2014-06-29 18:17:56 +02:00
ShadowNinja 6ab3b4c838 Remove dependency on marshal and many other async changes
This makes a number of changes:
  * Remove the dependency on marshal by using string.dump and loadstring.
  * Use lua_tolstring rather than having Lua functions pass string lengths to C++.
  * Move lua_api/l_async_events.* to cpp_api/s_async.*, where it belongs.
  * Make AsyncWorkerThread a child of ScriptApiBase, this removes some duplicate functionality.
  * Don't wait for async threads to shut down.  (Is this safe?  Might result in corruption if the thread is writing to a file.)
  * Pop more unused items from the stack
  * Code style fixes
  * Other misc changes
2014-04-27 16:15:53 -04:00
sapier edcad09dee Add support for named threads (atm linux only) 2014-04-09 21:32:21 +02:00
Sfan5 cd7e8372f3 Include system info in the HTTP user agent on Windows 2014-01-23 22:27:13 +01:00
ShadowNinja b11b48ec07 Deindent HTTPFetchRequest::HTTPFetchRequest() 2014-01-16 20:14:55 -05:00
ShadowNinja f42f01758c Make default User-agent follow RFC 2616 2014-01-15 12:10:53 -05:00
Sfan5 a5287b6777 Fix building with MinGW 2014-01-15 17:35:00 +01:00
sapier 3bbd280336 Fix check for max_fd == -1 should actually be max_fd != -1 2014-01-10 19:19:16 +01:00
sapier 8b0b857eaa Make MutexQueue use jsemaphore for signaling 2014-01-10 10:10:45 +01:00
proller c62bab010f Send long announce as POST, show OS in useragent
Add lag reporting to masterserver (average dtime)
StyledWriter  -> FastWriter in masterserver announce
2014-01-07 02:50:45 +04:00