This project is archived and is in readonly mode.
Protocol-relative URLs
Reported by Stephen Celis | October 9th, 2010 @ 03:33 PM | in 3.1
ActionPack doesn't support the generation of protocol-relative URLs right now, e.g. "//google.com", which the browser will follow with "http" or "https", accordingly.
I've found protocol-relative URLs to be especially helpful when providing embed code for users, simplifying the logic to load JS off the right protocol.
This patch adds support and tests the following methods of attaining protocol-relative URLs:
embed_code_path(@widget, :protocol => false)
embed_code_path(@widget, :protocol => '//')
The patch also fixes the case where a protocol may be declared with ":" as the separator (e.g., "http:", as JavaScript provides).
Comments and changes to this ticket
-
Stephen Celis October 9th, 2010 @ 07:46 PM
- no changes were found...
-
Stephen Celis October 9th, 2010 @ 07:47 PM
A WebKit nightly was giving me technical difficulties on Lighthouse. Attached :)
-
Andrea Campi October 9th, 2010 @ 09:15 PM
The patch looks good to me functionality-wise, but I have to say I'm not a big fan of:
unless options[:protocol] == false
If I were to keep changes minimal, I'd write it as:
if protocol = options[:protocol].nil? ? 'http' : options[:protocol] rewritten_url << protocol
My preference would actually be to move the default protocol to
default_url_options
in #initialize, which would simplify things--but that may be too invasive a change. -
Santiago Pastorino February 2nd, 2011 @ 04:30 PM
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 04:31 PM
- State changed from open to stale
-
Stephen Celis February 2nd, 2011 @ 04:55 PM
- State changed from stale to open
- Assigned user set to Santiago Pastorino
[state:open]
This isn't a bug, it's a feature and I think it's still valid.
-
Santiago Pastorino February 2nd, 2011 @ 08:12 PM
- Milestone set to 3.1
- Importance changed from to Low
Great, can you rebase the patch against master I'm going to apply it.
-
Repository February 2nd, 2011 @ 09:10 PM
- State changed from open to committed
(from [a0757e00f3ec2925ee6fdd25498725acf66fae98]) Protocol-relative URL support.
[#5774 state:committed]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/a0757e00f3ec2925ee6fdd2549872...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 5774 Protocol-relative URLs [#5774 state:committed]