Giter Club home page Giter Club logo

Comments (4)

touhidurrr avatar touhidurrr commented on July 18, 2024 2

Should be fixed with #2, response now:

~$ curl -i https://uncivserver.xyz/files/unknown_file
HTTP/2 404 
date: Wed, 25 May 2022 15:21:40 GMT
content-type: text/plain; charset=utf-8
content-length: 9
etag: W/"9-0gXL1ngzMqISxa6S1zx3F4wtLyg"
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=kvK9wslEXQjRc%2FSH6phQun5OELEPRXLZt%2BxU17v5MPRxguqRXahHFAJ9aZ7RsNT1u5SIeL%2FD0Xn41%2Fj6HSpwU3WKCzZaaXlH3sOvhBjZPLso004s1On4omr2RSPciT7DwCc%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
server: cloudflare
cf-ray: 710f43128ac049ae-SIN
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

Not Found

from uncivserver.xyz.

touhidurrr avatar touhidurrr commented on July 18, 2024

Currently UncivServer.xyz sends the following HTTP error codes:

400 Bad Request This code is not for Unciv. It's meant to be sent to UncivGames Democracy Bot when it attempts to open a new Battle Royal game with a malformed game Id or something like that.
403 Access Denied: Sent when the client tries to access a path which it is not supposed to. For example node_modules.
404 Not Found Sent when a file is not found occasionally
413 Payload Too Large Sent when the client tries to send a game file that is larger than the servers predefined limit. Which is 3MB currently.
Also since UncivServer.xyz uses express, it might send 500 when a serverside error occurs.

There is only one exception to the rules above and that is Dropbox. If a file is not found in UncivServer.xyz's database it queries Dropbox for the file and sends back whatever response body and response code that Dropbox sent back.

There is no error code 409 in the codebase. So, I assume it happens for Dropbox.

from uncivserver.xyz.

touhidurrr avatar touhidurrr commented on July 18, 2024

The codes related to Dropbox:

// Dropbox
try {
let r = await fetch('https://content.dropboxapi.com/2/files/download', {
headers: {
'Dropbox-API-Arg': `{"path": "/MultiplayerGames/${fileName}"}`,
Authorization: 'Bearer LTdBbopPUQ0AAAAAAAACxh4_Qd1eVMM7IBK3ULV3BgxzWZDMfhmgFbuUNF_rXQWb',
},
});
let data = await r.text();
let ct = r.headers.get('Content-Type');
// Log Dropbox Response
console.log('Dropbox Status:', r.status);
if (r.status !== 200) {
console.log('Dropbox Data:', ct && ct.includes('json') ? data : JSON.parse(data));
}
if (ct) res.set('Content-Type', ct);
res.status(r.status).end(data);
} catch (err) {
errorLogger(err);
res.sendStatus(404);
}

From serverside logs, most of the time like ~90% i see Dropbox sending response code 200 and Occasionally 429. Personally I have never encountered 409 and would like to know the steps to reproduce it @Azzurite.

from uncivserver.xyz.

touhidurrr avatar touhidurrr commented on July 18, 2024
~$ curl -i https://uncivserver.xyz/files/unknown_file
HTTP/2 409 
date: Wed, 25 May 2022 15:01:45 GMT
content-type: application/json; charset=utf-8
content-length: 94
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=jgbeSzmExbyhKKg22HdulncZt1m7Oi9vGdS6OPgkylCSV9YkbQHa3Dk%2FknpNYzQReQazw9MmG6X1gaMp26dEZ9U4ly96TYELQHMG5dpw0MrVKW9nGAlSRGl6i08snd9q%2FBE%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
server: cloudflare
cf-ray: 710f25e81d2c9fa3-SIN
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

{"error_summary": "path/not_found/", "error": {".tag": "path", "path": {".tag": "not_found"}}}

From serverside logs, most of the time like ~90% i see Dropbox sending response code 200 and Occasionally 429. Personally I have never encountered 409 and would like to know the steps to reproduce it @Azzurite.

Ok I take back my words. It seems like I have messed up some logic when I revised the Dropbox Codes last time. I will make it 404. Thanks for reporting!

from uncivserver.xyz.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.