You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/03/21 21:32:48 UTC

[GitHub] [nifi] marcus41495 opened a new pull request #5887: NIFI-8124 Added cookie redirect handling to InvokeHTTP

marcus41495 opened a new pull request #5887:
URL: https://github.com/apache/nifi/pull/5887


   #### Description of PR
   
   NIFI-8124 Adds support for persistent cookies within the InvokeHTTP processor. Previously, cookies weren't being carried over during redirects. This addition adds a new property "Enable Cookie Redirects", which will create a persistent cookie jar file that will properly handle cookies during HTTP redirects. By default, this is set to false, which will produce the current behavior of the processor.
   
   See https://issues.apache.org/jira/browse/NIFI-8124
   
   ### For all changes:
   - [x] Is there a JIRA ticket associated with this PR? Is it referenced 
        in the commit message?
   
   - [x] Does your PR title start with **NIFI-XXXX** where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [x] Has your PR been rebased against the latest commit within the target branch (typically `main`)?
   
   - [x] Is your initial contribution a single, squashed commit? _Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not `squash` or use `--force` when pushing to allow for clean monitoring of changes._
   
   ### For code changes:
   - [x] Have you ensured that the full suite of tests is executed via `mvn -Pcontrib-check clean install` at the root `nifi` folder?
   - [x] Have you written or updated unit tests to verify your changes?
   - [x] Have you verified that the full build is successful on JDK 8?
   - [ ] Have you verified that the full build is successful on JDK 11?
   - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the `LICENSE` file, including the main `LICENSE` file under `nifi-assembly`?
   - [ ] If applicable, have you updated the `NOTICE` file, including the main `NOTICE` file found under `nifi-assembly`?
   - [x] If adding new Properties, have you added `.displayName` in addition to .name (programmatic access) for each of the new properties?
   
   ### For documentation related changes:
   - [x] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory closed pull request #5887: NIFI-8124 Added cookie redirect handling to InvokeHTTP

Posted by GitBox <gi...@apache.org>.
exceptionfactory closed pull request #5887:
URL: https://github.com/apache/nifi/pull/5887


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5887: NIFI-8124 Added cookie redirect handling to InvokeHTTP

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5887:
URL: https://github.com/apache/nifi/pull/5887#discussion_r831602716



##########
File path: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
##########
@@ -516,6 +519,15 @@
             )
             .build();
 
+    public static final PropertyDescriptor PROP_ENABLE_COOKIE_REDIRECTS = new PropertyDescriptor.Builder()
+            .name("enable-cookie-redirects")
+            .description("If true, when an HTTP server responds to a request with a redirect, the provided cookie will be copied to the following request.")
+            .displayName("Enable Cookie Redirects")
+            .required(true)
+            .defaultValue("false")
+            .allowableValues("true", "false")

Review comment:
       The configured cookie policy applies to all types of responses, not just redirects. For that reason, adjusting the property name would be helpful. Rather than having a `Boolean` value, it would be helpful to define this property as a strategy, defaulting to `Accept None`.  This would provide the opportunity for additional strategies down the road. A new `CookieStrategy` enum could be defined with values of `DISABLED` and `ACCEPT_ALL`.
   
   ```suggestion
       public static final PropertyDescriptor PROP_COOKIE_STRATEGY = new PropertyDescriptor.Builder()
               .name("cookie-strategy")
               .description("Strategy for accepting and persisting HTTP cookies. Accepting cookies enables persistence across multiple requests.")
               .displayName("Cookie Strategy")
               .required(true)
               .defaultValue(CookieStrategy.DISABLED)
               .allowableValues(CookieStrategy.values())
   ```
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on pull request #5887: NIFI-8124 Added cookie redirect handling to InvokeHTTP

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on pull request #5887:
URL: https://github.com/apache/nifi/pull/5887#issuecomment-1075159284


   Thanks for adjusting the property naming and approach @marcus41495, I will take a closer look at the changes soon.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] marcus41495 commented on a change in pull request #5887: NIFI-8124 Added cookie redirect handling to InvokeHTTP

Posted by GitBox <gi...@apache.org>.
marcus41495 commented on a change in pull request #5887:
URL: https://github.com/apache/nifi/pull/5887#discussion_r831779683



##########
File path: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
##########
@@ -516,6 +519,15 @@
             )
             .build();
 
+    public static final PropertyDescriptor PROP_ENABLE_COOKIE_REDIRECTS = new PropertyDescriptor.Builder()
+            .name("enable-cookie-redirects")
+            .description("If true, when an HTTP server responds to a request with a redirect, the provided cookie will be copied to the following request.")
+            .displayName("Enable Cookie Redirects")
+            .required(true)
+            .defaultValue("false")
+            .allowableValues("true", "false")

Review comment:
       You make good points, thanks for your input @exceptionfactory! I went ahead and implemented the changes you suggested. Let me know if they look alright.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org