[SQU] ERR_LIFETIME_EXP

From: Satish Chandra KIlaru <kilaru@dont-contact.us>
Date: Thu, 07 Sep 2000 11:49:25 -0700

Hi All

I have written one client program to access SQUID.

My 'connect' call is returning 0.

I'm sending the following message to squid

GET http://www.yahoo.com HTTP/1.0
ACCEPT: */*

write is returning the proper number of bytes.

When I read the data from SQUID, I'm getting the 408 error.

If any one knows how to solve it please help me.

The client progrm that comes with SQUID s/w is also passing the same
request as I'm sending to SQUID.

I'm attaching my client program and the exact error message.

Thank you

Bye
Kilaru

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>

main(int argc, char *argv[])
{
   int sockfd,ret_val,newsockfd,childpid,clilen;
   long no_of_bytes;
   struct sockaddr_in serv_addr, cli_addr;
   char data[200],*method;
   char data1[10000];
   int writen(int fd,char *data,int size);
   int readn(register int fd, register char *ptr, register int nbytes);
// static int client_comm_connect(int, char *, u_short );
   int optval = 1,optlen = 2;

   if (argc < 2)
   { printf(" Invalid no of parameters.");
      exit(1);
   }
   bzero((char *) &serv_addr, sizeof(serv_addr));

   //Server Address.
   serv_addr.sin_family = AF_INET;
   serv_addr.sin_port = htons(3128);//This is the port no used by SQUID.
   inet_pton(AF_INET,argv[1],&serv_addr.sin_addr);

   sockfd = socket(AF_INET, SOCK_STREAM,0);
   printf("\nSockfd %d:\n",sockfd);

   setsockopt(sockfd,SOL_SOCKET,SO_DEBUG,10,sizeof(int)
   ret_val = connect(sockfd, (struct sockaddr *) &serv_addr,sizeof(serv_addr));
   printf("errno: %d\n ",errno);

   if (ret_val < 0)
   {
      printf("Connect Failed: %d",ret_val);
      exit(1);
   }
   else if (sockfd > 0)
   {
     
     method = "GET";
     snprintf(data,200,"%s %s HTTP/1.0 \nAccept: */*\r\n",method,argv[2]);

     printf("\nThe Msg is: %s\n",data);

     no_of_bytes = writen(sockfd,data,sizeof(data));
     printf("\nThe Msg is: %s\n",data);
     no_of_bytes = writen(sockfd,data,sizeof(data));
     if ( no_of_bytes < 0)
        printf("Write Failed");
     else if (no_of_bytes < sizeof(data))
        printf("write failed : less data written");

     fflush(stdout);

     
     if ((no_of_bytes = read(sockfd,data1,9999)) < 0)
        { printf("Read Failed in MAIN");}
     printf("Returned String: %s",data1);

     (void) close(sockfd);
   }
}

int writen(int fd,char *data,int size)
{
   return (write(fd,data,size));
}
int readn(register int fd, register char *ptr, register int nbytes)
{
        int nleft, nread;
        
        nleft = nbytes;
        while(nleft > 0)
        {
                nread = read (fd, ptr, nleft);
                if (nread < 0)
                { printf("Read Failed in readn");
                        fflush(stdout);
                        return (nread); /*Error, Return < 0 */
                }
                else if (nread == 0)
                        break; /* End of File */

                nleft -= nread;
                ptr += nread;
        }
        return (nbytes - nleft); /*Return >= 0 */
}

HTTP/1.0 408 Request Time-out Server: Squid/2.3.STABLE4 Mime-Version: 1.0 Date: Thu, 07 Sep 2000 00:03:37 GMT Content-Type: text/html Content-Length: 633 Expires: Thu, 07 Sep 2000 00:03:37 GMT X-Squid-Error: ERR_LIFETIME_EXP 0 ERROR: The requested URL could not be retrieved

ERROR

The requested URL could not be retrieved


While trying to retrieve the URL: N/A

The following error was encountered:

Squid has terminated the request because it has exceeded the maximum connection lifetime.

Your cache administrator is webmaster.


Generated Thu, 07 Sep 2000 00:03:37 GMT by india6.netcontinuum.com (Squid/2.3.STABLE4)

--
To unsubscribe, see http://www.squid-cache.org/mailing-lists.html
Received on Thu Sep 07 2000 - 00:19:41 MDT

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