[ 
https://issues.apache.org/jira/browse/KNOX-3007?focusedWorklogId=905647&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-905647
 ]

ASF GitHub Bot logged work on KNOX-3007:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Feb/24 09:45
            Start Date: 19/Feb/24 09:45
    Worklog Time Spent: 10m 
      Work Description: zeroflag opened a new pull request, #841:
URL: https://github.com/apache/knox/pull/841

   ## What changes were proposed in this pull request?
   
   
   ## How was this patch tested?
   
   ```smalltalk
   Teapot on
       GET: '/' -> [:req |  ZnResponse noContent
        addCookie: ((ZnCookie name: 'test' value:'val') expires: 'Sun, 06 Nov 
1994 08:49:37 GMT'; yourself); 
        addCookie: ((ZnCookie name: 'test2' value:'val') expiresTimeStamp: 
DateAndTime now; yourself);          
        addCookie: ((ZnCookie name: 'test3' value:'val') expires: 'Wed, 
14-Feb-2024 09:23:27 GMT'; yourself);                   
        yourself ];
        start. 
   ```
   
   1.
   
   ```xml
       <property>
           <name>gateway.httpclient.cookieSpec</name>
           <value>default</value>
       </property>
   ```
   
   ```bash
   $ curl -vk -u admin:admin-password 
https://localhost:8443/gateway/sandbox/hive
   ```
   
   ```
   2024-02-19 10:39:43,751 bf18473d-4b63-4551-9e6a-b7ba49a531ab INFO  
knox.gateway (DefaultHttpClientFactory.java:getRequestConfig(243)) - HTTP 
client cookie spec is set to default
   2024-02-19 10:39:47,167 85a5f49f-fb33-4dc0-8856-873d34efd366 DEBUG http.wire 
(Wire.java:wire(73)) - http-outgoing-0 << "Date: Mon, 19 Feb 2024 09:39:47 
GMT[\r][\n]"
   2024-02-19 10:39:47,167 85a5f49f-fb33-4dc0-8856-873d34efd366 DEBUG http.wire 
(Wire.java:wire(73)) - http-outgoing-0 << "Set-Cookie: test=val; expires=Sun, 
06 Nov 1994 08:49:37 GMT[\r][\n]"
   2024-02-19 10:39:47,168 85a5f49f-fb33-4dc0-8856-873d34efd366 DEBUG http.wire 
(Wire.java:wire(73)) - http-outgoing-0 << "Set-Cookie: test2=val; expires=Mon, 
19 Feb 2024 09:39:47 GMT[\r][\n]"
   2024-02-19 10:39:47,168 85a5f49f-fb33-4dc0-8856-873d34efd366 DEBUG http.wire 
(Wire.java:wire(73)) - http-outgoing-0 << "Set-Cookie: test3=val; expires=Wed, 
14-Feb-2024 09:23:27 GMT[\r][\n]"
   2024-02-19 10:39:47,168 85a5f49f-fb33-4dc0-8856-873d34efd366 DEBUG http.wire 
(Wire.java:wire(73)) - http-outgoing-0 << "[\r][\n]"
   2024-02-19 10:39:47,170 85a5f49f-fb33-4dc0-8856-873d34efd366 WARN  
protocol.ResponseProcessCookies 
(ResponseProcessCookies.java:processCookies(130)) - Invalid cookie header: 
"Set-Cookie: test=val; expires=Sun, 06 Nov 1994 08:49:37 GMT". Invalid 
'expires' attribute: Sun, 06 Nov 1994 08:49:37 GMT
   2024-02-19 10:39:47,171 85a5f49f-fb33-4dc0-8856-873d34efd366 WARN  
protocol.ResponseProcessCookies 
(ResponseProcessCookies.java:processCookies(130)) - Invalid cookie header: 
"Set-Cookie: test2=val; expires=Mon, 19 Feb 2024 09:39:47 GMT". Invalid 
'expires' attribute: Mon, 19 Feb 2024 09:39:47 GMT
   2024-02-19 10:39:47,172 85a5f49f-fb33-4dc0-8856-873d34efd366 DEBUG 
protocol.ResponseProcessCookies 
(ResponseProcessCookies.java:processCookies(119)) - Cookie accepted 
[test3="val", version:0, domain:localhost, path:/, expiry:Wed Feb 14 10:23:27 
CET 2024]
   ```
   
   2.
   
   ```xml
       <property>
           <name>gateway.httpclient.cookieSpec</name>
           <value>standard</value>
       </property>
   ```
   
   
   ```bash
   $ curl -vk -u admin:admin-password 
https://localhost:8443/gateway/sandbox/hive
   ```
   
   ```
   2024-02-19 10:38:34,374 1f05a150-b703-441c-a2f2-d1f34b3ffd3d INFO  
knox.gateway (DefaultHttpClientFactory.java:getRequestConfig(243)) - HTTP 
client cookie spec is set to standard
   2024-02-19 10:38:34,515 1f05a150-b703-441c-a2f2-d1f34b3ffd3d DEBUG http.wire 
(Wire.java:wire(73)) - http-outgoing-0 << "Set-Cookie: test=val; 
   expires=Sun, 06 Nov 1994 08:49:37 GMT[\r][\n]"
   2024-02-19 10:38:34,516 1f05a150-b703-441c-a2f2-d1f34b3ffd3d DEBUG http.wire 
(Wire.java:wire(73)) - http-outgoing-0 << "Set-Cookie: test2=val; expires=Mon, 
19 Feb 2024 09:38:34 GMT[\r][\n]"
   2024-02-19 10:38:34,516 1f05a150-b703-441c-a2f2-d1f34b3ffd3d DEBUG http.wire 
(Wire.java:wire(73)) - http-outgoing-0 << "Set-Cookie: test3=val; expires=Wed, 
14-Feb-2024 09:23:27 GMT[\r][\n]"
   2024-02-19 10:38:34,517 1f05a150-b703-441c-a2f2-d1f34b3ffd3d DEBUG http.wire 
(Wire.java:wire(73)) - http-outgoing-0 << "[\r][\n]"
   2024-02-19 10:38:34,524 1f05a150-b703-441c-a2f2-d1f34b3ffd3d DEBUG 
protocol.ResponseProcessCookies 
(ResponseProcessCookies.java:processCookies(119)) - Cookie accepted 
[test="val", version:0, domain:localhost, path:/, expiry:Sun Nov 06 09:49:37 
CET 1994]
   2024-02-19 10:38:34,524 1f05a150-b703-441c-a2f2-d1f34b3ffd3d DEBUG 
protocol.ResponseProcessCookies 
(ResponseProcessCookies.java:processCookies(119)) - Cookie accepted 
[test2="val", version:0, domain:localhost, path:/, expiry:Mon Feb 19 10:38:34 
CET 2024]
   2024-02-19 10:38:34,524 1f05a150-b703-441c-a2f2-d1f34b3ffd3d DEBUG 
protocol.ResponseProcessCookies 
(ResponseProcessCookies.java:processCookies(119)) - Cookie accepted 
[test3="val", version:0, domain:localhost, path:/, expiry:Wed Feb 14 10:23:27 
CET 2024]
   ```




