rails++request

   puts  "----#{request.env["HTTP_USER_AGENT"]}----"//获取用户浏览器
     puts  "----#{request.env["HTTP_REFERER"]}----"//获取请求地址

 

  pp  "----#{request.env}----"//所有内容

 

request..env.each{|key,value| pp "key:#{key}-------value:#{value}"}

 

"key:rack.session --------- value:"
"key:SERVER_NAME --------- value:localhost"
"key:HTTP_ACCEPT --------- value:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
"key:HTTP_HOST --------- value:localhost:3000"
"key:CONTENT_LENGTH --------- value:846342"
"key:REMOTE_HOST --------- value:huxl-HP"
"key:HTTP_USER_AGENT --------- value:Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"
"key:rack.url_scheme --------- value:http"
"key:REQUEST_PATH --------- value:/"
"key:action_controller.request.request_parameters --------- value:commitCreateupload#<File:0x7c8f0a8>urlwww.dfafaf.com"
"key:CONTENT_TYPE --------- value:multipart/form-data; boundary=---------------------------12316303522190"
"key:SERVER_PROTOCOL --------- value:HTTP/1.1"
"key:HTTP_ACCEPT_LANGUAGE --------- value:zh-cn,zh;q=0.5"
"key:rack.errors --------- value:#<IO:0x387da88>"
"key:PATH_INFO --------- value:/file_uploads"
"key:REMOTE_ADDR --------- value:127.0.0.1"
"key:SERVER_SOFTWARE --------- value:WEBrick/1.3.1 (Ruby/1.8.7/2010-08-16)"
"key:rack.run_once --------- value:false"
"key:rack.version --------- value:11"
"key:SCRIPT_NAME --------- value:"
"key:HTTP_REFERER --------- value:http://localhost:3000/file_uploads/new"
"key:HTTP_COOKIE --------- value:_photo_session=BAh7DjoPc2Vzc2lvbl9pZCIlZWJmY2RkZWQxOWE3MGM5NTNjMDA0ZmIyMDhjOTA5OGQiFXVzZXJfY3JlZGVudGlhbHMiAYBjYjhiMGIzODc3MzU4NTI3NzA1MjNjN2Q3YTE1MzFlMGE1M2ViYTdjNTMxOGU3Yzc4YmFhN2YyNTYyMTU4YWMzMDAyOWRiODk2YTg3YTYwMzNlNDY4NjY2NmViYjc2NDJiNTczMDZiZmNhNDUyNjg4MTdjYzJkNWFmNzYzODQwODoQX2NzcmZfdG9rZW4iMXRKY05SRnFIVzdsN1Nkb00xelJDMytTKzEzSU90QitxRCt6UGZMV0crQ0E9Og5yZXR1cm5fdG8iHi9hYWJiY2M0NTZhYS9lZGl0X2FjY291bnQ6C2ZvcnVtc3sAIhh1c2VyX2NyZWRlbnRpYWxzX2lkaQc6C3RvcGljc0ALIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsAOhBsYXN0X2FjdGl2ZUl1OglUaW1lDULlG4AAALAaBjofQG1hcnNoYWxfd2l0aF91dGNfY29lcmNpb25G--ed8da6022a7a7aabb62963a3d1a3c9b7c300afa8; user_credentials=cb8b0b387735852770523c7d7a1531e0a53eba7c5318e7c78baa7f2562158ac30029db896a87a6033e4686666ebb7642b57306bfca45268817cc2d5af7638408%3A%3A2; _RailsApplication1_session=BAh7BzoPc2Vzc2lvbl9pZCIlNDZhNjQyNDBkZjlmMzUwNTVlNmNhNGY1YmE4YzhmMWUiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7BjoLbm90aWNlIilGaWxlVXBsb2FkIHdhcyBzdWNjZXNzZnVsbHkgY3JlYXRlZC4GOgpAdXNlZHsGOwdU--72af1d8598091d29eb3aa9d88020c23a89036274"
"key:rack.multithread --------- value:false"
"key:HTTP_VERSION --------- value:HTTP/1.1"
"key:action_controller.request.path_parameters --------- value:actioncreatecontrollerfile_uploads"
"key:REQUEST_URI --------- value:http://localhost:3000/file_uploads"
"key:rack.multiprocess --------- value:false"
"key:rack.request.query_hash --------- value:"
"key:rack.request.form_input --------- value:#<StringIO:0x7c92210>"
"key:SERVER_PORT --------- value:3000"
"key:HTTP_ACCEPT_CHARSET --------- value:GB2312,utf-8;q=0.7,*;q=0.7"
"key:rack.session.options --------- value:httponlytrueexpire_afterdomainkey_session_idpath/"
"key:REQUEST_METHOD --------- value:POST"
"key:action_controller.request.query_parameters --------- value:"
"key:action_controller.rescue.request --------- value:#<ActionController::Request:0x7e01860>"
"key:rack.request.query_string --------- value:"
"key:action_controller.rescue.response --------- value:#<ActionController::Response:0x7e017d0>"
"key:rack.request.form_hash --------- value:commitCreateuploadtypeimage/jpegheadContent-Disposition: form-data; name=\"upload\"; filename=\"Desert.jpg\"\r\nContent-Type: image/jpeg\r\ntempfile#<File:0x7c8f0a8>nameuploadfilenameDesert.jpgurlwww.dfafaf.com"
"key:GATEWAY_INTERFACE --------- value:CGI/1.1"
"key:QUERY_STRING --------- value:"
"key:HTTP_CONNECTION --------- value:keep-alive"
"key:HTTP_ACCEPT_ENCODING --------- value:gzip, deflate"
"key:rack.input --------- value:#<StringIO:0x7c92210>"

 

阅读更多
个人分类: Ruby/Rails
想对作者说点什么? 我来说一句
关闭
关闭
关闭