aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #14986 from dlangevin/trailing-slash-url-generationRafael Mendonça França2014-05-241-7/+13
|\ | | | | | | | | | | | | Fixes URL generation with trailing_slash: true Conflicts: actionpack/lib/action_dispatch/http/url.rb
| * Fixes URL generation with trailing_slash: trueDan Langevin2014-05-221-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | URL generation with trailing_slash: true was adding a trailing slash after .:format Routes.draw do resources :bars end bars_url(trailing_slash: true, format: 'json') # => /bars.json/ This commit removes that extra trailing slash
* | just return path parametersAaron Patterson2014-05-221-2/+1
| |
* | Fix the hash key being delete from envRafael Mendonça França2014-05-221-1/+1
| | | | | | | | It was changed by mistake at c5d64b2b86aa42f57881091491ee289b3c489c7e.
* | use the existing constant rather than the hardcoded stringAaron Patterson2014-05-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | so tht I don't go totally insane with THsi crazy hash driven development. why is Everything a hash? Why do people think hashes in hashes with random keys is a Good API? You can't find things or deprecate them or control access whatsoever, you just have to hope that everyone is like "oh, you want to change that? that's cool! we all know it's hashes so go for it!" The End.
* | fewer string allocations per url_forAaron Patterson2014-05-201-7/+5
| |
* | mutate the path string to avoid object allocationsAaron Patterson2014-05-201-4/+4
| |
* | push only_path conditional upAaron Patterson2014-05-201-18/+19
| |
* | push arg checking upAaron Patterson2014-05-201-4/+4
| |
* | fewer method calls and string garbage when there is no user/passwordAaron Patterson2014-05-201-9/+5
| |
* | fixes stack level too deep exception on action named 'status' returning ↵Christiaan Van den Poel2014-05-151-0/+3
| | | | | | | | 'head :ok'
* | Add RFC4791 MKCALENDAR methodkasper2014-05-151-1/+3
| |
* | Always use the provided port for protocol relative urlsAndrew White2014-05-111-0/+2
| | | | | | | | | | There may be situations where you need to tunnel SSL connections over port 80 so we shouldn't remove it if it has been explicitly provided.
* | ActionDispatch::Http::URL.normalize_port should not strip port for protocol ↵Guilherme Cavalcanti2014-05-111-2/+0
| | | | | | | | relative URL.
* | Merge branch 'master' of github.com:rails/docrailsVijay Dev2014-05-101-1/+22
|\ \
| * | copy edits [ci skip]Vijay Dev2014-05-101-8/+8
| | |
| * | [ci skip] doc Http::Headers methodsschneems2014-05-091-1/+17
| | |
| * | copy edits [ci skip]Vijay Dev2014-05-081-2/+1
| | |
| * | [ci skip] document ActionDispatch::HTTP::Headersschneems2014-05-071-0/+6
| |/
* | skip dealing with params if none are providedAaron Patterson2014-05-091-4/+11
| | | | | | | | | | | | | | | | | | | | | | This lets us avoid 1. A slow call to Hash#slice 2. An is_a? test 3. Extra hash allocations (from slice) 4. String allocations etc.
* | don't mutate the options hash, so we don't have to dupAaron Patterson2014-05-091-4/+3
| | | | | | | | avoids extra hash allocations on each call
* | use unless and || since these options are booleanAaron Patterson2014-05-091-1/+1
| |
* | HTTP::Headers#key? correctly convertsschneems2014-05-071-1/+3
|/ | | | | | | | | | | | | | | Previously if you were looking for a given key, the header may incorrectly tell you that it did not exist even though it would return a valid value: ```ruby env = { "CONTENT_TYPE" => "text/plain" } headers = ActionDispatch::Http::Headers.new(env) headers["Content-Type"] # => "text/plain" headers.key?("Content-Type") # => false ``` This PR fixes that behavior by converting the key before checking for presence
* "subhash" --> "sub-hash"Akshay Vishnoi2014-04-191-2/+2
|
* Implement to_io as an aliasRafael Mendonça França2014-04-171-5/+1
|
* Provide interface for accessing underlying IO objectTim Linquist2014-04-151-0/+5
| | | | | | In some cases users may need to work with/manipulate more of the Tempfile api than provided by Upload. Allow users to get at the underlying io via the common to_io method of IO/IO-like objects
* Return null type format when format is not knowRafael Mendonça França2014-04-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | When requesting a controller with the following code with a unknown format: def my_action respond_to do |format| format.json { head :ok } format.any { render text: 'Default response' } end end we should render the default response instead of raising ActionController::UnknownFormat Fixes #14462 Conflicts: actionpack/CHANGELOG.md actionpack/test/controller/mime/respond_with_test.rb Conflicts: actionpack/CHANGELOG.md
* Replace trivial regexp with string or index, twice as fastKelley Reynolds2014-03-281-1/+1
|
* use the body proxy to freeze headersAaron Patterson2014-03-121-5/+32
| | | | | | avoid freezing the headers until the web server has actually read data from the body proxy. Once the webserver has read data, then we should throw an error if someone tries to set a header
* only write the jar if the response isn't committedAaron Patterson2014-03-121-0/+4
| | | | | | | | | | | when streaming responses, we need to make sure the cookie jar is written to the headers before returning up the stack. This commit introduces a new method on the response object that writes the cookie jar to the headers as the response is committed. The middleware and test framework will not write the cookie headers if the response has already been committed. fixes #14352
* Merge pull request #14291 from laurocaetano/doc-for-original-fullpathYves Senn2014-03-121-0/+7
|\ | | | | Add documentation for original_fullpath. [ci skip]
| * [ci skip] Add documentation for original_fullpath.Lauro Caetano2014-03-111-0/+7
| |
* | Do note remove `Content-Type` when `render :body`Prem Sichanugrist2014-03-051-12/+1
|/ | | | | | | | | | | | | `render :body` should just not set the `Content-Type` header. By removing the header, it breaks the compatibility with other parts. After this commit, `render :body` will returns `text/html` content type, sets by default from `ActionDispatch::Response`, and it will preserve the overridden content type if you override it. Fixes #14197, #14238 This partially reverts commit 3047376870d4a7adc7ff15c3cb4852e073c8f1da.
* Add `#no_content_type` attribute to `AD::Response`Prem Sichanugrist2014-02-181-2/+13
| | | | | Setting this attribute to `true` will remove the content type header from the request. This is use in `render :body` feature.
* Introduce `render :body` for render raw contentPrem Sichanugrist2014-02-181-1/+1
| | | | | | | | | | | | This is an option for sending a raw content back to browser. Note that this rendering option will unset the default content type and does not include "Content-Type" header back in the response. You should only use this option if you are expecting the "Content-Type" header to not be set. More information on "Content-Type" header can be found on RFC 2616, section 7.2.1. Please see #12374 for more detail.
* Check if variant array contains only symbolsŁukasz Strzałkowski2014-02-131-2/+2
|
* Variant negotiationLukasz Strzalkowski2014-02-131-2/+4
| | | | | | | | | | | | | | Allow setting `request.variant` as an array - an order in which they will be rendered. For example: request.variant = [:tablet, :phone] respond_to do |format| format.html.none format.html.phone # this gets rendered end
* Prevent [response].flatten from recursing infinitely.Dan Kang2014-02-081-1/+1
| | | | | | Returning `self` from within the array returned by `to_ary` caused this. Instead, we can just substitute another object. It provides the `each` behavior required by the rack spec.
* only ask for the location filters onceAaron Patterson2014-01-311-4/+5
|
* FilterRedirect is referenced at the class level from the ResponseAaron Patterson2014-01-311-0/+1
| | | | | We can just require the file rather than going through the autoload indirection
* Move the null mime type to request.formatCarlos Antonio da Silva2013-12-232-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TLDR: always return an object that responds to the query methods from request.format, and do not touch Mime::Type[] lookup to avoid bugs. --- Long version: The initial issue was about being able to do checks like request.format.html? for request with an unknown format, where request.format would be nil. This is where the issue came from at first in #7837 and #8085 (merged in cba05887dc3b56a46a9fe2779b6b228880b49622), but the implementation went down the path of adding this to the mime type lookup logic. This unfortunately introduced subtle bugs, for instance in the merged commit a test related to send_file had to be changed to accomodate the introduction of the NullType. Later another bug was found in #13064, related to the content-type being shown as #<Mime::NullType:...> for templates with localized extensions but no format included. This one was fixed in #13133, merged in 43962d6ec50f918c9970bd3cd4b6ee5c7f7426ed. Besides that, custom handlers were not receiving the proper template formats anymore when passing through the rendering process, because of the NullType addition. That was found while migrating an application from 3.2 to 4.0 that uses the Markerb gem (a custom handler that generates both text and html emails from a markdown template). --- This changes the implementation moving away from returning this null object from the mime lookup, and still fixes the initial issue where request.format.zomg? would raise an exception for unknown formats due to request.format being nil.
* Add Mime::Type.register "text/vcard", :vcf to the default list of mime typesDavid Heinemeier Hansson2013-12-051-0/+1
|
* remove nil in NullType#ref.Angelo capilleri2013-12-041-3/+1
| | | | | Return Nil is implicit in a method and this syntax is used in the others classes
* Improve a couple exception messages related to variants and mime typesCarlos Antonio da Silva2013-12-031-5/+5
| | | | | Avoid one-liner conditionals when they are too big. Avoid concatenating strings to build error messages. Improve messages a bit.
* Action Pack VariantsŁukasz Strzałkowski2013-12-041-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, variants in the templates will be picked up if a variant is set and there's a match. The format will be: app/views/projects/show.html.erb app/views/projects/show.html+tablet.erb app/views/projects/show.html+phone.erb If request.variant = :tablet is set, we'll automatically be rendering the html+tablet template. In the controller, we can also tailer to the variants with this syntax: class ProjectsController < ActionController::Base def show respond_to do |format| format.html do |html| @stars = @project.stars html.tablet { @notifications = @project.notifications } html.phone { @chat_heads = @project.chat_heads } end format.js format.atom end end end The variant itself is nil by default, but can be set in before filters, like so: class ApplicationController < ActionController::Base before_action do if request.user_agent =~ /iPad/ request.variant = :tablet end end end This is modeled loosely on custom mime types, but it's specifically not intended to be used together. If you're going to make a custom mime type, you don't need a variant. Variants are for variations on a single mime types.
* Change deep_munge call to avoid deprecation warningCarlos Antonio da Silva2013-12-031-2/+2
|
* Merge branch 'master-sec'Aaron Patterson2013-12-031-2/+2
|\ | | | | | | | | | | | | | | | | * master-sec: Deep Munge the parameters for GET and POST Stop using i18n's built in HTML error handling. Ensure simple_format escapes its html attributes Escape the unit value provided to number_to_currency Only use valid mime type symbols as cache keys
| * Deep Munge the parameters for GET and POSTMichael Koziarski2013-12-021-2/+2
| | | | | | | | | | | | | | | | The previous implementation of this functionality could be accidentally subverted by instantiating a raw Rack::Request before the first Rails::Request was constructed. Fixes CVE-2013-6417
* | Convert Mime::NullType in a singletonGuillermo Iguaran2013-12-031-1/+4
|/
* Remove deprecated cattr_* requiresGenadi Samokovarov2013-12-032-2/+2
|