Matt,

>         I am trying use a servlet to automate posting to a perl
> script.

     This is unclear.  Are you trying to use an HttpUrl object to
actually do the POST to the perl script, or are you trying to use a
servlet to generate an HTML form that is targeted at the perl script?

> My tests run fine with normal CGI's such as ones like Yahoo and
> others using the Get method and some of my own using the Post
> method.  However when I try and post to a xxxx.pl web page I just
> get the Get response, not the Post which processes the information.
> I do not have control or access to the .pl file so I kind of have to
> work around it.

     Hm, how do you know it's the GET response?  I.e. what, precisely,
are you seeing when you try?

     If you're just getting the contents of the .pl file, then
something's out of whack at the server end.  Most servers require a
CGI script to be either located in a special directory (usually
cgi-bin), have a special file extension (usually .cgi) or listed in a
special config file (server specific).  Oh, you can also see a problem
if the script hasn't been made executable (chmod +x xxxx.pl).  Any of
these might result in the server simply returning the contents of the
file, instead of executing the file.

     Here's a simple test; build an HTML form in a static file,
pointed at the xxxx.pl script.  Load that page up in a browser, fill
in the values, and submit it.  See what happens.  If it doesn't work,
then the problem is on the server side.  If it works properly, then
the problem is in your servlet.  After that, the next thing I would
suggest is setting up a little proxy server and doing your post
through that, so you can observe specifically what the browser is
sending, and then repeat the experiment with the servlet.

     In fact, I recommend having such a proxy server (or in more
controlled environments where you don't have to worry about freaking
everybody out, a packet sniffer) in general, since it's always a good
idea to see exactly what your code is doing.

>         I am ending my streams with a \r\n.  Could this be the
> problem?  Is there a special syntax I should be trying rather than
> "A=B&C=D\r\n" ?
>
>         The inputs don't require any encoding and besides I tried
> this and it didn't fix the problem.

     Hm, one thought is that if you're doing it as a POST sent via a
URL objet from inside the servlet, you have to be careful in how you
send it.  I don't want to go into this level of detail here, but dig
up the HTTP spec and do a little reading.

Steven J. Owens
[EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to