httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@en.muc.de (Ralf S. Engelschall)
Subject Re: FastCGI + Linux + Apache 1.1?
Date Sun, 12 May 1996 14:13:18 GMT
Hello rasmus@madhaus.utcs.utoronto.ca, in a previous mail you wrote:

> I applied the buff patches to the May 10 version of the FastCGI Apache 
> module.  Had a look at the patch.  Looks like it is doing the right
> thing.  However, the module itself goes splat on an assertion.  I am running
> the latest from-cvs snapshot, Linux 1.3.100, libc 1.3.12 and gcc-2.7.2.
> I'll have a look at the code when I am a bit more awake, but I was wondering
> if anybody here has gotten this to work.
> 
> Here is the core dump:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x805f93c in BufferCheck (bufPtr=0x80f6000) at mod_fastcgi.c:816
> 816         ASSERT(bufPtr->size > 0);
> (gdb) bt
> [...]
> 
> bufPtr in the above is bogus.  

Yes, I discovered that point, too. But after a correct Server Config setup it
didn't any more occur. Hmmm... I didn't have a deeper look at this problem.

I currently got the May 10 version of mod_fastcgi.c from www.fastcgi.com,
too. I applied my old patches and saw that two trivial patch-parts were
rejected. That's no problem. I've ignored the first (only a comment) and
incorporated the second manually. Below is a patch for the mod_rewrite.c
(V1.1 as of May 10) which works fine under 1.1b2 except for two things:
   1. the problem above
   2. when I reference a bad .fcgi file (one that doesn't exist) then
      the server dumps core, too.

Any ideas?
                                        Ralf S. Engelschall    
                                        rse@en.muc.de
                                        http://www.muc.de/~rse
=====
*** mod_fastcgi.c-1.1	Sun May 12 15:58:13 1996
--- mod_fastcgi.c-1.1-patched	Sun May 12 16:04:59 1996
***************
*** 10,15 ****
--- 10,18 ----
   *
   */
  
+ /* #define APACHEVERSION 10 */
+ #define APACHEVERSION 11
+ 
  #include <stdio.h>
  #include <unistd.h>
  #include <fcntl.h>
***************
*** 44,55 ****
--- 47,66 ----
  char * translateName(WS_Request *r, char *uri, char *fullpath);
  void add_cgi_vars(WS_Request *r);
  void timeout(int);
+ #if (APACHEVERSION < 11)
  int GetFromStream(FILE *fp, char *buf, int len);
+ #else
+ int GetFromStream(BUFF *bp, char *buf, int len);
+ #endif
  #define WS_TimeOut(x)  timeout(x)
  #define HostInfo(x) x->server
  #define HostName(x) x->server->server_hostname
  #define HostPort(x) x->server->port
+ #ifdef __FreeBSD__
+ jmp_buf jmp_env;
+ #else
  sigjmp_buf jmp_env;
+ #endif
  int initOnce = 1;
  /*------------------------------------------------------------*/
  #define FCGI_MAGIC_TYPE "application/x-httpd-fcgi"
***************
*** 2273,2279 ****
  
      if (nFirst) {
        char szBuf[SERVER_BUFSIZE];
!       nBytes=GetFromStream(reqPtr->connection->request_in, szBuf,SERVER_BUFSIZE);
        if (nBytes > 0) {
  	BufferAddData(infoPtr->reqInbufPtr, szBuf, nBytes);
  	ClientToCgiBuffer(infoPtr);
--- 2284,2294 ----
  
      if (nFirst) {
        char szBuf[SERVER_BUFSIZE];
! #if (APACHEVERSION < 11)
! 	  nBytes=GetFromStream(reqPtr->connection->request_in, szBuf,SERVER_BUFSIZE);
! #else
!       nBytes=GetFromStream(reqPtr->connection->client, szBuf,SERVER_BUFSIZE);
! #endif
        if (nBytes > 0) {
  	BufferAddData(infoPtr->reqInbufPtr, szBuf, nBytes);
  	ClientToCgiBuffer(infoPtr);
***************
*** 3321,3331 ****
--- 3336,3356 ----
  
  void PrepareClientSocket(WS_Request *reqPtr, int *csdIn, int *csdOut)
  {
+ #if (APACHEVERSION <11)
    fflush(reqPtr->connection->client);
    *csdIn = fileno (reqPtr->connection->request_in);
    *csdOut = fileno (reqPtr->connection->client);
+ #else
+   bflush(reqPtr->connection->client);
+   *csdOut = reqPtr->connection->client->fd;
+   if (reqPtr->connection->client->fd_in != reqPtr->connection->client->fd)
+       *csdIn = reqPtr->connection->client->fd_in;
+   else
+       *csdIn = reqPtr->connection->client->fd;
+ #endif
  }
  
+ #if (APACHEVERSION < 11)
  int GetFromStream(FILE *fp, char *buf, int len)
  {
    int fp_size;
***************
*** 3338,3343 ****
--- 3363,3382 ----
    }
    return fp_size;
  }
+ #else
+ int GetFromStream(BUFF *bp, char *buf, int len)
+ {
+   int bp_size;
+   bp_size = bp->incnt;
+   if (bp_size > len)
+     bp_size = len;
+   if (bp_size > 0) {
+     bread(bp, buf, bp_size);
+   }
+   return bp_size;
+ }
+ #endif
+ 
  void MakeExtraEnvStr(WS_Request *reqPtr)
  {
    table_set(reqPtr->subprocess_env,"SERVER_HOSTNAME",reqPtr->server->server_hostname);
=====

Mime
View raw message