Dear All
I have a simple application that starts by sending a post to an IIS
Server with user name and password information.
Incredibly it works fine when the ruby application is run in windows,
but when run from linux the IIS server receives an empty user name and
password.
Any idea why this could be and if it is necessary to do any special
configuration from linux?
Thanks !
Test client
require ‘net/http’
begin
http = Net::HTTP.new(“192.168.101.18”,80)
POST request -> logging in
user = ARGV[0]
password = ARGV[1]
puts "Logging in as #{ARGV[0]} "
user_data = “us=#{user}&pw=#{password}”
resp = http.post(’/ca_equipos/app_cliente/acceso_app.aspx’, user_data)
puts "Logging in as #{ARGV[0]} "
user_data = “us=#{user}&pw=#{password}”
resp = http.post(’/ca_equipos/app_cliente/acceso_app.aspx’, user_data)
Just a thought, but Windows can be a little bit funny when it comes to
ARGV. It does separation differently to other shells. It might be
worthwhile checking that ARGV[0] and ARGV[1] are actually what you think
they are on each platform…
Just a thought, but Windows can be a little bit funny when it comes to
ARGV. It does separation differently to other shells. It might be
worthwhile checking that ARGV[0] and ARGV[1] are actually what you think
they are on each platform…
Very good point. I develop on WinXP, and need to watch for how the
shell interprets certain characters (’&’ comes to mind) and the
inclusion of newline characters.
Might be good to write some cleanser/sanity-check helper methods to
manage input.
Even a simple logging of ARGV.inspect can be quite informative.
I’ve just done a test with ethereal, to see what was actually been
posted to the server, and indeed there is a problem:
In windows the post is correct, but in linux the values of username and
password have a space in the middle !?
As you can see in the second block, instead of having mds2 i have mds 2
!
However when i execute step by step (in komodo), or print, i can see
that ARGV[0] or ARGV[1] are correct i have indeed mds2.
There’s not a space in the middle of the data; ethereal just prints a
space between the first eight bytes and the last eight bytes so that
you can line it up more easily with the hex dump on the left - see the
double space in the middle of the hex dump?
A real space would be identified by a “20” in the hex dump.
However, I’m really surprised that you’re seeing something different
at all on windows vs. linux. Can you post the same portions of the
network trace from the windows machine? When I try your test http
client program here, I get the same behavior as what you posted in the
network trace from both windows and linux. (both running ruby 1.8.4)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.