need help in updating a website using perl script.



Hi All,
I am not sure if this is the right place to post this problem or
not...But believe me this is my first time posting to this group.

I am trying to write a perl script to update a protected bugzilla
database and have gone through many such topics in google groups, and
got a lot of helpful hints. I am using the POST method from the
"http::request" for the same following is the code snippet that I have
developped for the same:

>Code Snippet<


my $url="http://path to bugzilla/process_bug.cgi?id=bugid";
my $ua = LWP::UserAgent->new;
my $req; #Request
my $res; #Response
my $username = 'username';
#(Username for the protected website as the bugzilla directory on the
server is also protected)
my $password = 'password';

$req = new HTTP::Request 'POST' , $url;
$req->content_type('application/x-www-form-urlencoded');
$req->authorization_basic($username, $password);
$res = $ua->request($req);
if ($res->is_success) {
print $res->content;
}
else {
print "fail\n";
}


>Snippet<


My questions are as follows:

1) Bugzilla program is also password protected can I authenticate the
bugzilla database using the $req->content(key = value) method?

2) I get the following error when I run this perl script:


>Snippet<
fail
_protocolHTTP/1.0_requestHTTP::Request=HASH(0x1835384)_headersHTTP::Headers=HASH(0x21fc6b4)_msgLength
Required_rc411_content<!DOCT
YPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd";>
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-1">
<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
<STYLE
type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The requested URL could not be retrieved</H2>
<HR noshade size="1px">
<P>
While trying to process the request:
<PRE>
POST /path to bugzilla HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Authorization: Basic OTE2ODk1Om1hazExMzQubWo=
Host: Host on which bugzilla reside
User-Agent: libwww-perl/5.64
Content-Type: application/x-www-form-urlencoded

</PRE>
<P>
The following error was encountered:
<UL>
<LI>
<STRONG>
Invalid Request
</STRONG>
</UL>

<P>
Some aspect of the HTTP Request is invalid. Possible problems:
<UL>
<LI>Missing or unknown request method
<LI>Missing URL
<LI>Missing HTTP Identifier (HTTP/1.0)
<LI>Request is too large
<LI>Content-Length missing for POST or PUT requests
<LI>Illegal character in hostname; underscores are not allowed
</UL>
<P>Your cache administrator is <A HREF="mailto:root";>root</A>.

>SNIPPETt<



But intrestingly when I change the POST method to a GET method I can
sucessfully run through the page.
Am I missing on some basic thing for the POST method to be executed
sucessfully?

PS: My bugzilla server is behinde a squid redirector.

Any help would be appriciated in this regards.

Thanking in anticipation,
Abbas.

.



Relevant Pages

  • http request using fsockopen
    ... On the start of page B I check var $foo. ... Sending the POST data also though the POST method. ... I manually create a HTTP request to page C and use the fsockopen method to ...
    (php.general)
  • http request using fsockopen
    ... On the start of page B I check var $foo. ... Sending the POST data also though the POST method. ... I manually create a HTTP request to page C and use the fsockopen method to ...
    (alt.php)
  • Re: DejaVu fonts - Not 108% - Feedback.
    ... I really don't want to sign up for this bugzilla, I'm just too busy, but they did request this image from gnome-termonal, so if you could post that via your account. ... Nicolas Mailhot wrote: ...
    (Fedora)
  • Re: http request using fsockopen
    ... Sending the POST data also though the POST method. ... > I manually create a HTTP request to page C and use the fsockopen method to ... All other PHP scripts in page C is executed as expected though. ...
    (alt.php)
  • Re: LWP UserAgent form post problem
    ... > following link in my browser: ... You're using the POST method there (parameters sent as part of the request ... It's very likely that the server-side process you're trying to ...
    (comp.lang.perl.modules)