Mojira Archive
REALMS-12172

Realms world upload uses HTTP instead of HTTPS

The bug

When uploading a Realms world HTTP instead of HTTPS (i.e. unencrypted) is used:
com.mojang.realmsclient.client.FileUpload.requestUpload(int) (Mojang name)

Code Analysis

   private UploadResult requestUpload(int i) {
      UploadResult.Builder uploadRequestBuilder = new UploadResult.Builder();
      if (this.cancelled.get()) {
         return uploadRequestBuilder.build();
      } else {
         this.uploadStatus.totalBytes = this.file.length();
         HttpPost httpPost = new HttpPost(this.uploadInfo.getUploadEndpoint().resolve("/upload/" + this.realmId + "/" + this.slotId));
         CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().setDefaultRequestConfig(this.requestConfig).build();
         try {
            this.setupRequest(httpPost);
            CloseableHttpResponse closeableHttpResponse = closeableHttpClient.execute(httpPost);
            long var6 = this.getRetryDelaySeconds(closeableHttpResponse);
            if (this.shouldRetry(var6, i)) {
               UploadResult uploadResult = this.retryUploadAfter(var6, i);
               return uploadResult;
            }
            this.handleResponse(closeableHttpResponse, uploadRequestBuilder);
         } catch (Exception exception) {
            if (!this.cancelled.get()) {
               LOGGER.error("Caught exception while uploading: ", exception);
            }
         } finally {
            this.cleanup(httpPost, closeableHttpClient);
         }
         return uploadRequestBuilder.build();
      }

Unresolved

Marcono1234

2019-12-29, 12:35 AM

2024-09-09, 06:46 PM

7

3

Confirmed

Platform

realms

1.21.1 (Java)

-