Dirk wrote 30 lines
>> I tested a simple http application and found that the
THTTPApplication
>> does not close the connection.
>>
>> A normal web server always close the connection after sending the
HTML
> page but this webserver does not close the connection. As a result of
> this every second request from a web browser (Firefox, IE) does not
> work. The browser starts the request than it waits for a very long
time.
> If you interrupt the browser and start a new request you get an
answer.
> That is not correct.
> In HTTP 1.1 The browser sends a HTTP header which determines if the
connection should be closed or not.
> Secondly, THTTPApplication is an apache module. There it is apache
which determines what happens to the
> connection, not the FPC code.
The THTTPApplication is part of the standalone "HTTP server Application"
(default project) of the weblazextra package. There is no apache server
involved.
There is no difference if I user http 1.0, http 1.1 or if I set
"Connection: close".
It is also impossible to send a second request over the open connection.
I have tested, and a strace shows that the connection is always closed:
accept(3, {sa_family=AF_INET, sin_port=htons(59845), sin_addr=inet_addr("127.0.0.1")}, [16]) = 4 mmap(NULL, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc61cecb000 recvfrom(4, "GET /me.html HTTP/1.1\r\nHost: loc"..., 4096, 0, NULL, NULL) = 1801 mmap(NULL, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc61cec3000 write(1, "Treating URI : /me.html\n", 24Treating URI : /me.html ) = 24
mmap(NULL, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc61cebb000 access("/home/michael/FPC/trunk/packages/fcl-web/examples/httpserver/me.html", F_OK) = -1 ENOENT (No such file or directory) sendto(4, "HTTP/1.1 404 Not Found\r\nStatus: "..., 67, 0, NULL, 0) = 67 munmap(0x7fc61cecb000, 32768) = 0
close(4) = 0
accept(3, {sa_family=AF_INET, sin_port=htons(59846), sin_addr=inet_addr("127.0.0.1")}, [16]) = 4 recvfrom(4, "GET /favicon.ico HTTP/1.1\r\nHost:"..., 4096, 0, NULL, NULL) = 584 write(1, "Treating URI : /favicon.ico\n", 28Treating URI : /favicon.ico ) = 28
access("/home/michael/FPC/trunk/packages/fcl-web/examples/httpserver/favicon.ico", F_OK) = -1 ENOENT (No such file or directory) sendto(4, "HTTP/1.1 404 Not Found\r\nStatus: "..., 67, 0, NULL, 0) = 67 close(4) = 0
accept(3, {sa_family=AF_INET, sin_port=htons(59847), sin_addr=inet_addr("127.0.0.1")}, [16]) = 4 recvfrom(4, "GET /favicon.ico HTTP/1.1\r\nHost:"..., 4096, 0, NULL, NULL) = 614 write(1, "Treating URI : /favicon.ico\n", 28Treating URI : /favicon.ico ) = 28
access("/home/michael/FPC/trunk/packages/fcl-web/examples/httpserver/favicon.ico", F_OK) = -1 ENOENT (No such file or directory) sendto(4, "HTTP/1.1 404 Not Found\r\nStatus: "..., 67, 0, NULL, 0) = 67 close(4) = 0
accept(3,
Michael.