1
0
Fork 0
Commit Graph

35 Commits

Author SHA1 Message Date
Tiger Wang 0c69b648ae HTTPServerConnection: more robust error handling
* Fix passing a nullptr to downstream code when the request was malformed
+ Reset the connection on errors
* Fixes #5029
2020-11-14 12:24:42 +00:00
Tiger Wang 9e8598fb1c
Upgrade to C++17 [CMake] (#4717)
* Make our CMake slightly less insane
2020-05-16 20:59:10 +01:00
peterbell10 13144a08e4
Enable some more clang-tidy linter checks (#4738)
* Avoid inefficient AString -> c_str() -> AString round trip

* Avoid redundant string init expressions

* Avoid unnecessary return, continue, etc.

* Add .clang-format to help with clang-tidy fix-its

* Avoid unnecessary passing by value

* Avoid unnecessary local copying

* Avoid copying in range-for loops

* Avoid over-complicated boolean expressions

* Some violations missed by my local clang-tidy

* Allow unnecessary continue statements

* Add brackets

* Another expression missed locally

* Move BindingsProcessor call into clang-tidy.sh and add space

* Fix pushd not found error

* Different grouping of CheckBlockInteractionRate
2020-05-14 22:15:35 +00:00
Mattes D 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
peterbell10 ee84197014
Force all headers other than "Globals.h" to be included with relative paths (#4269)
Closes #4236

CMake now creates a header file in the build directory under the path "include/Globals.h" which just includes "src/Globals.h" with an absolute path. Then instead of adding "src/" to the include directories, it adds "include/".

#include "Globals.h" still works by including the build generated file and any other src-relative path will not work.
2018-08-29 01:51:25 +01:00
peterbell10 950aeffff8
CheckBasicStyle: Check number of empty lines between functions (#4267)
Add check for number of empty lines between functions and fix the corresponding failures
2018-07-26 22:24:36 +01:00
peterbell10 a4dbb5c582
Prefer static_cast to reinterpret_cast (#4223)
* Change reinterpret_cast -> static_cast wherever possible
* Remove more unnecessary `const_cast`s.

reinterpret_casts should be avoided for the same reason as c-style casts - they don't do any type-checking. reinterpret_cast was mainly being used for down-casting in inheritance hierarchies but static_cast works just as well while also making sure that there is actually an inheritance relationship there.
2018-05-02 08:50:36 +01:00
peterbell10 1ea36298d2
Fix cUrlClient leak (#4125)
Fixes #4040
* The TCP connection is now shutdown after OnBodyFinished
* Any open connections are closed when cNetworkSingleton::Terminate() is called.
* Removed ownership cycles in cUrlClientRequest
* Added a check to the test to ensure there are no leaks.
2018-02-20 17:08:46 +00:00
peterbell10 d3c1c626f5
Deal with covered switches consistently (#4161)
* Fixes a number of "<function>: not all control paths return a value" warnings on MSVC.

* Introduces the UNREACHABLE global macro and uses it instead of conditionally compiled switch defaults.

* Move cNBTParseErrorCategory from FastNBT.h into FastNBT.cpp to prevent bad calls to message()
2018-02-04 23:07:12 +00:00
peterbell10 757231cc6e
Add the fmt library (#4065)
* Replaces AppendVPrintf with fmt::sprintf
* fmt::ArgList now used as a type safe alternative to varargs.
* Removed SIZE_T_FMT compatibility macros. fmt::sprintf is fully portable and supports %zu.
* Adds FLOG functions to log with fmt's native formatting style.
2018-01-03 17:41:16 +00:00
Lukas Pioch c5f590d460 Removed UTF-8 BOM (#4033) 2017-09-19 10:34:08 +02:00
peterbell10 307e7aaff5 Fix switch warnings (#4013)
* Fix switch warnings
  * Fix a variety of -Wswitch and -Wswitch-enum warnings
  * Remove unneeded -Wno-error flags

* Reorganise some eMonsterType switches
  * Alpha sort eMonsterType cases in WriteMobMetadata
    and in cNBTChunkSerializer::AddMonsterEntity
  * List all mob types in protocol 1.12 and NBTChunkSerializer

* cStructGenTrees::GetNumTrees: remove switch default

* cWSSAnvil::LoadOldMinecartFromNBT: Log unhandled minecart type
2017-09-14 09:48:57 +01:00
peterbell10 84941bcc9f Update mbedtls to 2.5.1 (#3964)
* Renaming changes:
  * macro prefix "POLARSSL" -> "MBEDTLS"
  * functions now prefixed with "mbedtls_"
  * rename PolarSSL++ -> mbedTLS++
  * rename polarssl submodule

* Use mbedtls' AES-CFB8 implementation.

* Add cSslConfig to wrap mbedtls_ssl_config

* Update cTCPLink and cBlockingSslClientSocket to use cSslConfig

* Use cSslConfig in cHTTPServer

* Use cSslConfig for cMojangAPI::SecureRequest

* CI Fixes

* Set -fomit-frame-pointer on the right target
2017-08-30 15:00:06 +01:00
Lukas Pioch 07f25253a2 Removed unneeded includes (#3902) 2017-08-06 20:57:44 +01:00
Lukas Pioch 0397535fa7 Removed unused forward declarations (#3888) 2017-08-03 15:10:29 +02:00
Lukas Pioch 4691bc5a29 Removed double includes (#3885) 2017-08-02 19:57:20 +01:00
peterbell10 a56cfd1f42 Remove smart pointer macros 2017-07-21 14:41:51 +01:00
Lukas Pioch e35ac1bfb9 Clang 5.0 fixes
- Added override keyword
- Removed inherited member variables
2017-05-21 12:19:06 +02:00
Mattes D b3b723b453 Refactored to put URL Encoding / Decoding in a single place. (#3491) 2016-12-25 18:29:21 +01:00
Mattes D d2e8643607 Fixed type-casting-related warnings. 2016-08-24 22:26:53 +02:00
Mattes D c45bd4b968 HTTP: Fixed empty headers parsing. 2016-08-24 08:28:44 +02:00
Mattes D 74918ce805 cUrlClient: Refactored callbacks to use UniquePtr. 2016-08-22 23:44:37 +02:00
Mattes D 641cb063bc cTCPLink supports TLS out of the box. 2016-08-22 23:44:36 +02:00
Mattes D 6c760ee348 UrlClient: Basic HTTP implementation. 2016-08-22 22:16:42 +02:00
Mattes D 07c5f09ecf WebAdmin: Report opened ports. (#3333) 2016-08-21 11:03:26 +02:00
Mattes D d1dee3c909 Fixed RasPi builds of unit tests.
On RasPi with gcc 4.8.2, the asserts wouldn't compile when tests were enabled.
Enforced the assumption that ASSERT code is generated only in Debug builds.
2016-08-04 20:47:53 +02:00
Mattes D 8eaa8613da CMake: Remove needless minimum version specifications. 2016-07-18 22:11:42 +02:00
Mattes D 72467fe0d4 HTTP: Added missing HasAuth flag initialization. 2016-03-11 10:44:35 +01:00
Mattes D 6f174b99bf HTTP: Fixed header parsing. 2016-03-03 16:20:11 +01:00
Mattes D 6ff389f6d4 HTTP: Fixed typos and bad leftovers. 2016-03-01 16:20:00 +01:00
Mattes D 71a1fa81f0 Renamed HTTPResponse to HTTPOutgoingResponse. 2016-03-01 16:19:59 +01:00
Mattes D 52d18b4559 WebAdmin uses the new HTTP parser framework. 2016-03-01 16:19:58 +01:00
Mattes D 12d95ab047 HTTP: Fixed response parser, unified API. 2016-03-01 16:19:58 +01:00
Mattes D 52c5ce6598 Fixed HTTP parsing when in insecure mode.
Parsing would ignore the size of data already buffered, resulting in bad_alloc exception.
Fixes #2898.
2016-03-01 16:19:57 +01:00
Mattes D fea556ca1b Renamed HTTPServer folder to HTTP.
It contains client code as well.
2016-03-01 16:19:56 +01:00