Perl and IIS6 = Almost Working. HELP!

Open discussion about any topic, as long as you abide by the rules of course!
Post Reply
User avatar
raw
Posts: 2738
Joined: Tue Nov 16, 1999 8:00 am

Perl and IIS6 = Almost Working. HELP!

Post by raw »

I have a perl site which is running on a Red Hat server here just fine but I'm consolidating our web servers here and some of our apps are .NET so I have to find a way to port our linux web apps over which isn't so bad since all of it is 'supposedly' supported on Windows as well.

Anyways, I have most of the site working and I checked the code (which works in Linux) but when I call an action it gets ignored and just shoots me to the default page instead of the specified one based off my URL input. Below is a code example

Code: Select all

if ($in{'action'} eq "loadnav" { &display_content }
Any one of these specific actions that gets requested in the URL gets ignored. Has anyone seen this in a Windows environment before? I've searched online and found nothing worth a shit.
Last edited by raw on Fri Jan 13, 2006 4:34 am, edited 5 times in total.
User avatar
plained
Posts: 16366
Joined: Thu Jun 13, 2002 7:00 am

Post by plained »

naa i doen know man :(

but i wrote a story


raw went fishing and had a time the end

you like?
diego
Posts: 1379
Joined: Mon Jan 24, 2005 12:25 pm

Post by diego »

I don't really understand the problem: Whenever You submit an action, it refers You to a default-page, right?
User avatar
raw
Posts: 2738
Joined: Tue Nov 16, 1999 8:00 am

Post by raw »

Ok, remember the old Q3W URL? http://www.quake3world.com/cgi-bin/Ulti ... tion=intro

Because the action was intro it did a specific function based on the URL input.

Well, I'm doing the same thing but it's ignoring it and just loading the default page the CGI loads. IF that makes sense....
R00k
Posts: 15188
Joined: Mon Dec 18, 2000 8:00 am

Post by R00k »

I've been putting off learning perl, but I know I'm going to have to one of these days. :smirk:
User avatar
plained
Posts: 16366
Joined: Thu Jun 13, 2002 7:00 am

Post by plained »

ok raw i went and thouroly read your reply

i doen see the story mentioned.

what imi missing?
dmmh
Posts: 2501
Joined: Thu Jan 04, 2001 8:00 am

Post by dmmh »

so your webserver doesnt seem to handle GET requests properly aight?

I think you will find loads of awesome help here:

http://www.webmasterworld.com/forum13/

by far a better place to ask, awesome ppl, just dont post any links to your site as thats seen as advertising

webmasterworld is the place all pro's flock together, I am also there (not that I consider myself a pro), so maybe post there for additional help?
[i]And shepherds we shall be, for thee my Lord for thee, Power hath descended forth from thy hand, that our feet may swiftly carry out thy command, we shall flow a river forth to thee, and teeming with souls shall it ever be. In nomine patris, et fili, et spiritus sancti.[/i]
Tormentius
Posts: 4108
Joined: Sat Dec 14, 2002 8:00 am

Post by Tormentius »

R00k wrote:I've been putting off learning perl, but I know I'm going to have to one of these days. :smirk:
Likewise.
User avatar
raw
Posts: 2738
Joined: Tue Nov 16, 1999 8:00 am

Post by raw »

I actually like Perl. It's quite simple.

On a side note, I wrote some small test code to test the functionality and eliminate the application and the problem still exists which tells me it is a Perl running on IIS problem. Hopefully it's just a setting.
User avatar
raw
Posts: 2738
Joined: Tue Nov 16, 1999 8:00 am

Post by raw »

riddla wrote:I seem to recall reading somewhere there are some perl functions which simply dont work on an IIS install. Perhaps you found one of them...
This will totally suck if this is the case.
User avatar
raw
Posts: 2738
Joined: Tue Nov 16, 1999 8:00 am

Post by raw »

Nope, I got all of that.
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

1. Where is %in set and to what?
2. Try doing $in{'action'} =~ /^action/i instead of eq.
3. Post the source.
Seg
Posts: 34
Joined: Thu Jun 29, 2000 7:00 am

Post by Seg »

You could also try defining the literal to a string before the compare. They may perform string compares differently from Linux to Windows.
$dummy = "loadnav"
if $in('action') eq $dummy {}
User avatar
raw
Posts: 2738
Joined: Tue Nov 16, 1999 8:00 am

Post by raw »

I had a couple of kinks in my test script which I wrote today to test the basic functions of the server. This appears to be working now but for some reason that other app still isn't which I'm going to have to look into.

Here's the working code

Code: Select all

#!/usr/bin/perl -w

if (length ($ENV{'QUERY_STRING'}) > 0){
      $buffer = $ENV{'QUERY_STRING'};
      @pairs = split(/&/, $buffer);
      foreach $pair (@pairs){
           ($name, $value) = split(/=/, $pair);
           $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
           $in{$name} = $value;
     }
}

print "Content-type: text/html\n\n";

if ($in{'action'} eq "go") { print "<H1>GO ACTION</H1>\n"; }  
else { print "<H1>NO ACTION</H1>\n"; } 
Seg
Posts: 34
Joined: Thu Jun 29, 2000 7:00 am

Post by Seg »

if ($in{'action'} eq "loadnav" { &display_content } is also missing a ) after "loadnav".

if ($in{'action'} eq "loadnav") { &display_content }
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

Warning: Perl Nazism ahead.

1. *Always* use -T (tainting) in CGI scripts[1]
2. Use strict and scope your variables with "my"
3. Use mod CGI, don't reinvent the wheel

[1] Forces you to mark all user input "safe".

Code: Select all

#!/usr/bin/perl -Tw

use warnings FATAL => 'all';
use strict;
use CGI;

my $cgi = CGI->new;
print $cgi->header(-type => 'text/html');
print $cgi->h1($cgi->param('action') eq 'go' ? 'GO ACTION' : 'NO ACTION');
Post Reply