Skip to content

Fix supporting space in cookie storage cookie values#4548

Merged
hurl-bot merged 3 commits intomasterfrom
4461-set-cookie-value-with-space-is-erroneoussly-parsed
Nov 14, 2025
Merged

Fix supporting space in cookie storage cookie values#4548
hurl-bot merged 3 commits intomasterfrom
4461-set-cookie-value-with-space-is-erroneoussly-parsed

Conversation

@jcamiel
Copy link
Collaborator

@jcamiel jcamiel commented Nov 11, 2025

No description provided.

@jcamiel jcamiel linked an issue Nov 11, 2025 that may be closed by this pull request
@jcamiel jcamiel force-pushed the 4461-set-cookie-value-with-space-is-erroneoussly-parsed branch 3 times, most recently from d8d8585 to 9713a3a Compare November 14, 2025 10:06
@jcamiel jcamiel force-pushed the 4461-set-cookie-value-with-space-is-erroneoussly-parsed branch from 9713a3a to 31bf0a6 Compare November 14, 2025 10:14
@jcamiel jcamiel marked this pull request as ready for review November 14, 2025 10:49
@jcamiel jcamiel requested a review from Copilot November 14, 2025 10:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes support for spaces in cookie storage cookie values by changing the cookie parsing logic from split_ascii_whitespace() to splitn(7, ...) to properly handle the 7-field Netscape cookie format where the last field (value) can contain spaces. The PR also refactors cookie handling to use a new CookieStore abstraction instead of Vec<Cookie>, and renames functions for clarity.

Key changes:

  • Cookie parsing now uses splitn(7, ...) to preserve spaces in cookie values
  • Introduced CookieStore type to encapsulate cookie storage operations
  • Renamed cookie_storage_set/cookie_storage_clear to get_cmd_cookie_storage_set/get_cmd_cookie_storage_clear

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/hurl/src/http/cookie_store.rs Core parsing fix: changed from split_ascii_whitespace() to splitn(7, ...) to support spaces in cookie values; added CookieStore abstraction and is_expired()/match_domain() methods
packages/hurl/src/http/client.rs Refactored to return CookieStore instead of Vec<Cookie>; moved domain matching logic into Cookie type
packages/hurl/src/http/curl_cmd.rs Updated to use CookieStore parameter; refactored cookies_params to directly use cookie store methods
packages/hurl/src/runner/request.rs Renamed functions with clearer names and improved documentation
packages/hurl/src/runner/entry.rs Updated function calls to use renamed functions and new cookie_store() API
packages/hurl/src/runner/hurl_file.rs Changed to use cookie_store() API
packages/hurl/src/main.rs Updated to call to_netscape_str() before redact()
packages/hurl/src/http/mod.rs Updated exports to use cookie_store module
integration/hurl/tests_ok/cookie/cookie_jar.* Added test coverage for cookie with spaces in value
Comments suppressed due to low confidence (2)

packages/hurl/src/http/cookie_store.rs:174

  • The comment 'cookie expired when libcurl set value to 1?' expresses uncertainty about the expiration logic. Either verify this behavior and remove the question mark, or provide a reference to the libcurl documentation. The comment should clearly document the intended behavior rather than questioning it.
    packages/hurl/src/http/curl_cmd.rs:659
  • The test adds a second cookie ('cookie2') with expires='1' but only asserts that 'cookie1' appears in the output. This test doesn't verify that expired cookies are correctly filtered out. Consider adding an explicit assertion or comment explaining why only cookie1 is expected in the output (presumably because cookie2 is expired).
        assert_eq!(
            cmd.to_string(),
            "curl \
            --header 'User-Agent: iPhone' \
            --header 'Foo: Bar' \
            --cookie 'cookie1=valueA' \
            --output foo.out \
            'http://localhost:8000/hello'"
        );

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jcamiel jcamiel force-pushed the 4461-set-cookie-value-with-space-is-erroneoussly-parsed branch from bb00d3a to 27be092 Compare November 14, 2025 13:10
@jcamiel jcamiel requested a review from Copilot November 14, 2025 15:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jcamiel jcamiel force-pushed the 4461-set-cookie-value-with-space-is-erroneoussly-parsed branch from 27be092 to b898c8a Compare November 14, 2025 15:19
@jcamiel jcamiel requested a review from Copilot November 14, 2025 15:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jcamiel
Copy link
Collaborator Author

jcamiel commented Nov 14, 2025

/accept

@hurl-bot
Copy link
Collaborator

🕗 /accept is running, please wait for completion.

@hurl-bot
Copy link
Collaborator

✅ Pull request merged with fast forward by jcamiel..

# List of commits merged from Orange-OpenSource/hurl/4461-set-cookie-value-with-space-is-erroneoussly-parsed branch into Orange-OpenSource/hurl/master branch:

  • b898c8a Fix parsing cookie attributes.
  • e3dbe03 Support ascii_whitespaces separator in importing cookie.
  • 31bf0a6 Introduce a cookie store to manage cookies of an exchange.

@hurl-bot hurl-bot merged commit b898c8a into master Nov 14, 2025
31 checks passed
@hurl-bot hurl-bot deleted the 4461-set-cookie-value-with-space-is-erroneoussly-parsed branch November 14, 2025 16:26
@jcamiel jcamiel changed the title Fix supporting space in cookie storage cookie values. Fix supporting space in cookie storage cookie values Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set-Cookie value with space is erroneoussly parsed

3 participants