ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/thttpd/libhttpd.c
(Generate patch)

Comparing thttpd/libhttpd.c (file contents):
Revision 1.1.6.1 by root, Mon Jun 18 21:38:45 2001 UTC vs.
Revision 1.1.6.2 by root, Mon Jun 25 02:23:00 2001 UTC

1701 hc->init_byte_loc = 0; 1701 hc->init_byte_loc = 0;
1702 hc->end_byte_loc = -1; 1702 hc->end_byte_loc = -1;
1703 hc->keep_alive = 0; 1703 hc->keep_alive = 0;
1704 hc->should_linger = 0; 1704 hc->should_linger = 0;
1705 hc->file_address = (char*) 0; 1705 hc->file_address = (char*) 0;
1706#ifdef MMAP_MAX
1706 hc->file_fd = -1; 1707 hc->file_fd = -1;
1708 hc->write_buf = (char*) 0;
1709#endif
1707 return GC_OK; 1710 return GC_OK;
1708 } 1711 }
1709 1712
1710 1713
1711/* Checks hc->read_buf to see whether a complete request has been read so far; 1714/* Checks hc->read_buf to see whether a complete request has been read so far;
2352void 2355void
2353httpd_close_conn( httpd_conn* hc, struct timeval* nowP ) 2356httpd_close_conn( httpd_conn* hc, struct timeval* nowP )
2354 { 2357 {
2355 make_log_entry( hc, nowP ); 2358 make_log_entry( hc, nowP );
2356 2359
2360#ifdef MMAP_MAX
2361 if ( hc->file_fd >= 0)
2362 {
2363 (void) close( hc->file_fd );
2364 hc->file_fd = -1;
2365 }
2366 if ( hc->write_buf )
2367 (void) free (hc->write_buf);
2368#endif
2357 if ( hc->file_address != (char*) 0 ) 2369 if ( hc->file_address != (char*) 0 )
2358 { 2370 {
2359 mmc_unmap( hc->file_address, &(hc->sb), nowP ); 2371 mmc_unmap( hc->file_address, &(hc->sb), nowP );
2360 hc->file_address = (char*) 0; 2372 hc->file_address = (char*) 0;
2361 } 2373 }
3610 hc, 304, err304title, hc->encodings, "", hc->type, hc->sb.st_size, 3622 hc, 304, err304title, hc->encodings, "", hc->type, hc->sb.st_size,
3611 hc->sb.st_mtime ); 3623 hc->sb.st_mtime );
3612 } 3624 }
3613 else 3625 else
3614 { 3626 {
3627#ifdef MMAP_MAX
3628 if ( hc->sb.st_size < MMAP_MAX)
3629#endif
3615 hc->file_address = mmc_map( hc->expnfilename, &(hc->sb), nowP ); 3630 hc->file_address = mmc_map( hc->expnfilename, &(hc->sb), nowP );
3616 if ( hc->file_address == (char*) 0 ) 3631 if ( hc->file_address == (char*) 0 )
3617 { 3632 {
3633#ifdef MMAP_MAX
3634 hc->file_fd = open ( hc->expnfilename, O_RDONLY);
3635 hc->write_buf = malloc (WRITE_BUFFER);
3636 hc->write_ofs = WRITE_BUFFER;
3637 if ( hc->file_fd < 0 || !hc->write_buf )
3638#endif
3639 {
3618 httpd_send_err( hc, 500, err500title, "", err500form, hc->encodedurl ); 3640 httpd_send_err( hc, 500, err500title, "", err500form, hc->encodedurl );
3619 return -1; 3641 return -1;
3642 }
3620 } 3643 }
3621 send_mime( 3644 send_mime(
3622 hc, 200, ok200title, hc->encodings, "", hc->type, hc->sb.st_size, 3645 hc, 200, ok200title, hc->encodings, "", hc->type, hc->sb.st_size,
3623 hc->sb.st_mtime ); 3646 hc->sb.st_mtime );
3624 } 3647 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines