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 ; dup f-or-"" [ drop "default-argument" get ] when ;
: call-responder ( method argument responder -- ) : call-responder ( method argument responder -- )
[ pick [
over [ responder-argument swap get call ] with-request [ responder-argument swap get call ] bind
] bind ; ] with-request ;
: no-such-responder ( name -- ) : no-such-responder ( name -- )
"404 no such responder: " swap cat2 httpd-error ; "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 /* We've reached the end of the above loop, without seeing a newline
or EOF, so read again */ or EOF, so read again */
port->buf_pos = port->buf_fill;
port->line_ready = false; port->line_ready = false;
return false; return false;
} }

View File

@ -125,7 +125,9 @@ bool perform_read_line_io_task(PORT* port)
return true; return true;
} }
else else
{
return read_line_step(port); return read_line_step(port);
}
} }
bool perform_write_io_task(PORT* 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, select(read_fd_count > write_fd_count ? read_fd_count : write_fd_count,
&read_fd_set,&write_fd_set,NULL,NULL); &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); callback = perform_io_tasks(&read_fd_set,read_fd_count,read_io_tasks);
if(callback != F) if(callback != F)
return callback; return callback;

View File

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