Re: URL wierdness...

2003-06-04 Thread Jonathan Stowe
On Mon, 2 Jun 2003, Jody Belka wrote:

 IMAP HILLWAY\ said:
 
  Now... this works fine for almost every URL I can think of apart from 2:
  http://www.acxiom.co.uk  http://www.acxiom.com
  These 2 both return 500 Internal Server Error but work fine if you go
  to them with a browser!

 bit of checking and it seems that they're using the Accept-Language
 header, and don't imagine you might not send it. if you add that to the
 request (a simple en or en-us will do the trick) then things work
 properly. really bad form on their side of course.


As I suspected - if you were on the local machine you would have seen a
stack trace like:

[NullReferenceException]: Object reference not set to an instance of an
object.
   at LangTest.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\langtest\webform1.aspx.cs:line 24
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain()
[HttpUnhandledException]: Exception of type
System.Web.HttpUnhandledException was thrown.
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain()
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean
completedSynchronously)


They will be using the array returned by System.Web.Request.UserLanguages
without checking it.

This of course would be simply fixed with some code like:

   string bestlanguage = en-gb;
   string[] userLang = Request.UserLanguages;

  if ( userLang != null )
  {
 bestlanguage = userLang[0];
  }

  

If someone from the company concerned is reading my consulting rates are
reasonable ;-)

/J\







Re: URL wierdness...

2003-06-03 Thread Jody Belka
IMAP HILLWAY\ said:

 Now... this works fine for almost every URL I can think of apart from 2:
 http://www.acxiom.co.uk  http://www.acxiom.com
 These 2 both return 500 Internal Server Error but work fine if you go
 to them with a browser!

bit of checking and it seems that they're using the Accept-Language
header, and don't imagine you might not send it. if you add that to the
request (a simple en or en-us will do the trick) then things work
properly. really bad form on their side of course.

Jody





Re: URL wierdness...

2003-06-03 Thread Andy Williams \(IMAP HILLWAY\)

- Original Message - 
From: Jody Belka [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 02, 2003 2:29 PM
Subject: Re: URL wierdness...


 IMAP HILLWAY\ said:
 
  Now... this works fine for almost every URL I can think of apart from 2:
  http://www.acxiom.co.uk  http://www.acxiom.com
  These 2 both return 500 Internal Server Error but work fine if you go
  to them with a browser!

 bit of checking and it seems that they're using the Accept-Language
 header, and don't imagine you might not send it. if you add that to the
 request (a simple en or en-us will do the trick) then things work
 properly. really bad form on their side of course.

 Jody


Thanks Jody.

That did the trick new code is:

snip
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;

my $browser;
my $ua = new LWP::UserAgent;
$ua-agent('Mozilla/5.0');
$ua-timeout(15);
my $url = 'http://www.acxiom.co.uk';
my $req = new HTTP::Request;
my $res = $ua-request(GET $url, 'Accept-Language' = 'en');
/snip




Re: URL wierdness...

2003-05-30 Thread Andy Williams \(IMAP HILLWAY\)

- Original Message - 
From: Roger Burton West [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, May 30, 2003 9:24 AM
Subject: Re: URL wierdness...


 On Fri, May 30, 2003 at 09:16:25AM +0100, Andy Williams (IMAP HILLWAY)
wrote:

 Now... this works fine for almost every URL I can think of apart from 2:
 http://www.acxiom.co.uk  http://www.acxiom.com
 These 2 both return 500 Internal Server Error but work fine if you go
to
 them with a browser!

 Not with my browser (Dillo/0.7.1).

 Doesn't work even if I fake the user-agent to be IE5.

 Oh, what a surprise, they're running IIS.


Yes they are. but I don't have any trouble getting to other IIS sites!

This is very strange!

Andy




Re: URL wierdness...

2003-05-30 Thread Jonathan Stowe
On Fri, 30 May 2003, Roger Burton West wrote:

 On Fri, May 30, 2003 at 09:16:25AM +0100, Andy Williams (IMAP HILLWAY) wrote:

 Now... this works fine for almost every URL I can think of apart from 2:
 http://www.acxiom.co.uk  http://www.acxiom.com
 These 2 both return 500 Internal Server Error but work fine if you go to
 them with a browser!

 Not with my browser (Dillo/0.7.1).

 Doesn't work even if I fake the user-agent to be IE5.

 Oh, what a surprise, they're running IIS.


And worse ASP.Net, although the error is not directly to do with
approaching an ASP.Net as I have tested this with one of my own which
works fine (even with GET /PaymentReport/ HTTP/1,1^H ;-)  - I would
imagine they are doing something bad and evil with the
System.Web.HttpRequest and not catching the exception when something they
expect to be an object is actually null.

/J\