nickva commented on issue #5064:
URL: https://github.com/apache/couchdb/issues/5064#issuecomment-2123293891

   Playing a bit with mochiweb headers parser, I think we may have to use 
`mochiweb_headers:to_list/1`, then go through each `'Set-Cookie`' parse out the 
cookie and ignore any not coming from CouchDB?
   
   ```erlang
   Heads = mochiweb_headers:from_binary([<<"Content-Length:47\r\n">>, 
<<"Set-Cookie:Custom=ABC; Version=42\r\n">>, <<"Foo:bar\r\n">>, 
<<"sEt-cOokie:Kustom=DEF; Version=43\r\n\rn">>]), ok.
   ok
                                                                                
                                                 
{value,{'Set-Cookie',"Kustom=DEF; Version=43, Custom=ABC; Version=42"}}
   > mochiweb_headers:get_value("set-cookie", Heads).
   "Kustom=DEF; Version=43, Custom=ABC; Version=42"
   
   > mochiweb_headers:get_primary_value("set-cookie", Heads).
   "Kustom=DEF"
   
   > mochiweb_headers:get_combined_value("set-cookie", Heads).
   undefined
   
   > mochiweb_headers:to_list(Heads).
   [{'Content-Length',"47"},
    {"Foo","bar"},
    {'Set-Cookie',"Kustom=DEF; Version=43"},
    {'Set-Cookie',"Custom=ABC; Version=42"}]
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to