Request.UserAgent OSX Safari Empty

 
Post new topic   Reply to topic    Aprelium Forum Index -> ASP.NET
View previous topic :: View next topic  
Author Message
aflynt
-


Joined: 08 Mar 2008
Posts: 8

PostPosted: Sat Mar 08, 2008 7:14 pm    Post subject: Request.UserAgent OSX Safari Empty Reply with quote

When using Safari 3.0.4 on Mac OSX 10.5.2, the HttpContext.Current.Request.UserAgent string is empty. Firefox 2.0.0.12 on OSX 10.5.2 reports the correct info, though. Running the same code under iis reports back the correct information.

Edit: I'd just like to add that the same behavior (empty user agent string) occurs in Opera 9.21 on OSX 10.5.2.
Back to top View user's profile Send private message
pkSML
-


Joined: 29 May 2006
Posts: 952
Location: Michigan, USA

PostPosted: Wed Mar 12, 2008 10:30 pm    Post subject: Reply with quote

I don't use Mac, but it might be a security feature???
_________________
Stephen
Need a LitlURL?


http://CodeBin.yi.org
Back to top View user's profile Send private message Visit poster's website
aflynt
-


Joined: 08 Mar 2008
Posts: 8

PostPosted: Tue Mar 18, 2008 8:17 pm    Post subject: Figured out why, but not how to fix Reply with quote

Hello,

I played around with requests with Wireshark to figure out what headers send by the web browser to Abyss cause the UserAgent to be empty, and I've narrowed it down to this:

If the web browser doesn't send the Host: header as the first header, the User Agent string will be empty.

Example:

Request that generates empty UserAgent string:
GET / HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.13
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: 10.255.253.14

Request that generates a non-empty UserAgent string:
GET / HTTP/1.1
Host: 10.255.253.14
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.13
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive

Since I have no control over how the Web browser orders headers, is there a way of fixing this issue in the web server itself?
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Mar 19, 2008 7:28 pm    Post subject: Re: Figured out why, but not how to fix Reply with quote

aflynt wrote:
Since I have no control over how the Web browser orders headers, is there a way of fixing this issue in the web server itself?


The problem is not Abyss Web Server here. The HTTP specification does not force any order on the headers. It is a bug in the client here and we suggest that you file a bug report and ask them to fix that.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
aflynt
-


Joined: 08 Mar 2008
Posts: 8

PostPosted: Wed Mar 19, 2008 7:37 pm    Post subject: Reporting bugs Reply with quote

Quote:
The problem is not Abyss Web Server here. The HTTP specification does not force any order on the headers. It is a bug in the client here and we suggest that you file a bug report and ask them to fix that.


Sorry. Does this mean that you believe it to be an issue with the Web Browser itself? I tested the above headers by telnetting into an Abyss web server on port 80 and entering that header info (presumably eliminating the Web Browser as a variable).

Thank you,
Aaron
Back to top View user's profile Send private message
aflynt
-


Joined: 08 Mar 2008
Posts: 8

PostPosted: Wed Mar 19, 2008 8:49 pm    Post subject: Test Case and bug reduction Reply with quote

I've reduced the bug to the following reproducible behavior:

1. Install the AbyssWeb server X1 and configure a site on it with ASP.NET 2.0 support.
2. Create a file with the following code and save it on the server as AbyssTest.aspx:

Code:

<%@ Page Language="C#" AutoEventWireup="true" title=Abyss Test" %>
<script language="c#" runat="server">
public void DisplayUserAgent()
{
   Response.Write(Request.UserAgent);
}
</script>
<html>
<head><title>Abyss Test</title></head>
<body>
<% DisplayUserAgent(); %>
</body>
</html>


3. From the command line telnet into the ip address and port of the Abyss Server you set up in step 1.
4. Enter the following headers into the command window replacing 10.255.253.16 with the server's ip address (press return twice at the end):

Code:

GET /AbyssTest.aspx HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.13
Host: 10.255.253.16


Expected behavior:
The output should be as follows:

Code:

HTTP/1.1 200 OK
X-AspNet-Version: 2.0.50727
Set-Cookie: ASP.NET_SessionId=dzznes55zbncel45zaewvdfo; path=/; HttpOnly
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 170
Connection: Close
Date: Wed, 19 Mar 2008 19:43:51 GMT
Server: Abyss/2.5.0.0-X1-Win32 AbyssLib/2.5.0.0


<html>
<head><title>Abyss Test</title></head>
<body>
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.13
</body>
</html>
Connection closed by foreign host.


Actual Behavior:
The output will actually be:
Code:

HTTP/1.1 200 OK
X-AspNet-Version: 2.0.50727
Set-Cookie: ASP.NET_SessionId=dzznes55zbncel45zaewvdfo; path=/; HttpOnly
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 170
Connection: Close
Date: Wed, 19 Mar 2008 19:43:51 GMT
Server: Abyss/2.5.0.0-X1-Win32 AbyssLib/2.5.0.0


<html>
<head><title>Abyss Test</title></head>
<body>

</body>
</html>
Connection closed by foreign host.


Changing the request text in step 4 to the following (ordering the Host: header first) produces the expected behavior:

Code:

GET /AbyssTest.aspx HTTP/1.1
Host: 10.255.253.16
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.13
Back to top View user's profile Send private message
aflynt
-


Joined: 08 Mar 2008
Posts: 8

PostPosted: Wed Mar 19, 2008 9:50 pm    Post subject: It's a bug in the ASP.NET hosting process Reply with quote

I've found this post in your bug reports forum that isolates the issue:

http://www.aprelium.com/forum/viewtopic.php?t=12670

The problem is that the ASP.NET hosting process ignores the first header whatever it may be. Apparently, IIS works around the problem somehow. Would it be possible for you guys to add a fake dummy header as the first header when there is a request for and ASP.NET page as a workaround for the issue?

This issue is a big deal for us since we need to sniff the User Agent server side to enable/disable specific functionality.

Thanks,
Aaron
Back to top View user's profile Send private message
rrinc
-


Joined: 24 Feb 2006
Posts: 725
Location: Arkansas, USA

PostPosted: Wed Mar 19, 2008 10:57 pm    Post subject: Re: It's a bug in the ASP.NET hosting process Reply with quote

aflynt wrote:
This issue is a big deal for us since we need to sniff the User Agent server side to enable/disable specific functionality.

Thanks,
Aaron
Not that this problem shouldn't be addressed, but have you considered modifying your website to work with all browsers from a single code base instead of having multiple versions? Not all browsers work exactly the same but as a web designer, I can usually find a suitable cross-browser solution to most problems.
_________________
-Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados.
Back to top View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
aflynt
-


Joined: 08 Mar 2008
Posts: 8

PostPosted: Wed Mar 19, 2008 11:14 pm    Post subject: RE: Different browsers Reply with quote

Quote:
Not that this problem shouldn't be addressed, but have you considered modifying your website to work with all browsers from a single code base instead of having multiple versions?


Yes. Differing (or missing) implementations of contentEditable/designMode make it necessary for us to detect the browser's UserAgent.[/quote]
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Apr 18, 2008 4:43 pm    Post subject: Re: RE: Different browsers Reply with quote

The problem was fixed and it was caused by the ASP.NET connector "eating" the first header. The new version will contain the fix but if someone needs it urgently, please contact us and we'll send it to you.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
googlymoogly
-


Joined: 05 Apr 2008
Posts: 5

PostPosted: Sun Apr 20, 2008 11:41 pm    Post subject: Reply with quote

It must be the same issue as I have: http://www.aprelium.com/forum/viewtopic.php?t=15122&sid=db554a1ce20c4a161fdf23cc7e35f0c0

I ran a similar test and Firefox sends the "Host" attribute first in the header just like in the original poster's test case, and the ASP.NET host gets a blank User-Agent header, thus breaking all ASP.NET apps using Firefox as client.

Very crazy-odd that it worked a couple of times first however.

What's the expected timeframe on the fix, if I may ask?
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Apr 21, 2008 4:53 pm    Post subject: Reply with quote

googlymoogly wrote:
What's the expected timeframe on the fix, if I may ask?


Please contact support@aprelium.com and we'll send you the updated ASP.NET connector.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> ASP.NET All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group