lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev Problem with Redirects


From: Leonid Pauzner
Subject: Re: lynx-dev Problem with Redirects
Date: Wed, 17 Nov 1999 14:16:53 +0300 (MSK)

17-Nov-99 03:24 Klaus Weide wrote:
> On Wed, 17 Nov 1999, Sean Lindsay wrote:

> I could reproduce this for the current development code, with

>         HTTP/1.1 303 See Other.
>         Date: Tue, 16 Nov 1999 19:07:31 GMT.
>         Server: Apache/1.3.6 (Unix) PHP/3.0.12.
>         Content-Location: headline.php3.
>         Vary: negotiate.
>         TCN: choice.
>         Location: http://www.foo.com.
>         Connection: close.
>         Content-Type: text/html.

> (which is what the URL below actually sends - the differences are
> insignificant for Lynx).

>> This header is being produced by a server-side PHP script (running on
>> Apache), which is sent the redirection URL as a search argument ("?url=").
>>
>> The script works fine in other browsers, however Lynx reports the "Location
>> URL is not absolute" error, then tries to load the file listed in the
>> Content-Location: header.
>>
>> A live example of this script in action can be found at:
>> http://www.disabilitytimes.com/go/headline?url=http://www.foo.com
>> (any URL can be substituted in the search argument)
> [...]
>> It would seem that the additional headers in the first example are causing
>> problems for Lynx. Unfortunately PHP does not have the ability to remove
>> headers from an Apache response, only to add them.
>>
>> Can anyone suggest what might be causing this problem, and how I might be
>> able to work around it?

> It's a real bug in Lynx.

Indeed. Lynx intermix Location: and Content-Location: fields (the first
should be absolute while the second could be either relative or absolute
and really informative for our needs - used by caching proxies only).

So, from user point of view, receiving the message "Location URL is not
absolute" usually results in a series of redirections which goes to the
madness (but we could got the same bad result without a message if the
Content-Location: happend to be absolute).
I saw this at www.microsoft.com but have not looked deep into details
assuming it's a Microsoft anti-lynx feature or like.


> Normally (in non-redirection responses), all headers are parsed the Right
> Way (in HTMIME.c).  But for redirections, the code uses a shortcut (in
> HTTP.c) that looks only for a few specific headers (Location:, Set-Cookie:,
> Set-Cookie2:).  This (for Location:) is the case in all Lynx versions back
> to at least 2.5 and 2.4-FM.  It's somewhat surprising that it hasn't caused
> known problems earlier.

Looking into the Lynx.trace (fragments attached below) I found out that
the responce header is not shown verbatim (none in the redirect case and
few lines otherwise, not all anyway), so it is not surprizing that we
have not got a report early since the Location: field is not visible
from trace.

> The shortcut code just scans a buffer (containing the response received)
> for an occurrence of the string "Location:" (in a case-insensitive way).
> It doesn't check whether that's at the beginning of a line, so your
> "Content-Location:" gets erroneously detected as a "Location:".

> So we have to fix the parsing in HTTP.c.

> As for workarounds (needed anyway for all the existing Lynx copies out
> there) - can you somehow suppress generation of the Content-Location
> header?  (I assume it is generated by Apache's "negotiation" module,
> as would be the 'TCN: choice'.)  Or can you somehow arrange for
> "Location:" to appear before "Content-Location:"?