Issue Time Tracking
-------------------

            Worklog Id:     (was: 905647)
    Remaining Estimate: 0h
            Time Spent: 10m

> Make http client cookie spec parameter configurable
> ---------------------------------------------------
>
>                 Key: KNOX-3007
>                 URL: https://issues.apache.org/jira/browse/KNOX-3007
>             Project: Apache Knox
>          Issue Type: Improvement
>            Reporter: Attila Magyar
>            Assignee: Attila Magyar
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The apache http client rejects cookies if the expiration date doesn't have 
> the expected format (EEE, dd-MMM-yy HH:mm:ss z).
> {code}
> 2023-11-20 17:58:51,189 XXX WARN  protocol.ResponseProcessCookies 
> (ResponseProcessCookies.java:processCookies(130)) - Invalid cookie header: 
> "Set-Cookie: sessionid=XXX; expires=Mon, 20 Nov 2023 23:03:51 GMT; HttpOnly; 
> Max-Age=300; Path=/; SameSite=Lax; Secure". Invalid 'expires' attribute: Mon, 
> 20 Nov 2023 23:03:51 GMT
> {code}
> This can be reconfigured by setting different cookiespec types:
> https://hc.apache.org/httpcomponents-client-4.5.x/current/httpclient/apidocs/org/apache/http/client/config/CookieSpecs.html



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to