Ticket #2527 (closed feature: fixed)

Opened 3 years ago

Last modified 3 years ago

be liberal when encountering "+" in URI components

Reported by: tschaub Owned by: tschaub
Priority: minor Milestone: 2.9 Release
Component: Util Version: 2.8
Keywords: Cc:
State: Complete

Description

 IETF 2396 says spaces should be encoded as %20. However, in practice, + is often used. Properly encoded, the + should be %2B in a URI component (value in a query string pair). When we encounter a + before decoding, we could safely replace it with a space.

Attachments

2527.patch Download (2.2 KB) - added by tschaub 3 years ago.
replace + with space before decoding

Change History

Changed 3 years ago by tschaub

replace + with space before decoding

Changed 3 years ago by tschaub

  • state set to Review

Tests pass in FF3 and IE6. Thanks for any review.

Changed 3 years ago by bartvde

  • state changed from Review to Commit

Looks good to me Tim, please commit.

Changed 3 years ago by bartvde

  • milestone changed from 2.10 Release to 2.9 Release

Changed 3 years ago by bartvde

  • owner set to tschaub

Changed 3 years ago by bartvde

Tim can you please check the fix for ticket:1704 and see if it does not conflict with your thinking on this. It's the exact same line as your patch. TIA.

Changed 3 years ago by tschaub

I want to take a closer look at #1704. Will try to do that in the next 8 hours or so.

Changed 3 years ago by tschaub

  • status changed from new to closed
  • state changed from Commit to Complete
  • resolution set to fixed

(In [10133]) Being liberal in what we accept in query strings. A properly encoded '+' should be '%2B' in a URI component. A properly encoded ' ' (space) should be '%20'. When we encounter a '+', we can safely replace it with ' ' before properly decoding the remainder of the component. This follows the convention that '+' is used widely to represent a space in a URL. r=bartvde (closes #2527)

Note: See TracTickets for help on using tickets.