httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject cvs commit: httpd-apreq/c apache_request.c
Date Fri, 08 Jun 2001 22:20:41 GMT
joes        01/06/08 15:20:40

  Modified:    Request  Request.xs
               c        apache_request.c
  Log:
  Submitted by:	Randy Kobes
  
  More Win32 binmode fixes. Also testing new PerlIO_importFILE defines for
  PERL_IMPICIT_SYS builds.
  
  Revision  Changes    Path
  1.17      +29 -12    httpd-apreq/Request/Request.xs
  
  Index: Request.xs
  ===================================================================
  RCS file: /home/cvs/httpd-apreq/Request/Request.xs,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Request.xs	2001/06/04 17:16:42	1.16
  +++ Request.xs	2001/06/08 22:20:38	1.17
  @@ -93,21 +93,38 @@
   #define ApacheUpload_next(upload)     upload->next
   #define ApacheUpload_tempname(upload) upload->tempname
   
  -#ifndef PerlLIO_dup
  -#define PerlLIO_dup(fd)   dup((fd)) 
  -#endif
  -#ifndef PerlLIO_close
  -#define PerlLIO_close(fd) close((fd)) 
  -#endif
   
   #ifdef PerlIO
   typedef PerlIO * InputStream;
  -#else
  -typedef FILE * InputStream;
  -#define PerlIO_importFILE(fp,flags) fp
  -#define PerlIO_write(a,b,c)  fwrite((b),1,(c),(a))
  +
  +#ifndef PerlIO_importFILE
  +#define PerlIO_importFILE(fp,flags)	(PerlIO*)fp
   #endif
   
  +#ifdef SFIO
  +#undef PerlIO_importFILE
  +#define PerlIO_importFILE(fp,flags) 	(PerlIO*)fp
  +#endif /*SFIO*/
  +
  +#else /*PerlIO not defined*/
  +
  +typedef FILE * InputStream;
  +#define PerlIO_importFILE(fp,flags) 	fp
  +#define PerlIO_write(a,b,c)  		fwrite((b),1,(c),(a))
  +
  +#endif /*PerlIO*/
  +
  +/* PerlLIO stuff that does not belong, but might be needed anyway
  + *
  + *#define PerlLIO_dup(f)   		dup((f)) 
  + *#define PerlLIO_close(f) 		close((f)) 
  + *#define PerlLIO_fileno(f) 		fileno((f)) 
  + *#define PerlLIO_fdopen(f) 		fdopen((f)) 
  + *#define PerlLIO_seek(f) 		seek((f)) 
  + *
  + */
  +
  +
   static char *r_keys[] = { "_r", "r", NULL };
   
   static SV *r_key_sv(SV *in)
  @@ -192,7 +209,7 @@
       	LEAVE;
       }
   
  -    return SvTRUE(ERRSV) ? -1 : PerlIO_write(upload->fp, buf, len);
  +    return SvTRUE(ERRSV) ? -1 : PerlIO_write(PerlIO_importFILE(upload->fp,0), buf, len);
   }
   
   static void clear_hook(void *ptr) {
  @@ -474,7 +491,7 @@
       Apache::Upload upload
   
       CODE:
  -    if (  ( RETVAL = ApacheUpload_fh(upload) ) == NULL  )
  +    if (  ( RETVAL = PerlIO_importFILE(ApacheUpload_fh(upload),0) ) == NULL  )
   	    XSRETURN_UNDEF;
   
       OUTPUT:
  
  
  
  1.12      +5 -4      httpd-apreq/c/apache_request.c
  
  Index: apache_request.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq/c/apache_request.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- apache_request.c	2001/06/02 13:41:23	1.11
  +++ apache_request.c	2001/06/08 22:20:40	1.12
  @@ -328,9 +328,11 @@
       if( ap_pfclose(req->r->pool, upload->fp) )
   	ap_log_rerror(REQ_ERROR,
   		      "[libapreq] close error on '%s'", upload->tempname);	
  +#ifndef DEBUG
       if( remove(upload->tempname) )
   	ap_log_rerror(REQ_ERROR,
   		      "[libapreq] remove error on '%s'", upload->tempname);
  +#endif
   
       free(upload->tempname);
   }
  @@ -346,16 +348,15 @@
       while (--tries > 0) {
   	if ( (name = tempnam(req->temp_dir, prefix)) == NULL )
   	    continue;
  -	fd = ap_popenf(r->pool, name, O_CREAT|O_EXCL|O_RDWR, 0600);
  +	fd = ap_popenf(r->pool, name, O_CREAT|O_EXCL|O_RDWR|O_BINARY, 0600);
   	if ( fd >= 0 )
   	    break; /* success */
   	else
   	    free(name);
       }
       
  -    if ( tries == 0  || (fp = ap_pfdopen(r->pool, fd, "wb+") ) == NULL ) {
  -	ap_log_rerror(REQ_ERROR,
  -		      "[libapreq] could not open temp file '%s'", name); 	
  +    if ( tries == 0  || (fp = ap_pfdopen(r->pool, fd, "w+" "b") ) == NULL ) {
  +	ap_log_rerror(REQ_ERROR, "[libapreq] could not create/open temp file"); 	
   	if ( fd >= 0 ) { remove(name); free(name); }
   	return NULL;
       }
  
  
  

Mime
View raw message