671 Commits

Author SHA1 Message Date
Athanasius
4ad1519d1d
Gateway/errors: Improve general outline of documentation section 2022-01-09 16:10:01 +00:00
Athanasius
ccde820ba7
Gateway/errors: 'Schema Validation' properly tagged and documented 2022-01-09 16:02:28 +00:00
Athanasius
e111fb8415
Gateway/errors: Outdate Schema: Tweak message and document 2022-01-09 15:48:27 +00:00
Athanasius
e931bfff96
Gateway/errors: MalformedUploadError isn't raised upon JSON issue 2022-01-09 15:45:56 +00:00
Athanasius
b9b59329d5
Gateway/errors: Document 'Malformed Upload' error 2022-01-09 15:43:51 +00:00
Athanasius
4da60215f0
Gateway/errors: Tag FAIL if a zlib.error 2022-01-09 15:43:12 +00:00
Athanasius
8edae919e2
Gateway/errors: Call out if FAIL is specifically on JSON parsing 2022-01-09 15:38:29 +00:00
Athanasius
35cd3c3294
Merge branch 'enhancement/161/gateway-improve-misc-error-reports' of github.com:EDSM-NET/EDDN into enhancement/161/gateway-improve-misc-error-reports 2022-01-09 15:33:24 +00:00
Athanasius
81a70572c9 Gateway: Properly report 'not compressed, badly form-encoded' to uploaders
* This code worked if the request was *properly* form-encoded, with a
'data' key whose value was a valid message.

* It failed to detect where the request was form-encoded, with without a
'data' key.  It would just assume 'not form-encoded' in that case, then
fail later on JSON parsing.

Thus, re-use the `urlparse.parse_qs()` check for form-encoded format.
This passes:

  1. Properly, `data` key, form-encoded with valid value is fully JSON
  parsed, schema checked and accepted.
  2. *NOT* compressed *or* form-encoded valid message is properly parsed
  and accepted.
  2. Uncompressed, form-encoded, but no `data` key correctly returns the
  same error status and body as the compressed+form-encoded+no data key
  path.
2022-01-09 15:31:39 +00:00
Athanasius
faa2e25d62 Gateway: Properly report 'badly form encoded' to uploaders
This currently only applies if the data was also, validly, compressed.
2022-01-09 15:31:39 +00:00
Athanasius
613ef6deab Gateway: Properly report zlib.decompress() errors to uploaders
This also adds some debug/error logging to the code path.
2022-01-09 15:31:39 +00:00
Athanasius
e58dc3b5d2
Merge pull request #160 from EDCD/enhancement/document-gateway-responses
docs: Possible server responses, and handling them
2022-01-09 15:29:32 +00:00
Athanasius
c6a63c5a93
docs/schemas: Journal timestamps *are* trustworthy as UTC 2022-01-09 15:25:55 +00:00
Athanasius
44b5a1d789
docs/schemas: slight wording tweak about live schemas 2022-01-09 14:57:05 +00:00
Athanasius
36de2145d7
docs: schemas: General improvement pass to aid new developers
* Make lots of 'obvious' things explicit, e.g. HTTP 1.1, not HTTP/2, and
  HTTPS not plain HTTP.
* The live service should always be using the schemas as present in the
  live branch, not master or another branch.
* A 'good' message will receive 'HTTP 200' status *and* a body of `OK`.
2022-01-09 14:52:41 +00:00
Athanasius
10d70bfe77 Gateway: Properly report 'not compressed, badly form-encoded' to uploaders
* This code worked if the request was *properly* form-encoded, with a
'data' key whose value was a valid message.

* It failed to detect where the request was form-encoded, with without a
'data' key.  It would just assume 'not form-encoded' in that case, then
fail later on JSON parsing.

Thus, re-use the `urlparse.parse_qs()` check for form-encoded format.
This passes:

  1. Properly, `data` key, form-encoded with valid value is fully JSON
  parsed, schema checked and accepted.
  2. *NOT* compressed *or* form-encoded valid message is properly parsed
  and accepted.
  2. Uncompressed, form-encoded, but no `data` key correctly returns the
  same error status and body as the compressed+form-encoded+no data key
  path.
