Closed Lama3L9R closed 10 months ago
经过我的测试,在上传存档时,请求
/fileCallback
时应携带 sessionToken,否则服务端会返回 401Exception in thread "main" java.io.IOException: Server returned HTTP response code: 401 for URL: https://rak3ffdi.cloud.tds1.tapapis.cn/1.1/fileCallback at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1997) at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589) at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224) at given.phigros.HttpConnection.json(HttpConnection.java:88) at given.phigros.SaveManager.uploadZip(SaveManager.java:389) at given.phigros.PhigrosUser.modify(PhigrosUser.java:92) at PhigrosServer.main(PhigrosServer.java:18)
经过更多测试,不光
/fileCallback
,其余的几个发送到https://rak3ffdi.cloud.tds1.tapapis.cn/1.1
的请求也必须携带 sessionToken,否则将会返回401以下是可以正常请求的代码
response = new HttpConnection(fileCallback) .header("Content-Type","application/json") .pigeon(user.session) .post(String.format("{\"result\":true,\"token\":\"%s\"}",tokenKey)) .json(); Logger.getGlobal().fine(response.toString()); response = new HttpConnection(String.format(baseUrl + "/classes/_GameSave/%s?",saveModel.objectId)) .header("Content-Type","application/json") .pigeon(user.session) .put(String.format("{\"summary\":\"%s\",\"modifiedAt\":{\"__type\":\"Date\",\"iso\":\"%s\"},\"gameFile\":{\"__type\":\"Pointer\",\"className\":\"_File\",\"objectId\":\"%s\"},\"ACL\":{\"%s\":{\"read\":true,\"write\":true}},\"user\":{\"__type\":\"Pointer\",\"className\":\"_User\",\"objectId\":\"%s\"}}",saveModel.summary, Instant.ofEpochMilli(System.currentTimeMillis()), newGameObjectId,saveModel.userObjectId,saveModel.userObjectId)) .json(); Logger.getGlobal().fine(response.toString()); response = new HttpConnection(String.format(baseUrl + "/files/%s",saveModel.gameObjectId)) .pigeon(user.session) .delete() .json(); Logger.getGlobal().fine(response.toString());
大概9月10日时提交的这段,9月10日之前的是正常的,当时在适配java 8,这个bug在安卓那里改了,这边忘记复制过来了。
安卓的复制过来后,虽然修复了这个问题,但是引入了更多的bug。
已修复。
经过我的测试,在上传存档时,请求
/fileCallback
时应携带 sessionToken,否则服务端会返回 401经过更多测试,不光
/fileCallback
,其余的几个发送到https://rak3ffdi.cloud.tds1.tapapis.cn/1.1
的请求也必须携带 sessionToken,否则将会返回401以下是可以正常请求的代码