bug in inet_drv.c

Klacke <>
Wed Feb 19 21:59:36 CET 2003


Bug in inet_drv.c

flinta:common> diff  -c inet_drv.c.orig  inet_drv.c
*** inet_drv.c.orig	Wed Feb 19 21:51:27 2003
--- inet_drv.c	Wed Feb 19 21:51:30 2003
***************
*** 1990,1995 ****
--- 1990,1996 ----
  	  return -1;
  	while(n && SP(ptr)) { ptr++; n--; }
  	if (n == 0) {
+ 	  desc->http_state++;
  	  return http_request_message(desc, meth,
  				      meth_ptr, meth_len,
  				      uri_ptr, uri_len,



The error is in GET request on the form semi broken 0.9 requests.

# cat bad.txt
GET /

# nc localhost 1234 < bad.txt
^C

while erlang runs:

s() ->
    
    {ok,L} = gen_tcp:listen(1234, [{packet,http}, {active, false}]),
    io:format("After listen\n",[]),
    {ok,S} = gen_tcp:accept(L),
    io:format("after accept",[]),
    R = gen_tcp:recv(S, 0),
    io:format("First read: ~p~n", [R]),
    R2 = gen_tcp:recv(S, 0),
    io:format("second read: ~p~n", [R2]).


The second read never returns and the fd is never closed. Bad.


Enjoy

/klacke


-- 
Claes Wikstrom                        -- Caps lock is nowhere and
Alteon WebSystems                     -- everything is under control          
http://www.bluetail.com/~klacke      
cellphone: +46 70 2097763



More information about the erlang-questions mailing list