2022-01-07 16:45:37 +00:00
Athanasius
872af7f594 Gateway: Properly report 'badly form encoded' to uploaders
This currently only applies if the data was also, validly, compressed.
2022-01-07 16:32:10 +00:00
Athanasius
10b12cf74b Gateway: Properly report zlib.decompress() errors to uploaders
This also adds some debug/error logging to the code path.
2022-01-07 16:04:00 +00:00
Athanasius
207068f156
docs: Cite issue on "some error bodies don't have FAIL: prefix" 2022-01-07 15:37:07 +00:00
Athanasius
d2c4c98c2b
docs: Possible server responses, and handling them 2022-01-07 15:20:05 +00:00
Athanasius
0bf8fc3abb
Merge pull request #159 from EDCD/enhancement/158/request-size-limit
Address `bottle` default request size rejecting some messages
2022-01-07 10:41:21 +00:00
Athanasius
1134a6c9b4 Gateway: Only log first 512 characters of invalid JSON
Don't want to spam the logs with up to 1MiB per bad message.
2022-01-06 17:39:01 +00:00
Athanasius
9f219da6a6 Gateway: Expand on logging for interpretation of errors
This includes logging the *full* (uncompressed) message if it fails to
parse as JSON.
2022-01-06 17:36:39 +00:00
Athanasius
1371f71217 Gateway: Set up proper logger formatting
For some reason the milliseconds portion of the %S timestamp is using a
comma for decimals separator, despite 'locale' saying we're set to (US)
English.  /tableflip
2022-01-06 14:06:59 +00:00
Athanasius
377bdd3833 Gateway: Add logging per Accepted request
Actually some logging was already there, just the logger had never been
set up properly, but then I decided to make the format of this message
more useful.
2022-01-06 13:54:33 +00:00
Athanasius
0e80c76cb5 Gateway: Set bottle request limit to 1MiB 2022-01-06 13:07:53 +00:00
Athanasius
fa118d0183
schemas/codexentry: Clarify that what unset status_body_name means 2021-12-21 09:37:08 +00:00
Athanasius
b78fcf349f
Merge branch 'develop' 2021-11-04 11:26:35 +00:00
Athanasius
ac0a872d30
Merge pull request #151 from EDCD/enhancement/document-all-schemas
Document all of the schemas in their own README
2021-11-04 11:26:04 +00:00
Athanasius
d6a43c04d9
schemas: README: Add 'Receiving messages' section 2021-11-04 11:14:47 +00:00
Athanasius
1b11519ee7
schemas: READMEs: Centralise "detecting CAPI lag" advice 2021-11-04 11:03:51 +00:00
Athanasius
e0c1ac85fd
schemas: fssdiscoveryscan: README: Don't over-state elisions 2021-11-02 11:32:54 +00:00
Athanasius
6704e1a957
schemas: commodity: README: Allow LoadGame horizons flag for CAPI data 2021-11-02 11:30:25 +00:00
Athanasius
5b05e4879f
schemas: commodity: README: Call out statusFlags 2021-11-02 11:24:37 +00:00
Athanasius
6e81afc98c
schemas: blackmarket: README: Count doesn't need to be elided 2021-11-02 11:20:43 +00:00
Athanasius
53acd5ed1e
schemas: blackmarket: README: Correct referenced Journal event 2021-11-02 11:20:09 +00:00
Athanasius
aebf3ac479
schemas: README: Remove final things now mentioned in specific READMEs 2021-11-01 16:02:12 +00:00
Athanasius
57e8b9af4b
schemas: README: shipyard unavailable_list already noted in its README 2021-11-01 15:59:38 +00:00
Athanasius
a32f047b7f
schemas: README: outfitting-specific elisions in that file already 2021-11-01 15:58:35 +00:00
Athanasius
b9231cef12
schemas: READMEs: Move commodity-specific elisions into its file 2021-11-01 15:58:00 +00:00
Athanasius
339abce9e4
schemas: READMES: Consistent horizons/odyssey language 2021-11-01 15:52:56 +00:00
Athanasius
3d023bf280
schemas: shipyard: README: Initial version 2021-11-01 15:46:08 +00:00
Athanasius
e12ebee9f8
schemas: scanbarycentre: README: Initial version 2021-11-01 15:15:03 +00:00
Athanasius
a32d6e2ea3
schemas: outfitting: README: Initial version 2021-11-01 15:11:15 +00:00
Athanasius
6c1d8cff92
schemas: navroute: README: Initial version 2021-11-01 14:58:54 +00:00
Athanasius
67e77136ff
schemas: navbeaconscan: README: Initial version 2021-11-01 14:54:10 +00:00
Athanasius
fd567e69aa
schemas: journal: README: Now complete, in the generic sense
Ideally all the events covered here need splitting into their own
schemas, but for the time being this documentation should suffice.
2021-11-01 14:44:28 +00:00
Athanasius
635d7c2693
schemas: README: Note about key names being originally CAPI based 2021-11-01 14:31:59 +00:00
Athanasius
fc7443b282
schemas: fssdiscoveryscan: README: Initial version 2021-10-29 15:09:30 +01:00
Athanasius
d781160e6e
schemas: commodity: README: _Localised keys correction 2021-10-29 15:05:28 +01:00