How to get http details in rails

HI all,
I need to get the http request and response headers ,so i used like the below in my app
**request.inspect ** got the following ,
#<ActionController::Request:0xb60b4044 @content_type=nil, @parameters={“action”=>“create”, “credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “controller”=>“core/apigroup”, “c_attribute1”=>“2”, “desp”=>""}, @env={“rack.session”=>{:admin=>#<User id: 1, mail: “admin@test.com”, password: “3ac29c8db9ca98e0e4d782bffc7acd94”, lname: “admin”, fname: “admin_lastname”, loginid: “adminldap”, created_at: “2011-02-28 12:25:47”, updated_at: “2011-02-28 12:25:47”>, :session_id=>“08f6c3b78700a2bce362b79853cb3dfa”, “flash”=>{}}, “SERVER_NAME”=>“localhost”, “HTTP_CACHE_CONTROL”=>“max-age=0”, “HTTP_ACCEPT”=>“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”, “HTTP_HOST”=>“localhost:3000”, “rack.request.cookie_hash”=>{"_sample_app_session"=>“BAh7CDoKYWRtaW5vOglVc2VyBzoQQGF0dHJpYnV0ZXN7DSIPY3JlYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIPdXBkYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIHaWQiBjEiCW1haWwiE2FkbWluQHRlc3QuY29tIgpsbmFtZSIKYWRtaW4iDGxvZ2luaWQiDmFkbWlubGRhcCIKZm5hbWUiE2FkbWluX2xhc3RuYW1lIg1wYXNzd29yZCIlM2FjMjljOGRiOWNhOThlMGU0ZDc4MmJmZmM3YWNkOTQ6FkBhdHRyaWJ1dGVzX2NhY2hlewA6D3Nlc3Npb25faWQiJTA4ZjZjM2I3ODcwMGEyYmNlMzYyYjc5ODUzY2IzZGZhIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–11c2ec841ee75df92b9bee8a416145890a266e9d”}, “rack.url_scheme”=>“http”, “HTTP_KEEP_ALIVE”=>“115”, “HTTP_USER_AGENT”=>“Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12”, “REQUEST_PATH”=>"/apigroup/create", “action_controller.request.request_parameters”=>{}, “rack.errors”=>#IO:0xb7774554, “SERVER_PROTOCOL”=>“HTTP/1.1”, “HTTP_ACCEPT_LANGUAGE”=>“en-us,en;q=0.5”, “rack.version”=>[0, 1], “rack.run_once”=>false, “REMOTE_ADDR”=>“127.0.0.1”, “PATH_INFO”=>"/apigroup/create", “SERVER_SOFTWARE”=>“Mongrel 1.1.5”, “rack.request.cookie_string”=>"_sample_app_session=BAh7CDoKYWRtaW5vOglVc2VyBzoQQGF0dHJpYnV0ZXN7DSIPY3JlYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIPdXBkYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIHaWQiBjEiCW1haWwiE2FkbWluQHRlc3QuY29tIgpsbmFtZSIKYWRtaW4iDGxvZ2luaWQiDmFkbWlubGRhcCIKZm5hbWUiE2FkbWluX2xhc3RuYW1lIg1wYXNzd29yZCIlM2FjMjljOGRiOWNhOThlMGU0ZDc4MmJmZmM3YWNkOTQ6FkBhdHRyaWJ1dGVzX2NhY2hlewA6D3Nlc3Npb25faWQiJTA4ZjZjM2I3ODcwMGEyYmNlMzYyYjc5ODUzY2IzZGZhIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–11c2ec841ee75df92b9bee8a416145890a266e9d", “SCRIPT_NAME”=>"", “HTTP_AUTHORIZATION”=>“Basic YXBpZ2VlOmFwaWdlZTEyMw==”, “rack.multithread”=>false, “HTTP_COOKIE”=>"_sample_app_session=BAh7CDoKYWRtaW5vOglVc2VyBzoQQGF0dHJpYnV0ZXN7DSIPY3JlYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIPdXBkYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIHaWQiBjEiCW1haWwiE2FkbWluQHRlc3QuY29tIgpsbmFtZSIKYWRtaW4iDGxvZ2luaWQiDmFkbWlubGRhcCIKZm5hbWUiE2FkbWluX2xhc3RuYW1lIg1wYXNzd29yZCIlM2FjMjljOGRiOWNhOThlMGU0ZDc4MmJmZmM3YWNkOTQ6FkBhdHRyaWJ1dGVzX2NhY2hlewA6D3Nlc3Npb25faWQiJTA4ZjZjM2I3ODcwMGEyYmNlMzYyYjc5ODUzY2IzZGZhIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–11c2ec841ee75df92b9bee8a416145890a266e9d", “HTTP_VERSION”=>“HTTP/1.1”, “action_controller.request.path_parameters”=>{“action”=>“create”, “controller”=>“core/apigroup”}, “rack.multiprocess”=>true, “REQUEST_URI”=>"/apigroup/create?api_group_name=388&desp=&credential=keys&approval=auto&c_attribute1=2", “rack.request.query_hash”=>{“credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “c_attribute1”=>“2”, “desp”=>""}, “SERVER_PORT”=>“3000”, “HTTP_ACCEPT_CHARSET”=>“ISO-8859-1,utf-8;q=0.7,*;q=0.7”, “rack.session.options”=>{:expire_after=>nil, :httponly=>true, :domain=>nil, :id=>“08f6c3b78700a2bce362b79853cb3dfa”, :path=>"/", :key=>"_session_id"}, “REQUEST_METHOD”=>“GET”, “action_controller.request.query_parameters”=>{“credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “c_attribute1”=>“2”, “desp”=>""}, “action_controller.rescue.request”=>#<ActionController::Request:0xb60b4044 …>, “rack.request.query_string”=>“api_group_name=388&desp=&credential=keys&approval=auto&c_attribute1=2”, “action_controller.rescue.response”=>#<ActionController::Response:0xb60b3b58 @session={:admin=>#<User id: 1, mail: “admin@test.com”, password: “3ac29c8db9ca98e0e4d782bffc7acd94”, lname: “admin”, fname: “admin_lastname”, loginid: “adminldap”, created_at: “2011-02-28 12:25:47”, updated_at: “2011-02-28 12:25:47”>, :session_id=>“08f6c3b78700a2bce362b79853cb3dfa”, “flash”=>{}}, @block=nil, @assigns=[], @writer=#Proc:0xb60b316c@/home/loganathan/sonoa/projects/SonoaRails_sdm_v3.8.2/vendor/rails/actionpack/lib/action_controller/response.rb:46, @header={“Cache-Control”=>“no-cache”}, @redirected_to=nil, @template=#<ActionView::Base:0xb60992e4 @_current_render=nil, @assigns_added=nil, @_first_render=nil, @assigns={}, @helpers=#ActionView::Base::ProxyModule:0xb60992a8, @view_paths=["/home/loganathan/sonoa/projects/SonoaRails_sdm_v3.8.2/app/views", “/home/loganathan/sonoa/projects/SonoaRails_sdm_v3.8.2/vendor/plugins/rsa-form/app/views”], @controller=#<Core::ApigroupController:0xb6099384 @url=#<ActionController::UrlRewriter:0xb6098074 @parameters={“action”=>“create”, “credential”=>“keys”, “api_group_name”=>“388”, “approval”=>“auto”, “controller”=>“core/apigroup”, “desp”=>"", “c_attribute1”=>“2”}, @request=#<ActionController::Request:0xb60b4044 …>>, @performed_redirect=false, @_session={:admin=>#<User id: 1, mail: “admin@test.com”, password: “3ac29c8db9ca98e0e4d782bffc7acd94”, lname: “admin”, fname: “admin_lastname”, loginid: “adminldap”, created_at: “2011-02-28 12:25:47”, updated_at: “2011-02-28 12:25:47”>, :session_id=>“08f6c3b78700a2bce362b79853cb3dfa”, “flash”=>{}}, @before_filter_chain_aborted=false, @_params={“action”=>“create”, “credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “controller”=>“core/apigroup”, “c_attribute1”=>“2”, “desp”=>""}, @request_origin=“127.0.0.1 at 2011-04-25 16:17:25”, @_request=#<ActionController::Request:0xb60b4044 …>, @performed_render=false, @_headers={“Cache-Control”=>“no-cache”}, @template=#<ActionView::Base:0xb60992e4 …>, @action_name=“create”, @_response=#<ActionController::Response:0xb60b3b58 …>>>, @request=#<ActionController::Request:0xb60b4044 …>, @status=200, @body=["", nil, [], []]>, “rack.input”=>#StringIO:0xb7463e28, “GATEWAY_INTERFACE”=>“CGI/1.2”, “HTTP_CONNECTION”=>“keep-alive”, “HTTP_ACCEPT_ENCODING”=>“gzip,deflate”, “QUERY_STRING”=>“api_group_name=388&desp=&credential=keys&approval=auto&c_attribute1=2”}, @request_method=:get>
response.inspect got the following,

