10 Commits

Author SHA1 Message Date
Wannes Kerckhove
283c301f08 feat: new helper functions to replace regexes #807
Implemented new StringUtil helper functions: splitCommaSeparated, sanitizeUrlPart, isValidFileName.
Added helper functions to HeaderUtil: matchesAuthorizationScheme, hasScheme.
Added unit tests for the new helper functions.
Refactored codebase to use helper functions instead of regexes if applicable.
2022-04-13 11:26:07 +02:00
Thomas Dupont
48efc6fae1
feat: Create MetadataParser that detects JSON with Context link and throws an error
* feat: add PlainJsonLdFilter to reject JSON with context link

* refactor: abstract parseLinkHeader into HeaderUtils

* docs: typo in comment field

Co-authored-by: Ruben Verborgh <ruben@verborgh.org>

* refactor: Replace BadRequestHttpError with NotImplementedError

Co-authored-by: Ruben Verborgh <ruben@verborgh.org>

* refactor: incorporate requested changes

* refactor: requested changes incorporated

* refactor: remove obsolete code lines

Co-authored-by: Ruben Verborgh <ruben@verborgh.org>
2022-04-01 14:25:09 +02:00
Joachim Van Herwegen
027e3707fd feat: Parse content-type more strictly 2022-03-28 10:45:05 +02:00
Thomas Dupont
a8602055e6
feat: Store content type parameters
* feat: support storage and retrievel of content-type parameters

* test: extra unit tests for parseContentTypeWithParameters

* refactor: simplify set contentType()

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: simplify for loop because of unique blankNodes

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: ContentTypeParameter should be contentTypeParameter

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: remove undefined type in favor of var? syntax

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: use new parseContentType internally

* chore: remove commented code

* docs: code documentation line changed

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: Check for faulty metadata in contentType rdf structure

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: remove all instances of blanknodes

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: use full contentType when parsing header

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: use quads() method instead of store.getQuads()

* refactor: .value needed for type correctness

* feat: ReprMetadata constructor now supports full content-type string

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>
2022-03-14 10:27:34 +01:00
Wout Slabbinck
54ccbed48d fix: Added a content-type parser to HeaderUtil
* fixes #995

* fixed the remarks and added a test for parseContentType

* refactor: remove unnecessary comment

Co-authored-by: woutslabbinck <wout.slabbinck@ugent.com>
2021-10-15 13:13:37 +02:00
Brandon Aaron
de51a231e3
feat: Fallback to X-Forwarded-* headers
* Fallback to X-Forwarded-* headers

This uses the first value from X-Forwarded-Host and
X-Forwarded-Proto if they're present and the standard Forwarded
header is not.

* Update parseForwarded to handle X-Forwarded-*

This updates the signature for parseForwarded to take in the headers
and handle the logic of falling back to X-Forwarded-* headers.

* Update src/util/HeaderUtil.ts

Co-authored-by: Ruben Verborgh <ruben@verborgh.org>

* Inline parseXForwarded helper

Additionally fixes a typo, updates a unit test, and removes a
typing that is no longer necessary.

* Tweak handling of X-Forwarded value checking and assignment

* Fix: terminology & consistency suggestions from review

Co-authored-by: Ruben Verborgh <ruben@verborgh.org>

Co-authored-by: Ruben Verborgh <ruben@verborgh.org>
Co-authored-by: Wouter Termont <woutermont@gmail.com>
2021-03-23 12:44:43 +01:00
Ruben Verborgh
ba5c62059a feat: Validate Accept-DateTime. 2021-01-05 11:03:15 +01:00
Ruben Verborgh
ecfe3cfc46 feat: Support the Forwarded header. 2020-12-02 10:23:38 +01:00
Joachim Van Herwegen
1073c2ff4c refactor: Clean up utility functions 2020-11-18 17:19:53 +01:00
Joachim Van Herwegen
7dcb3eaa84 feat: Create MetadataHandler 2020-10-09 12:12:34 +02:00