My question is how do I get LWP useragent to act like a browser and find the default page in a directory?
It has nothing to do with your browser, and everything to do with your web server. I tested your example on a site I had control of (running apache). Here's what happened:
[jon@valium jon]$ telnet divisionbyzero.com 80
Connected to divisionbyzero.com.
Escape character is '^]'.
GET /decss HTTP/1.0
HTTP/1.1 301 Moved Permanently
Date: Tue, 19 Feb 2002 02:47:50 GMT
Server: Apache/1.3.22 (Unix) (Red-Hat/Linux) mod_ssl/2.8.5 OpenSSL/0.
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<TITLE>301 Moved Permanently</TITLE>
The document has moved <A HREF="http://www.divisionbyzero.com/decss/">
<ADDRESS>Apache/1.3.22 Server at www.divisionbyzero.com Port 80</ADDRE
Connection closed by foreign host.
The web server sent me a 301 since /decss
wasn't an actual file, but rather, a directory. My web browser followed that redirect automatically, which is what browsers are supposed to do when the http method used is GET
. I suspect your troubles are caused because you are using the POST
method, which is explicitly forbidden
to redirect you without notifying the user.
: This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.