aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* :scissors: [ci skip]Carlos Antonio da Silva2013-11-041-3/+0
|
* Code style for privacy indentionDavid Heinemeier Hansson2013-11-031-8/+8
|
* Ensure backwards compability after the #deep_munge extractionDavid Heinemeier Hansson2013-11-031-0/+10
|
* Reuse variable to avoid symbol usageCarlos Antonio da Silva2013-08-311-2/+2
|
* Merge pull request #11912 from jonkessler/respond-to-signature-fixesRafael Mendonça França2013-08-311-1/+1
|\ | | | | Update Rails::Railtie::Configuration and ActionDispatch::Response#respond_to? to accept include_private argument
| * update Rails::Railtie::Configuration and ↵Jon Kessler2013-08-161-1/+1
| | | | | | | | ActionDispatch::Response#respond_to? to accept include_private argument
* | Use each_with_objectSantiago Pastorino2013-08-191-4/+2
| |
* | Organize normalize_encoding_params' conditionals a bit better and use a case ↵Santiago Pastorino2013-08-191-15/+18
| | | | | | | | | | | | statement for it Refactor of the work done in #11891
* | Normalize file parameters in same place as other parameters ↵robertomiranda2013-08-143-14/+2
|/ | | | (ActionDispatch::Http::Parameters#normalize_encode_params)
* Use helper method to get ENV['CONTENT_LENGTH']Paul Nikitochkin2013-07-081-1/+1
|
* writing the new body can cause the response to be committed and theAaron Patterson2013-06-281-1/+3
| | | | | | | | request thread to return up the stack before the instance variable is assigned. Synchronize so that the ivar is assigned before the other thread can activate. fixes #10984
* Fix undefined method `ref' for nil:NilClass for bad accept headersStephen Becker IV2013-06-191-1/+1
|
* Merge pull request #10839 from gsamokovarov/clean-normalize_encoded_pathsRafael Mendonça França2013-06-041-11/+7
|\ | | | | Refactor ActionDispatch::Http::Parameters#normalize_encode_params
| * Refactor ActionDispatch::Http::Parameters#normalize_encode_paramsGenadi Samokovarov2013-06-041-11/+7
| |
* | Remove Mime::Type#verify_request? and Mime::Type.browser_generated_types ↵kennyj2013-06-021-16/+0
| | | | | | | | were deprecated.
* | Add propery docs to ActionDispatch::Response [ci skip]Steve Klabnik2013-05-301-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | After some discussion on Twitter with @skud, the documentation on ActionDispatch::Response is a bit sparse. This class is useful when you're writing tests, as often you want to assert various things about the response that's coming back. Better docs would make this easier for people new to testing in Rails. I only added some descriptions for various properties that were defined, and mostly just a sentence or two. Most of these things are familliar if you're working with HTTP, but some words is better than no words at all. Hopefully further commits will fix up things that aren't just documentation.
* | Extract ActionDispatch::Request#deep_mungeGenadi Samokovarov2013-05-301-17/+2
|/ | | | | | | | | ActionDispatch::Request#deep_munge was introduced as a private method, but was turned into a public one for the use of ActionDispatch::ParamsParser. I have extracted it into ActionDispatch::Request::Utils, so it does not get mixed up with the Request public methods.
* use constant for encodingNihad Abbasov2013-05-021-1/+1
|
* extract no content response codes to a constantVipul A M2013-04-221-1/+2
|
* Refactor ActionDispatch::Http::URL.build_host_urlAndrew White2013-04-181-20/+49
| | | | | Add support for extracting the port from the :host option and for removing the subdomain by using nil, false or ''.
* Duplicate options before mutating themAndrew White2013-04-181-0/+1
|
* Passing subdomain: '' to url_for removes the subdomain (instead of adding a ↵Derek Watson2013-04-181-1/+1
| | | | | | leading .) Adding a boolean route constraint checks for presence/absence of request property
* Return nil for Mime::NullType#refAndrew White2013-04-101-0/+4
|
* Reverts rendering behavior when format is unknownGrzegorz Świrski2013-04-101-1/+5
| | | | | | | | | If a request has unknown format (eg. /foo.bar), the renderer fallbacks to default format. This patch reverts Rails 3.2 behavior after c2267db commit. Fixes issue #9654.
* Mark unused variables and make some style fixesAgis Anastasopoulos2013-04-081-2/+2
| | | | It'd be a nice convention to mark the unused variables like this, now that Ruby 2 will issue no warnings for such vars being unused.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2013-03-301-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb activerecord/test/cases/adapter_test.rb guides/source/testing.md [ci skip]
| * Fixed small typosPrathamesh Sonpatki2013-03-191-1/+1
| |
* | Merge pull request #9794 from schneems/schneems/email-hostAndrew White2013-03-191-1/+12
|\ \ | | | | | | Fix improperly configured host in generated urls
| * | Fix improperly configured host in generated urlsschneems2013-03-191-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the host in `default_url_options` is accidentally set with a protocol such as ``` host: "http://example.com" ``` then the generated url will have the protocol twice `http://http://example.com` which is not what the user intended. Likely they wanted to define a host `host: "example.com"` and a `protocol: "http://"` but did not know the convention. This may not the most common problem, but when it happens it can go undetected for a while. I accidentally added `http://` out of habit recently only to find all the links in my emails were broken after deploying a demo site to production. Rather than allow this accident go undetected, we can fix the problem in line by properly setting the protocol and host. I was able to find this related question on stack overflow: http://stackoverflow.com/questions/5878329/rails-3-devise-how-do-i-make-the-email-confirmation-links-use-secure-https-n where the answer was highly upvoted. This is based off of work in #7415 cc/ @pixeltrix ATP Action Mailer and Action Pack
* | | Remove mentions of "app" from http request docs [ci skip]Carlos Antonio da Silva2013-03-191-12/+10
|/ /
* | drop an unused hash; change slang to SPECIALVipul A M2013-03-191-2/+2
| |
* | Merge pull request #5606 from teohm/multipart_unicode_param_nameSteve Klabnik2013-03-153-31/+24
|\ \ | | | | | | multipart POST - utf8 param name not encoded
| * | UTF-8 encode all keys and values in nested params hash.Teo Hui Ming2013-03-153-31/+24
| | |
* | | `Http::Headers` directly modifies the passed environment.Yves Senn2013-03-151-2/+1
|/ / | | | | | | | | | | | | | | | | The env hash passed to `Http::Headers#new` must be in env format. Also be aware that the passed hash is modified directly. docs and test-cases for setting headers/env in functional tests. Follow up to #9700.
* | Add extra clarifying line in docs. [ci skip]Steve Klabnik2013-03-131-0/+1
| |
* | Fix docs: response -> request.Steve Klabnik2013-03-131-2/+2
| | | | | | | | Even though I read it carefully, my brain tricked me. :cry:
* | Merge pull request #9698 from garethrees/request_documentationSteve Klabnik2013-03-131-0/+16
|\ \ | | | | | | Add documentation to ActionDispatch::Request
| * | Add documentation to ActionDispatch::RequestGareth Rees2013-03-131-0/+16
| |/
* | `Http::Headers` respects dotted env vars, symbols, headers with numbers.Yves Senn2013-03-131-11/+6
| |
* | allow headers and env to be passed in `IntegrationTest`.Yves Senn2013-03-131-1/+15
| | | | | | | | Closes #6513.