#<ActionController::Response:0xb61677e8 @session={:admin=>#<User id: 1, mail: “admin@test.com”, password: “3ac29c8db9ca98e0e4d782bffc7acd94”, lname: “admin”, fname: “admin_lastname”, loginid: “adminldap”, created_at: “2011-02-28 12:25:47”, updated_at: “2011-02-28 12:25:47”>, :session_id=>“08f6c3b78700a2bce362b79853cb3dfa”, “flash”=>{}}, @block=nil, @assigns=[], @writer=#Proc:0xb6166dfc@/home/loganathan/sonoa/projects/SonoaRails_sdm_v3.8.2/vendor/rails/actionpack/lib/action_controller/response.rb:46, @header={“Content-Type”=>“application/xml”, “Cache-Control”=>“no-cache”}, @redirected_to=nil, @template=#<ActionView::Base:0xb614cf74 @_current_render=nil, @assigns_added=nil, @_first_render=nil, @template_format=:html, @assigns={}, @helpers=#ActionView::Base::ProxyModule:0xb614cf38, @view_paths=["/home/loganathan/sonoa/projects/SonoaRails_sdm_v3.8.2/app/views", “/home/loganathan/sonoa/projects/SonoaRails_sdm_v3.8.2/vendor/plugins/rsa-form/app/views”], @controller=#<Core::ApigroupController:0xb614d014 @url=#<ActionController::UrlRewriter:0xb614bd04 @parameters={“action”=>“create”, “credential”=>“keys”, “api_group_name”=>“388”, “approval”=>“auto”, “controller”=>“core/apigroup”, “desp”=>"", “c_attribute1”=>“2”}, @request=#<ActionController::Request:0xb6167cd4 @content_type=nil, @parameters={“action”=>“create”, “credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “controller”=>“core/apigroup”, “c_attribute1”=>“2”, “desp”=>""}, @env={“rack.session”=>{:admin=>#<User id: 1, mail: “admin@test.com”, password: “3ac29c8db9ca98e0e4d782bffc7acd94”, lname: “admin”, fname: “admin_lastname”, loginid: “adminldap”, created_at: “2011-02-28 12:25:47”, updated_at: “2011-02-28 12:25:47”>, :session_id=>“08f6c3b78700a2bce362b79853cb3dfa”, “flash”=>{}}, “SERVER_NAME”=>“localhost”, “HTTP_CACHE_CONTROL”=>“max-age=0”, “HTTP_ACCEPT”=>“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”, “HTTP_HOST”=>“localhost:3000”, “rack.request.cookie_hash”=>{"_sample_app_session"=>“BAh7CDoKYWRtaW5vOglVc2VyBzoQQGF0dHJpYnV0ZXN7DSIPY3JlYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIPdXBkYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIHaWQiBjEiCW1haWwiE2FkbWluQHRlc3QuY29tIgpsbmFtZSIKYWRtaW4iDGxvZ2luaWQiDmFkbWlubGRhcCIKZm5hbWUiE2FkbWluX2xhc3RuYW1lIg1wYXNzd29yZCIlM2FjMjljOGRiOWNhOThlMGU0ZDc4MmJmZmM3YWNkOTQ6FkBhdHRyaWJ1dGVzX2NhY2hlewA6D3Nlc3Npb25faWQiJTA4ZjZjM2I3ODcwMGEyYmNlMzYyYjc5ODUzY2IzZGZhIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–11c2ec841ee75df92b9bee8a416145890a266e9d”}, “rack.url_scheme”=>“http”, “HTTP_KEEP_ALIVE”=>“115”, “HTTP_USER_AGENT”=>“Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12”, “REQUEST_PATH”=>"/apigroup/create", “action_controller.request.request_parameters”=>{}, “rack.errors”=>#IO:0xb789c558, “SERVER_PROTOCOL”=>“HTTP/1.1”, “HTTP_ACCEPT_LANGUAGE”=>“en-us,en;q=0.5”, “rack.version”=>[0, 1], “rack.run_once”=>false, “REMOTE_ADDR”=>“127.0.0.1”, “PATH_INFO”=>"/apigroup/create", “SERVER_SOFTWARE”=>“Mongrel 1.1.5”, “rack.request.cookie_string”=>"_sample_app_session=BAh7CDoKYWRtaW5vOglVc2VyBzoQQGF0dHJpYnV0ZXN7DSIPY3JlYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIPdXBkYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIHaWQiBjEiCW1haWwiE2FkbWluQHRlc3QuY29tIgpsbmFtZSIKYWRtaW4iDGxvZ2luaWQiDmFkbWlubGRhcCIKZm5hbWUiE2FkbWluX2xhc3RuYW1lIg1wYXNzd29yZCIlM2FjMjljOGRiOWNhOThlMGU0ZDc4MmJmZmM3YWNkOTQ6FkBhdHRyaWJ1dGVzX2NhY2hlewA6D3Nlc3Npb25faWQiJTA4ZjZjM2I3ODcwMGEyYmNlMzYyYjc5ODUzY2IzZGZhIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–11c2ec841ee75df92b9bee8a416145890a266e9d", “SCRIPT_NAME”=>"", “HTTP_AUTHORIZATION”=>“Basic YXBpZ2VlOmFwaWdlZTEyMw==”, “rack.multithread”=>false, “HTTP_COOKIE”=>"_sample_app_session=BAh7CDoKYWRtaW5vOglVc2VyBzoQQGF0dHJpYnV0ZXN7DSIPY3JlYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIPdXBkYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIHaWQiBjEiCW1haWwiE2FkbWluQHRlc3QuY29tIgpsbmFtZSIKYWRtaW4iDGxvZ2luaWQiDmFkbWlubGRhcCIKZm5hbWUiE2FkbWluX2xhc3RuYW1lIg1wYXNzd29yZCIlM2FjMjljOGRiOWNhOThlMGU0ZDc4MmJmZmM3YWNkOTQ6FkBhdHRyaWJ1dGVzX2NhY2hlewA6D3Nlc3Npb25faWQiJTA4ZjZjM2I3ODcwMGEyYmNlMzYyYjc5ODUzY2IzZGZhIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–11c2ec841ee75df92b9bee8a416145890a266e9d", “HTTP_VERSION”=>“HTTP/1.1”, “action_controller.request.path_parameters”=>{“action”=>“create”, “controller”=>“core/apigroup”}, “rack.multiprocess”=>true, “REQUEST_URI”=>"/apigroup/create?api_group_name=388&desp=&credential=keys&approval=auto&c_attribute1=2", “rack.request.query_hash”=>{“credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “c_attribute1”=>“2”, “desp”=>""}, “SERVER_PORT”=>“3000”, “HTTP_ACCEPT_CHARSET”=>“ISO-8859-1,utf-8;q=0.7,;q=0.7", “rack.session.options”=>{:expire_after=>nil, :httponly=>true, :domain=>nil, :id=>“08f6c3b78700a2bce362b79853cb3dfa”, :path=>"/", :key=>"_session_id"}, “REQUEST_METHOD”=>“GET”, “action_controller.request.query_parameters”=>{“credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “c_attribute1”=>“2”, “desp”=>""}, “action_controller.rescue.request”=>#<ActionController::Request:0xb6167cd4 …>, “rack.request.query_string”=>“api_group_name=388&desp=&credential=keys&approval=auto&c_attribute1=2”, “action_controller.rescue.response”=>#<ActionController::Response:0xb61677e8 …>, “rack.input”=>#StringIO:0xb77c11c4, “GATEWAY_INTERFACE”=>“CGI/1.2”, “HTTP_CONNECTION”=>“keep-alive”, “HTTP_ACCEPT_ENCODING”=>“gzip,deflate”, “QUERY_STRING”=>“api_group_name=388&desp=&credential=keys&approval=auto&c_attribute1=2”}, @request_method=:get>>, @performed_redirect=false, @view_runtime=0.706911087036133, @_session={:admin=>#<User id: 1, mail: “admin@test.com”, password: “3ac29c8db9ca98e0e4d782bffc7acd94”, lname: “admin”, fname: “admin_lastname”, loginid: “adminldap”, created_at: “2011-02-28 12:25:47”, updated_at: “2011-02-28 12:25:47”>, :session_id=>“08f6c3b78700a2bce362b79853cb3dfa”, “flash”=>{}}, @before_filter_chain_aborted=false, @_params={“action”=>“create”, “credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “controller”=>“core/apigroup”, “c_attribute1”=>“2”, “desp”=>""}, @db_rt_after_render=0, @request_origin=“127.0.0.1 at 2011-04-25 16:27:52”, @_request=#<ActionController::Request:0xb6167cd4 @content_type=nil, @parameters={“action”=>“create”, “credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “controller”=>“core/apigroup”, “c_attribute1”=>“2”, “desp”=>""}, @env={“rack.session”=>{:admin=>#<User id: 1, mail: “admin@test.com”, password: “3ac29c8db9ca98e0e4d782bffc7acd94”, lname: “admin”, fname: “admin_lastname”, loginid: “adminldap”, created_at: “2011-02-28 12:25:47”, updated_at: “2011-02-28 12:25:47”>, :session_id=>“08f6c3b78700a2bce362b79853cb3dfa”, “flash”=>{}}, “SERVER_NAME”=>“localhost”, “HTTP_CACHE_CONTROL”=>“max-age=0”, “HTTP_ACCEPT”=>"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8", “HTTP_HOST”=>“localhost:3000”, “rack.request.cookie_hash”=>{"_sample_app_session"=>“BAh7CDoKYWRtaW5vOglVc2VyBzoQQGF0dHJpYnV0ZXN7DSIPY3JlYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIPdXBkYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIHaWQiBjEiCW1haWwiE2FkbWluQHRlc3QuY29tIgpsbmFtZSIKYWRtaW4iDGxvZ2luaWQiDmFkbWlubGRhcCIKZm5hbWUiE2FkbWluX2xhc3RuYW1lIg1wYXNzd29yZCIlM2FjMjljOGRiOWNhOThlMGU0ZDc4MmJmZmM3YWNkOTQ6FkBhdHRyaWJ1dGVzX2NhY2hlewA6D3Nlc3Npb25faWQiJTA4ZjZjM2I3ODcwMGEyYmNlMzYyYjc5ODUzY2IzZGZhIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–11c2ec841ee75df92b9bee8a416145890a266e9d”}, “rack.url_scheme”=>“http”, “HTTP_KEEP_ALIVE”=>“115”, “HTTP_USER_AGENT”=>“Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12”, “REQUEST_PATH”=>"/apigroup/create", “action_controller.request.request_parameters”=>{}, “rack.errors”=>#IO:0xb789c558, “SERVER_PROTOCOL”=>“HTTP/1.1”, “HTTP_ACCEPT_LANGUAGE”=>“en-us,en;q=0.5”, “rack.version”=>[0, 1], “rack.run_once”=>false, “REMOTE_ADDR”=>“127.0.0.1”, “PATH_INFO”=>"/apigroup/create", “SERVER_SOFTWARE”=>“Mongrel 1.1.5”, “rack.request.cookie_string”=>"_sample_app_session=BAh7CDoKYWRtaW5vOglVc2VyBzoQQGF0dHJpYnV0ZXN7DSIPY3JlYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIPdXBkYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIHaWQiBjEiCW1haWwiE2FkbWluQHRlc3QuY29tIgpsbmFtZSIKYWRtaW4iDGxvZ2luaWQiDmFkbWlubGRhcCIKZm5hbWUiE2FkbWluX2xhc3RuYW1lIg1wYXNzd29yZCIlM2FjMjljOGRiOWNhOThlMGU0ZDc4MmJmZmM3YWNkOTQ6FkBhdHRyaWJ1dGVzX2NhY2hlewA6D3Nlc3Npb25faWQiJTA4ZjZjM2I3ODcwMGEyYmNlMzYyYjc5ODUzY2IzZGZhIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–11c2ec841ee75df92b9bee8a416145890a266e9d", “SCRIPT_NAME”=>"", “HTTP_AUTHORIZATION”=>“Basic YXBpZ2VlOmFwaWdlZTEyMw==”, “rack.multithread”=>false, “HTTP_COOKIE”=>"_sample_app_session=BAh7CDoKYWRtaW5vOglVc2VyBzoQQGF0dHJpYnV0ZXN7DSIPY3JlYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIPdXBkYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIHaWQiBjEiCW1haWwiE2FkbWluQHRlc3QuY29tIgpsbmFtZSIKYWRtaW4iDGxvZ2luaWQiDmFkbWlubGRhcCIKZm5hbWUiE2FkbWluX2xhc3RuYW1lIg1wYXNzd29yZCIlM2FjMjljOGRiOWNhOThlMGU0ZDc4MmJmZmM3YWNkOTQ6FkBhdHRyaWJ1dGVzX2NhY2hlewA6D3Nlc3Npb25faWQiJTA4ZjZjM2I3ODcwMGEyYmNlMzYyYjc5ODUzY2IzZGZhIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–11c2ec841ee75df92b9bee8a416145890a266e9d", “HTTP_VERSION”=>“HTTP/1.1”, “action_controller.request.path_parameters”=>{“action”=>“create”, “controller”=>“core/apigroup”}, “rack.multiprocess”=>true, “REQUEST_URI”=>"/apigroup/create?api_group_name=388&desp=&credential=keys&approval=auto&c_attribute1=2", “rack.request.query_hash”=>{“credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “c_attribute1”=>“2”, “desp”=>""}, “SERVER_PORT”=>“3000”, “HTTP_ACCEPT_CHARSET”=>"ISO-8859-1,utf-8;q=0.7,;q=0.7”, “rack.session.options”=>{:expire_after=>nil, :httponly=>true, :domain=>nil, :id=>“08f6c3b78700a2bce362b79853cb3dfa”, :path=>"/", :key=>"_session_id"}, “REQUEST_METHOD”=>“GET”, “action_controller.request.query_parameters”=>{“credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “c_attribute1”=>“2”, “desp”=>""}, “action_controller.rescue.request”=>#<ActionController::Request:0xb6167cd4 …>, “rack.request.query_string”=>“api_group_name=388&desp=&credential=keys&approval=auto&c_attribute1=2”, “action_controller.rescue.response”=>#<ActionController::Response:0xb61677e8 …>, “rack.input”=>#StringIO:0xb77c11c4, “GATEWAY_INTERFACE”=>“CGI/1.2”, “HTTP_CONNECTION”=>“keep-alive”, “HTTP_ACCEPT_ENCODING”=>“gzip,deflate”, “QUERY_STRING”=>“api_group_name=388&desp=&credential=keys&approval=auto&c_attribute1=2”}, @request_method=:get>, @db_rt_before_render=3.94296646118164, @performed_render=true, @_headers={“Content-Type”=>“application/xml”, “Cache-Control”=>“no-cache”}, @template=#<ActionView::Base:0xb614cf74 …>, @action_name=“create”, @_response=#<ActionController::Response:0xb61677e8 …>>>, @request=#<ActionController::Request:0xb6167cd4 @content_type=nil, @parameters={“action”=>“create”, “credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “controller”=>“core/apigroup”, “c_attribute1”=>“2”, “desp”=>""}, @env={“rack.session”=>{:admin=>#<User id: 1, mail: “admin@test.com”, password: “3ac29c8db9ca98e0e4d782bffc7acd94”, lname: “admin”, fname: “admin_lastname”, loginid: “adminldap”, created_at: “2011-02-28 12:25:47”, updated_at: “2011-02-28 12:25:47”>, :session_id=>“08f6c3b78700a2bce362b79853cb3dfa”, “flash”=>{}}, “SERVER_NAME”=>“localhost”, “HTTP_CACHE_CONTROL”=>“max-age=0”, “HTTP_ACCEPT”=>“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”, “HTTP_HOST”=>“localhost:3000”, “rack.request.cookie_hash”=>{"_sample_app_session"=>“BAh7CDoKYWRtaW5vOglVc2VyBzoQQGF0dHJpYnV0ZXN7DSIPY3JlYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIPdXBkYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIHaWQiBjEiCW1haWwiE2FkbWluQHRlc3QuY29tIgpsbmFtZSIKYWRtaW4iDGxvZ2luaWQiDmFkbWlubGRhcCIKZm5hbWUiE2FkbWluX2xhc3RuYW1lIg1wYXNzd29yZCIlM2FjMjljOGRiOWNhOThlMGU0ZDc4MmJmZmM3YWNkOTQ6FkBhdHRyaWJ1dGVzX2NhY2hlewA6D3Nlc3Npb25faWQiJTA4ZjZjM2I3ODcwMGEyYmNlMzYyYjc5ODUzY2IzZGZhIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–11c2ec841ee75df92b9bee8a416145890a266e9d”}, “rack.url_scheme”=>“http”, “HTTP_KEEP_ALIVE”=>“115”, “HTTP_USER_AGENT”=>“Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12”, “REQUEST_PATH”=>"/apigroup/create", “action_controller.request.request_parameters”=>{}, “rack.errors”=>#IO:0xb789c558, “SERVER_PROTOCOL”=>“HTTP/1.1”, “HTTP_ACCEPT_LANGUAGE”=>“en-us,en;q=0.5”, “rack.version”=>[0, 1], “rack.run_once”=>false, “REMOTE_ADDR”=>“127.0.0.1”, “PATH_INFO”=>"/apigroup/create", “SERVER_SOFTWARE”=>“Mongrel 1.1.5”, “rack.request.cookie_string”=>"_sample_app_session=BAh7CDoKYWRtaW5vOglVc2VyBzoQQGF0dHJpYnV0ZXN7DSIPY3JlYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIPdXBkYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIHaWQiBjEiCW1haWwiE2FkbWluQHRlc3QuY29tIgpsbmFtZSIKYWRtaW4iDGxvZ2luaWQiDmFkbWlubGRhcCIKZm5hbWUiE2FkbWluX2xhc3RuYW1lIg1wYXNzd29yZCIlM2FjMjljOGRiOWNhOThlMGU0ZDc4MmJmZmM3YWNkOTQ6FkBhdHRyaWJ1dGVzX2NhY2hlewA6D3Nlc3Npb25faWQiJTA4ZjZjM2I3ODcwMGEyYmNlMzYyYjc5ODUzY2IzZGZhIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–11c2ec841ee75df92b9bee8a416145890a266e9d", “SCRIPT_NAME”=>"", “HTTP_AUTHORIZATION”=>“Basic YXBpZ2VlOmFwaWdlZTEyMw==”, “rack.multithread”=>false, “HTTP_COOKIE”=>"_sample_app_session=BAh7CDoKYWRtaW5vOglVc2VyBzoQQGF0dHJpYnV0ZXN7DSIPY3JlYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIPdXBkYXRlZF9hdCIYMjAxMS0wMi0yOCAxMjoyNTo0NyIHaWQiBjEiCW1haWwiE2FkbWluQHRlc3QuY29tIgpsbmFtZSIKYWRtaW4iDGxvZ2luaWQiDmFkbWlubGRhcCIKZm5hbWUiE2FkbWluX2xhc3RuYW1lIg1wYXNzd29yZCIlM2FjMjljOGRiOWNhOThlMGU0ZDc4MmJmZmM3YWNkOTQ6FkBhdHRyaWJ1dGVzX2NhY2hlewA6D3Nlc3Npb25faWQiJTA4ZjZjM2I3ODcwMGEyYmNlMzYyYjc5ODUzY2IzZGZhIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–11c2ec841ee75df92b9bee8a416145890a266e9d", “HTTP_VERSION”=>“HTTP/1.1”, “action_controller.request.path_parameters”=>{“action”=>“create”, “controller”=>“core/apigroup”}, “rack.multiprocess”=>true, “REQUEST_URI”=>"/apigroup/create?api_group_name=388&desp=&credential=keys&approval=auto&c_attribute1=2", “rack.request.query_hash”=>{“credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “c_attribute1”=>“2”, “desp”=>""}, “SERVER_PORT”=>“3000”, “HTTP_ACCEPT_CHARSET”=>“ISO-8859-1,utf-8;q=0.7,*;q=0.7”, “rack.session.options”=>{:expire_after=>nil, :httponly=>true, :domain=>nil, :id=>“08f6c3b78700a2bce362b79853cb3dfa”, :path=>"/", :key=>"_session_id"}, “REQUEST_METHOD”=>“GET”, “action_controller.request.query_parameters”=>{“credential”=>“keys”, “approval”=>“auto”, “api_group_name”=>“388”, “c_attribute1”=>“2”, “desp”=>""}, “action_controller.rescue.request”=>#<ActionController::Request:0xb6167cd4 …>, “rack.request.query_string”=>“api_group_name=388&desp=&credential=keys&approval=auto&c_attribute1=2”, “action_controller.rescue.response”=>#<ActionController::Response:0xb61677e8 …>, “rack.input”=>#StringIO:0xb77c11c4, “GATEWAY_INTERFACE”=>“CGI/1.2”, “HTTP_CONNECTION”=>“keep-alive”, “HTTP_ACCEPT_ENCODING”=>“gzip,deflate”, “QUERY_STRING”=>“api_group_name=388&desp=&credential=keys&approval=auto&c_attribute1=2”}, @request_method=:get>, @status=“500 Internal Server Error”, @body=“Name has already been taken”>