> We might also have to ask the Apache developers to add yet another
> browser-specific workaround.  (There already is one for Lynx, listed
> in <http://www.apache.org/docs/misc/known_client_problems.html>.)

>    Klaus


Writing:
GET http://www.disabilitytimes.com/go/headline?url=http://www.foo.com HTTP/1.0
Host: www.disabilitytimes.com
Accept: text/html, text/plain, text/sgml, */*;q=0.01
Accept-Encoding: gzip, compress
Accept-Language: en,ru
Accept-Charset: windows-1251, *;q=0.5, iso-8859-1;q=0.01, us-ascii;q=0.01
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Lynx/2.8.3dev.14 libwww-FM/2.14
Referer: http://www.flora.org/lynx-dev/html/month1199/msg00370.html

----------------------------------
Sending HTTP request.
HTTP: WRITE delivered OK
HTTP request sent; waiting for response.
HTTP: Trying to read 1535
HTTP: Read 243
HTTP: Rx: HTTP/1.1 303 See Other
HTTP: Scanned 2 fields from line_buffer
--- Talking HTTP1.
HTTP/1.1 303 See Other
HTTP: Picked up location 'headline.php3'
HTAccess:  status=399
HTAccess: 'http://www.disabilitytimes.com/go/headline?url=http://www.foo.com' 
is a redirection URL.
HTAccess: Redirecting to 'headline.php3'
User message: Location URL is not absolute.
HTParse: aName:`headline.php3'
   
relatedName:`http://www.disabilitytimes.com/go/headline?url=http://www.foo.com'
HTParse: (Related-ABS)
HTParse:      result:http://www.disabilitytimes.com/go/headline.php3

getfile: getting http://www.disabilitytimes.com/go/headline.php3
...
Writing:
GET http://www.disabilitytimes.com/go/headline.php3 HTTP/1.0
Host: www.disabilitytimes.com
Accept: text/html, text/plain, text/sgml, */*;q=0.01
Accept-Encoding: gzip, compress
Accept-Language: en,ru
Accept-Charset: windows-1251, *;q=0.5, iso-8859-1;q=0.01, us-ascii;q=0.01
User-Agent: Lynx/2.8.3dev.14 libwww-FM/2.14
Referer: http://www.flora.org/lynx-dev/html/month1199/msg00370.html

----------------------------------
Sending HTTP request.
HTTP: WRITE delivered OK
HTTP request sent; waiting for response.
HTTP: Trying to read 1535
HTTP: Read 100
Read 100 bytes of data.
HTTP: Rx: HTTP/1.1 302 Found
HTTP: Scanned 2 fields from line_buffer
--- Talking HTTP1.
ation: http://www.disabilitytimes.com/
Connection: close
Content-Type: text/html



HTTP: Picked up location 'http://www.disabilitytimes.com/'
HTAccess:  status=399
HTAccess: 'http://www.disabilitytimes.com/go/headline.php3' is a redirection 
URL.
HTAccess: Redirecting to 'http://www.disabilitytimes.com/'

getfile: getting http://www.disabilitytimes.com/
...
Writing:
GET http://www.disabilitytimes.com/ HTTP/1.0
Host: www.disabilitytimes.com
Accept: text/html, text/plain, text/sgml, */*;q=0.01
Accept-Encoding: gzip, compress
Accept-Language: en,ru
Accept-Charset: windows-1251, *;q=0.5, iso-8859-1;q=0.01, us-ascii;q=0.01
User-Agent: Lynx/2.8.3dev.14 libwww-FM/2.14
Referer: http://www.flora.org/lynx-dev/html/month1199/msg00370.html

----------------------------------
Sending HTTP request.
HTTP: WRITE delivered OK
HTTP request sent; waiting for response.
HTTP: Trying to read 1535
HTTP: Read 1535
HTTP: Rx: HTTP/1.1 200 OK
HTTP: Scanned 2 fields from line_buffer
--- Talking HTTP1.
HTTP/1.1 200 OK
HTFormat: Constructing stream stack for www/mime to www/present
HTFormat: Looking up presentation for www/mime to www/present
StreamStack: found weak wildcard match: www/present
FindPresentation: found exact match: www/mime
StreamStack: found exact match: www/mime
StreamStack: Returning "MIMEParser"
HTMIME:  Date: Tue, 16 Nov 1999 23:30:04 GMT
Server: Apache/1.3.6 (Unix) PHP/3.0.12
Last-Modified: Tue, 16 Nov 1999 05:33:09 GMT
ETag: "1a5004-1623-3830ec95"
Accept-Ranges: bytes
Content-Length: 5667
Connection: close
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" 
"http://www.w3.org/TR/REC-html40/loose.dtd";>
<!-- Header -->
...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]