add conditional header split#189
add conditional header split#189dselivanov merged 12 commits intorexyai:devfrom DavZim:headers-split
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #189 +/- ##
==========================================
+ Coverage 94.86% 94.97% +0.10%
==========================================
Files 28 28
Lines 1364 1392 +28
==========================================
+ Hits 1294 1322 +28
Misses 70 70
Continue to review full report at Codecov.
|
|
Code is ok. Need tests. |
|
Agree on the tests, do you know how we can test this? |
|
Please look at here: https://github.com/rexyai/RestRserve/blob/master/inst/tinytest/test-parse-headers.R |
|
I think it worth to make list of splittable headers public/ not hardcoded. So it is possible to modify it before backend starts. |
|
With the latest commits, the user can specify the headers to split, the entry point for that is the A quick example would look like this: Now we can test it from curl with |
|
Any updates on this? Are there any further tasks that need to be done before we can merge this? |
* fix IMS header for wrongfully cut date * allow multiple INM values * add If-Match Header * add If-Unmodified-Since Header * add to documentation Co-authored-by: David Zimmermann-Kollenda <david.zimmermann-kollenda@genre.com>
* fix ETag encoding problem, cached are text/plain mime * fix documentation Co-authored-by: David Zimmermann-Kollenda <david.zimmermann-kollenda@genre.com>
|
@DavZim I've pushed some updates which move split header to standard R options. Also I'm thinking where to put documentation for such things. Suggestions? |
|
Do you mean long form of documentation such as a vignette or shorter: a "chapter" in the readme? The functionality itself is documented in Backend, right? |
|
Short paragraph. New "split headers" option in theory should hold same logic for all backends (if for example we add |
This PR adds a first (discussion) version to #187.
It implements an unordered set in cpp which keeps track of all headers which can be split (I didnt find a comprehensive list nor extensive documentation for each header which lists if it can have multiple elements, instead I looked through multiple examples (see comment in code) and took the ones which have examples with multiple elements).
As mentioned in the issue, I found no easy way to test this properly, as
app$process_request()does not callparse_headers(). Instead I used the manual approach:and then using CURL I test the following:
which results in the following output in the logs of the Rsession:
As we can see, the
Acceptheader is split, but theIf-Modified-Sinceheader is not split.Let me know what you think about this!