3 Commits 27ff1e5fd3 ... c6f03c64a0

Author SHA1 Message Date
  Clément Wolf c6f03c64a0 Set user agent on API requests 1 month ago
  Clément Wolf 838f6367af Fix alloc/dealloc mismatch when submitting score 1 month ago
  Clément Wolf 14f15421e1 Ignore VERSION_UPDATE packet 1 month ago
3 changed files with 9 additions and 7 deletions
  1. 4 4
      src/App/Osu/Bancho.cpp
  2. 1 0
      src/App/Osu/BanchoNetworking.cpp
  3. 4 3
      src/App/Osu/BanchoSubmitter.cpp

+ 4 - 4
src/App/Osu/Bancho.cpp

@@ -317,8 +317,7 @@ void handle_packet(Packet *packet) {
         i32 spectator_id = read<u32>(packet);
         debugLog("Spectator left: user id %d\n", spectator_id);
     } else if(packet->id == VERSION_UPDATE) {
-        disconnect();
-        bancho.osu->getNotificationOverlay()->addNotification("This server may use an unsupported protocol version.");
+        // (nothing to do)
     } else if(packet->id == SPECTATOR_CANT_SPECTATE) {
         i32 spectator_id = read<u32>(packet);
         debugLog("Spectator can't spectate: user id %d\n", spectator_id);
@@ -408,7 +407,8 @@ void handle_packet(Packet *packet) {
     } else if(packet->id == PROTOCOL_VERSION) {
         int protocol_version = read<u32>(packet);
         if(protocol_version != 19) {
-            bancho.osu->getNotificationOverlay()->addNotification("This server may use an unsupported protocol version.");
+            bancho.osu->getNotificationOverlay()->addNotification(
+                "This server may use an unsupported protocol version.");
         }
     } else if(packet->id == MAIN_MENU_ICON) {
         UString icon = read_string(packet);
@@ -495,7 +495,7 @@ void handle_packet(Packet *packet) {
         debugLog("Silenced %s.\n", blocked.toUtf8());
     } else if(packet->id == VERSION_UPDATE_FORCED) {
         disconnect();
-        bancho.osu->getNotificationOverlay()->addNotification("This server may use an unsupported protocol version.");
+        bancho.osu->getNotificationOverlay()->addNotification("This server requires a newer client version.");
     } else if(packet->id == ACCOUNT_RESTRICTED) {
         bancho.osu->getNotificationOverlay()->addNotification("Account restricted.");
         disconnect();

+ 1 - 0
src/App/Osu/BanchoNetworking.cpp

@@ -205,6 +205,7 @@ static void send_api_request(CURL *curl, APIRequest api_out) {
     }
     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_write);
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&response);
+    curl_easy_setopt(curl, CURLOPT_USERAGENT, "osu!");
 #ifdef _WIN32
     // ABSOLUTELY RETARDED, FUCK WINDOWS
     curl_easy_setopt(curl, CURLOPT_CAINFO, "curl-ca-bundle.crt");

+ 4 - 3
src/App/Osu/BanchoSubmitter.cpp

@@ -1,5 +1,6 @@
 #ifdef _WIN32
 #include "cbase.h"
+// ^ needs to be above <windows.h>
 #include <windows.h>
 #else
 #include <sys/random.h>
@@ -105,7 +106,7 @@ void submit_score(FinishedScore score) {
         part = curl_mime_addpart(request.mime);
         curl_mime_name(part, "iv");
         curl_mime_data(part, iv_b64, CURL_ZERO_TERMINATED);
-        delete iv_b64;
+        delete[] iv_b64;
     }
     {
         size_t s_client_hashes_encrypted = 0;
@@ -116,7 +117,7 @@ void submit_score(FinishedScore score) {
         part = curl_mime_addpart(request.mime);
         curl_mime_name(part, "s");
         curl_mime_data(part, client_hashes_b64, CURL_ZERO_TERMINATED);
-        delete client_hashes_b64;
+        delete[] client_hashes_b64;
     }
     {
         UString score_data;
@@ -162,7 +163,7 @@ void submit_score(FinishedScore score) {
         part = curl_mime_addpart(request.mime);
         curl_mime_name(part, "score");
         curl_mime_data(part, score_data_b64, CURL_ZERO_TERMINATED);
-        delete score_data_b64;
+        delete[] score_data_b64;
     }
     {
         size_t s_compressed_data = 0;