Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
fixed a bug with Apache2.
Browse files Browse the repository at this point in the history
  • Loading branch information
shugo committed Sep 10, 2004
1 parent 61b3065 commit 621adf8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -1,3 +1,7 @@
Fri Sep 10 18:04:48 2004 Shugo Maeda <shugo@modruby.net>

* request.c (request_send_fd): fixed a bug with Apache2.

Sun Aug 29 10:56:53 2004 NISHI Takao <zophos@Dadd9.com>

* mod_ruby.c (mod_ruby_setenv): call ruby_unsetenv() before
Expand Down
10 changes: 8 additions & 2 deletions request.c
Expand Up @@ -1472,12 +1472,14 @@ static VALUE request_bytes_sent(VALUE self)
static VALUE request_send_fd(VALUE self, VALUE io)
{
OpenFile *fptr;
request_data *data;
#ifdef APACHE2
apr_size_t bytes_sent;
apr_file_t *file;
int fd;
#else
long bytes_sent;
#endif
request_data *data;

request_set_sync(self, Qtrue);
rb_apache_request_flush(self);
Expand All @@ -1486,7 +1488,11 @@ static VALUE request_send_fd(VALUE self, VALUE io)
GetOpenFile(io, fptr);

#ifdef APACHE2
ap_send_fd((apr_file_t *)fptr->f, data->request, 0, -1, &bytes_sent);
fd = fileno(fptr->f);
if (apr_os_file_put(&file, &fd, 0, data->request->pool) != APR_SUCCESS) {
rb_raise(rb_eIOError, "apr_os_file_put() failed");
}
ap_send_fd(file, data->request, 0, -1, &bytes_sent);
#else
bytes_sent = ap_send_fd_length(fptr->f, data->request, -1);
#endif
Expand Down

0 comments on commit 621adf8

Please sign in to comment.