Bug 43289 - XBitHack full g+x returns zero sized response on If-Modified-Since
Summary: XBitHack full g+x returns zero sized response on If-Modified-Since
Status: RESOLVED LATER
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_include (show other bugs)
Version: 2.2.4
Hardware: DEC other
: P2 minor (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL: http://www.google.com.my
Keywords: MassUpdate
Depends on:
Blocks:
 
Reported: 2007-09-02 15:02 UTC by Henrik Nordstrom
Modified: 2018-11-07 21:09 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Nordstrom 2007-09-02 15:02:54 UTC
XBitHack full with group execute bit set to enable If-Modified-Since only works
partially. While it adds the Last-Modified header correctly, subsequent requests
using If-Modified-Since results in an empty response (connection closed, no
response headers at all).

The access.log indicates a 304 response was sent however.. but none is sent to
the client.
Comment 1 Henrik Nordstrom 2007-09-02 15:04:13 UTC
strace of an request

accept(3, {sa_family=AF_INET, sin_port=htons(40506),
sin_addr=inet_addr("127.0.0.1")}, [16]) = 8
fcntl64(8, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(8, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
read(8, "GET / HTTP/1.0\r\nIf-Modified-Sinc"..., 8000) = 386
gettimeofday({1188770501, 263022}, NULL) = 0
stat64("/export/www/www.henriknordstrom.net/html/",
{st_mode=S_IFDIR|S_ISGID|0775, st_size=4096, ...}) = 0
open("/.htaccess", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/export/.htaccess", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or
directory)
open("/export/www/.htaccess", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or
directory)
open("/export/www/www.henriknordstrom.net/.htaccess", O_RDONLY|O_LARGEFILE) = -1
ENOENT (No such file or directory)
open("/export/www/www.henriknordstrom.net/html/.htaccess", O_RDONLY|O_LARGEFILE)
= -1 ENOENT (No such file or directory)
stat64("/export/www/www.henriknordstrom.net/html/index", 0xbfd0cd8c) = -1 ENOENT
(No such file or directory)
lstat64("/export", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/export/www", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/export/www/www.henriknordstrom.net", {st_mode=S_IFDIR|0755,
st_size=4096, ...}) = 0
lstat64("/export/www/www.henriknordstrom.net/html",
{st_mode=S_IFDIR|S_ISGID|0775, st_size=4096, ...}) = 0
lstat64("/export/www/www.henriknordstrom.net/html/index", 0xbfd0cd8c) = -1
ENOENT (No such file or directory)
open("/export/www/www.henriknordstrom.net/html/",
O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 9
fstat64(9, {st_mode=S_IFDIR|S_ISGID|0775, st_size=4096, ...}) = 0
fcntl64(9, F_SETFD, FD_CLOEXEC)         = 0
getdents64(9, /* 38 entries */, 4096)   = 1440
stat64("/export/www/www.henriknordstrom.net/html/index.html",
{st_mode=S_IFREG|0754, st_size=862, ...}) = 0
getdents64(9, /* 0 entries */, 4096)    = 0
close(9)                                = 0
open("/export/www/www.henriknordstrom.net/html/index.html",
O_RDONLY|O_LARGEFILE) = 9
close(9)                                = 0
read(8, 0x8beeb38, 8000)                = -1 EAGAIN (Resource temporarily
unavailable)
write(7, "127.0.0.1 www.henriknordstrom.ne"..., 96) = 96
shutdown(8, 1 /* send */)               = 0
poll([{fd=8, events=POLLIN, revents=POLLIN|POLLHUP}], 1, 2000) = 1
read(8, "", 512)                        = 0
close(8)                                = 0
read(4, 0xbfd0d087, 1)                  = -1 EAGAIN (Resource temporarily
unavailable)
Comment 2 Joe Orton 2007-10-12 03:56:34 UTC
Can you reproduce this with 2.2.6?  It seems to work fine with the current
2.2.7-dev branch.

> GET /modules/include/xbithack/full/test.html HTTP/1.1
> User-Agent: curl/7.16.2 (x86_64-redhat-linux-gnu) libcurl/7.16.2
OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.8
> Host: localhost:8529
> Accept: */*
> If-Modified-Since: Mon, 19 Feb 2007 23:48:28 GMT
> 
< HTTP/1.1 304 Not Modified
< Date: Fri, 12 Oct 2007 10:55:39 GMT
< Server: Apache/2.2.7-dev (Unix) mod_ssl/2.2.7-dev OpenSSL/0.9.8b DAV/2
Comment 3 David Nesting 2009-06-22 10:23:31 UTC
I'm seeing this with Debian's 2.2.11 build.  I normally sit behind a squid proxy that auto-retries, so this problem was being masked.  I can reliably reproduce it with a browser hitting the site directly.  Occasionally the requests DO succeed, but most fail.  I've confirmed with tcpdump that the HTTP server is closing the connection without sending a response.

The failures seem to be correlated only with index files with the XBitHack set.  My strace output looks essentially identical to the other poster's.  Here's a diff between a 'good' request and a 'bad' request:

 getdents64(18, /* 0 entries */, 4096)   = 0
 close(18)                               = 0
 open("/www/fastolfe.net/htdocs/2009/index.html", O_RDONLY|O_LARGEFILE) = 18
-mmap2(NULL, 13, PROT_READ, MAP_SHARED, 18, 0) = 0xb7f6c000
-writev(15, [{"HTTP/1.1 200 OK\r\nDate: Mon, 22 Ju"..., 342}, {"Test content\n"..., 13}], 2) = 355
-munmap(0xb7f6c000, 13)                  = 0
-write(16, "216.239.45.4 - - - [22/Jun/2009:0"..., 188) = 188
+close(18)                               = 0
+read(15, 0x82ddec8, 8000)               = -1 EAGAIN (Resource temporarily unavailable)
+write(16, "216.239.45.4 - - - [22/Jun/2009:1"..., 187) = 187
 shutdown(15, 1 /* send */)              = 0
 poll([{fd=15, events=POLLIN}], 1, 2000) = 1 ([{fd=15, revents=POLLIN|POLLHUP}])
 read(15, ""..., 512)                    = 0
 close(15)                               = 0
 read(7, 0xbf86fb57, 1)                  = -1 EAGAIN (Resource temporarily unavailable)
-close(18)                               = 0
-semop(10059778, 0xb7f195d4, 1)          = 0
-epoll_wait(13, {{EPOLLIN, {u32=137158752, u64=137158752}}}, 2, -1) = 1
+semop(10059778, 0xb7f195d4, 1

The bad request fails to mmap the index.html and fails to write a response before closing the connection.

If I chmod g-x index.html, the file gets delivered reliably.

Nothing is logged to the error log, and the access log always reports a normal 304 response.
Comment 4 David Nesting 2009-06-22 15:24:44 UTC
Note that I am also using MultiViews, so it might be a multi-way interaction.
Comment 5 Zhang Weiwu 2011-03-11 01:14:24 UTC
As I experiment this on 2.2.9, either XBitHack on or XBitHack full would cause empty pages in browser for index pages, presumably due to 0-byte pages. chmod g-x does not cure this. Detail of my trial is recorded in bug 45225 and in bug 50914.
Comment 6 William A. Rowe Jr. 2018-11-07 21:09:21 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.