object owner;
User owner;
nomask static int send(object response, int send_headers, int send_content){	int i, rod, csize;	object owner;	rod = response->get_read_on_demand();	owner = get_owner();		if(send_headers) {		owner->send_headers(response);	}	if(!response->get_content_length() && !rod) {		/* No (pending) content? Ignore in-argument. */		send_content = FALSE;	}	if(!rod) {		response->update_content_length();		csize = response->get_content_size();		for(i = 0; i < csize; i++) {			if(!owner->send_content(response, response->get_content_chunk(i))) {				if((i + 1) < csize) {					response->content_chunks_sent(i + 1);					buffer = response;					owner->subscribe(EVT_MESSAGE_DONE);				}				return TRUE;			}		}	} else {		/* read on demand enabled */		int	*range, offset, length, total;		total  = (int)response->get_header("Content-Length");		range  = response->get_last_read_range();		length = HTTP_CHUNK_SIZE;		offset = range[0] + range[1];		do {			i = response->get_content_size() - 1;			if(i >= 0) {				if( !(owner->send_content(response, 							response->get_content_chunk(i))) ) {					buffer = response;					response->content_chunks_sent(i);					owner->subscribe(EVT_MESSAGE_DONE);					return TRUE;				}				response->content_chunks_sent(i);			}			read_resource(response->get_request(), response, offset, length);			response->set_read_range(offset, length);			offset = (offset) + length;		} while((offset-length) < total);	}	return TRUE;}