Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7163741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:57:12+00:00 2026-05-28T13:57:12+00:00

Rubyists, something’s wrong with my HTTP AUTH params that are coming into my Rails

  • 0

Rubyists,

something’s wrong with my HTTP AUTH params that are coming into my Rails 3 app. The password has some whitespace at the end. I was debugging my client app and it looks like it is sending it correctly.

I am doing this in my app:

params[:auth_username], params[:auth_password] = user_name_and_password(request)

Then I am sending this into Warden.

I would like to see the raw data to see if the whitespace is there. How to do that?

Edit: I have debugged the wire between httpd and thin process and I am pretty sure the data are coming correctly. It must be something wrong in my Rails 3.0.10. I was able to decode the base64 string that is coming in the headers and it did not contain any whitespace.

This really looks like BASE64 decoder issue. Maybe a padding problem. My string is:

Qmxvb21iZXJnOnRjbG1lU1JT

which decodes to

Bloomberg:tclmeSRS

correctly using non-Ruby base64 decoders. Even in Ruby:

>> Base64.decode64 "Qmxvb21iZXJnOnRjbG1lU1JT"
=> "Bloomberg:tclmeSRS"

I don’t get it. Searching for a bugreport in Rails or something like that.

Edit: So it turns out our Apache httpd proxy adds something to the header:

Authorization: Basic Qmxvb21iZXJnOnRjbG1lU1JT, Basic

This leads to the incorrect characters at the end of the password, because:

>> Base64.decode64('Basic Qmxvb21iZXJnOnRjbG1lU1JT, Basic'.split(' ', 2).last || '')
=> "Bloomberg:tclmeSRS\005\253\""

The question is now – is this correct? Is it a bug in httpd or rails?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:57:13+00:00Added an answer on May 28, 2026 at 1:57 pm

    Rails user_name_and_password method makes a call to decode_credentials that performs the following, then splits using “:” :

    ::Base64.decode64(request.authorization.split(' ', 2).last || '')
    

    Applied to your data :

    ::Base64.decode64("Qmxvb21iZXJnOnRjbG1lU1JT".split(' ', 2).last || '').split(/:/, 2)
    => ["Bloomberg", "tclmeSRS"]
    

    Everything seems to be ok, the problem sits elsewhere IMO. To dump the authorization data from your controller :

    render :text => "Authorization: #{request.authorization}"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whilst reading through the book The well grounded Rubyist, I came across some strange
Trying to master Ruby (not rails yet). What book would you recommend reading next?
I want to dive into developing applications for the Mac and later also for
I'm trying to return an array of counted values for consecutive date ranges (that
I wanted to write a snippet of ruby that would take a string and
I'm at the point in learning Ruby where I'd like to look at some
So we have this web app where we support UTF8 data. Hooray UTF8. And
For the past few months i've had the feeling that i reached a boundry
Possible conflict with Rake extension maybe? md:~/Dropbox_not_syncd/webs/3/tdd/rubyists$ rake db:drop /home/durrantm/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/version.rb:4: warning: already initialized constant
A friend needs to do some R programming for her PhD and since I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.