GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use string_view in CookieParser::before_handle parsing by Sightem · Pull Request #1024 · CrowCpp/Crow

Conversation

@Sightem

@Sightem Sightem commented Apr 17, 2025

Copy link
Copy Markdown
Contributor

This PR refactors CookieParser::before_handle to use std::string_view for parsing the Cookie request header, avoiding extra std::string allocations during slicing and trimming

Tested against the original code with around 20 inputs, confirming identical output maps and rejection behavior.
Closes #1023

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Sightem

Sightem commented Apr 17, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

I tested the implementation against the old one using these:

std::vector<std::string> test_cookies = {
   // Basic cases
   "key=value",
   "key1=value1; key2=value2",
   " key=value ",
   "key = value ; nextkey = anothervalue ",
   // Quoted values
   "key=\"value\"",
   "key=\"\"",
   " key = \" spaced value \" ",
   "key=\"value with ; inside\"",
   "key=\"value with = inside\"",
   "key=",
   "key=;next=val",
   "key= ; next=val",
   // Edge cases
   "",
   "key",
   "=", 
   "=value",
   " key = ",
   "key=value;"
   ";key=value",
   "key1=value1;;key2=value2",
   "key= value ",
   "key=\" value \"",
   "utf8key=你好世界; other=val",
   "special=!@#$%^&*()_+",
   "SID=abc; something=\"\"; key3=val3"
}; 
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Sightem
Sightem force-pushed the refactor/cookie-parser-string-view branch 2 times, most recently from b7b229e to 7fb3152 Compare April 20, 2025 21:03
@gittiver

gittiver commented Apr 28, 2025

Copy link
Copy Markdown
Member

OSX uses a newer version of asio which has some deprecated functions removed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gittiver

gittiver commented May 8, 2025

Copy link
Copy Markdown
Member

can you rebase the pull request to newest main, there was a problem with deprecated functions in asio, this let all osx builds fail due to a newer version of asio used there.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gittiver gittiver added the need_rebase PR needs rebase on master branch label May 20, 2025
@gittiver

gittiver commented Jul 23, 2025

Copy link
Copy Markdown
Member

Could you rebase on current master?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Sightem
Use string_view in CookieParser::before_handle parsing
588bb65
@Sightem
Sightem force-pushed the refactor/cookie-parser-string-view branch from 7fb3152 to 588bb65 Compare July 23, 2025 21:24
@Sightem

Sightem commented Jul 23, 2025

Copy link
Copy Markdown
Contributor Author

My apologies, github decided to never notify me of these comments

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gittiver

gittiver commented Jul 24, 2025

Copy link
Copy Markdown
Member

no worries, i will also need some time to proceed on it. ;)

Sightem reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Sightem

Sightem commented Oct 13, 2025

Copy link
Copy Markdown
Contributor Author

status on this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gittiver gittiver removed the need_rebase PR needs rebase on master branch label Oct 14, 2025
gittiver
gittiver reviewed Oct 14, 2025
View reviewed changes
Comment thread include/crow/middlewares/cookie_parser.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

gittiver
gittiver approved these changes Oct 14, 2025
View reviewed changes
@gittiver
gittiver merged commit 19041b8 into CrowCpp:master Oct 15, 2025
@BrewTestBot BrewTestBot mentioned this pull request Feb 12, 2026
crow: add livecheck Homebrew/homebrew-core#267086
Merged
@BrewTestBot BrewTestBot mentioned this pull request Feb 19, 2026
crow 1.3.1 Homebrew/homebrew-core#268347
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gittiver gittiver gittiver approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Use std::string_view in CookieParser::before_handle

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Sightem @gittiver
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.