OOB work and http name stack fix

cvs
Slava Pestov 2004-08-19 21:45:42 +00:00
parent 029e36897c
commit 7e86800c9f
4 changed files with 11 additions and 9 deletions

View File

@ -69,9 +69,9 @@ USE: httpd
dup f-or-"" [ drop "default-argument" get ] when ;
: call-responder ( method argument responder -- )
[
over [ responder-argument swap get call ] with-request
] bind ;
pick [
[ responder-argument swap get call ] bind
] with-request ;
: no-such-responder ( name -- )
"404 no such responder: " swap cat2 httpd-error ;

View File

@ -89,6 +89,7 @@ bool read_line_step(PORT* port)
/* We've reached the end of the above loop, without seeing a newline
or EOF, so read again */
port->buf_pos = port->buf_fill;
port->line_ready = false;
return false;
}

View File

@ -125,7 +125,9 @@ bool perform_read_line_io_task(PORT* port)
return true;
}
else
{
return read_line_step(port);
}
}
bool perform_write_io_task(PORT* port)
@ -232,12 +234,6 @@ CELL next_io_task(void)
select(read_fd_count > write_fd_count ? read_fd_count : write_fd_count,
&read_fd_set,&write_fd_set,NULL,NULL);
for(i = 0; i < 100; i++)
{
if(FD_ISSET(i,&except_fd_set))
_exit(1);
}
callback = perform_io_tasks(&read_fd_set,read_fd_count,read_io_tasks);
if(callback != F)
return callback;

View File

@ -99,6 +99,8 @@ CELL accept_connection(PORT* p)
struct sockaddr_in clientname;
size_t size = sizeof(clientname);
int oobinline = 1;
int new = accept(p->fd,(struct sockaddr *)&clientname,&size);
if(new < 0)
{
@ -108,6 +110,9 @@ CELL accept_connection(PORT* p)
io_error(__FUNCTION__);
}
if(setsockopt(new,SOL_SOCKET,SO_OOBINLINE,&oobinline,sizeof(int)) < 0)
io_error(__FUNCTION__);
p->client_host = tag_object(from_c_string(inet_ntoa(
clientname.sin_addr)));
p->client_port = tag_fixnum(ntohs(clientname.sin_port));