Re: Squid proxy server..

From: Joseph Lin <joseph@dont-contact.us>
Date: Thu, 29 Jul 1999 13:50:45 -0700

Hi Niilo,

Thanks for your information and we also found out that we can
use noly writeBytes() but not writeChars(). After we made such
a correction/change, it works fine.

Thanks once agian,
    Joseph

Niilo Neuvo wrote:

> GET http://www.sun.com/index.html HTTP/1.0(newline)
> (newline)
>
> You should go to http://www.w3.org/ and start reading from there.
>
> "Joseph Lin" writes:
> >Hi all,
> >
> >Could you please provide us with some pointers? Thank you millions
> >in advance. We browsed FAQ and User's Guide on your web site
> >but couldn't find the right solution.
> >
> >We have Squid 2 proxy server installed and configured to work
> >behind a firewall. Currently we have a Java program which
> >make socket connection to the proxy server at port 8080.
> >We then tried to send Http client request to the proxy server,
> >such as:
> >
> >GET /index.html HTTP/1.0
> >Connection: Keep-Alive
> >Referer: http://www.sun.com
> >Accept: image/gif, image/jpeg, */*
> >
> >We are trying to read the http://www.sun.com/index.html
> >content from the following Java application, but always got the
> >following timeout error. We wonder how Netscape brower
> >sends Http client request to the squid proxy server so that the
> >squid proxy server will re-generating the Http client request to the
> >destination URL? Do we do something wrong? Or we send the
> >wrong Http client request? If that is the case, could you tell us what
> >the correct Http client requests are? How would one specify which
> >URL to look at from the sent Http client request to the proxy server?
> >
> >Thank you once again for any input.
> >
> >Regards,
> > Joseph
> >
> >Timeout error from Squid proxy server:
> >
> >HTTP/1.0 408 Request Time-out
> >Server: Squid/2.0 RELEASE
> >....
> ><H2>The requested URL could not be retrieved</H2>
> ><HR>
> ><P>
> >While trying to retrieve the URL:
> ><A HRER="N/A">N/A</A>
> ><P>
> >......
> >
> >
> >Program:
> >
> >import java.io.*;
> >import java.net.*;
> >import java.security.*;
> >
> >public class Http
> >{
> > public static void main(String args[]) {
> > Socket socket = null;
> > DataOutputStream dos = null;
> > BufferedReader br = null;
> >
> > try {
> > // make connection to the proxy server
> > socket = new Socket("ssa.tibco.com", 8080);
> > System.out.println("Socket connection succeed");
> > System.out.flush();
> >
> > // open the input and out stream
> > InputStream is = socket.getInputStream();
> > OutputStream os = socket.getOutputStream();
> > br = new BufferedReader(new InputStreamReader(is));
> > dos = new DataOutputStream(new BufferedOutputStream(os));
> > System.out.println("Input and Output stream opened");
> > System.out.flush();
> >
> > // send the http client request
> > String request = "GET /index.html HTTP/1.0\n" +
> > "Host: www.sun.com\n" +
> > "Connection: Keep-Alive\n" +
> > "Referer: http://www.sun.com\n" +
> > "Accept: image/gif, image/jpeg, */*\n" +
> > "\n\n";
> > dos.writeChars(request);
> > dos.flush();
> > System.out.println("Send request");
> > System.out.flush();
> >
> > String retVal;
> > while (true) {
> > if ((retVal = br.readLine()) == null) {
> > break;
> > }
> > System.out.println(retVal);
> > }
> > br.close();
> > dos.close();
> > socket.close();
> > } catch (Exception ex) {
> > ex.printStackTrace();
> > }
> > }
> >}
> >
> >
Received on Tue Jul 29 2003 - 13:15:59 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:16 MST