but what i need is just the basic http headers such as

“HTTP_ACCEPT”=>“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”,
“HTTP_HOST”=>“localhost:3000”
“HTTP_USER_AGENT”=>“Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12”,

Not the rails related headers such as

“rack.errors”=>#IO:0xb789c558
#<ActionController::Response:0xb61677e8 @session={:admin=>#<User id: 1, mail: “admin@test.com”, password: “3ac29c8db9ca98e0e4d782bffc7acd94”, lname: “admin”, fname: “admin_lastname”, loginid: “adminldap”, created_at: “2011-02-28 12:25:47”, updated_at: “2011-02-28 12:25:47”>, :session_id=>“08f6c3b78700a2bce362b79853cb3dfa”, “flash”=>{}},

is their anyway to get this…

Thanks

The headers you’re looking for should be available in request.env

request.env["HTTP_ACCEPT"]
request.env["HTTP_HOST"]
request.env["HTTP_USER_AGENT"]

hi ,
Thanks for your reply,but still i got the rails related headers such as

“rack.session”=>{:admin=>#<User id: 1, mail: “admin@test.com”, password: “3ac29c8db9ca98e0e4d782bffc7acd94”, lname: “admin”, fname: “admin_lastname”, loginid: “adminldap”, created_at: “2011-02-28 12:25:47”, updated_at: “2011-02-28 12:25:47”>,

is their anyway to get only basic http headers exactly,the below is th o/p of request.env

I guess I’m not understanding the question.

If you want to access a HTTP header such as HTTP_USER_AGENT, you can just pull it out of the request.env hash:

puts request.env[“HTTP_USER_AGENT”]

Does it matter that there are other rails keys in the hash?

You can also print all the headers beginning with HTTP by using match if you want:

<% for header in request.env.select { |key, val| k.match("^HTTP.*")} %>
  <%= key %> <%= val %> <% end %>

Sorry, that example should have been

<% for header in request.env.select { |key, val| k.match("^HTTP.*")} %>
  <%= header[0] %> <%= header[1] %> <% end %>