Project

General

Profile

About upload file con_state

Added by sky404 about 2 years ago

Hi there,

I have two version of lighttpd 1.4.54 and 1.4.35.
There are work on linux and I have a question want to know.

My test procedure:
  1. upload file to start with a few seconds
  2. I break the connection between server and client next.
  3. I check logs that I added in addition

It's about CON_STATE_READ and CON_STATE_READ_POST while I trying upload file.
I added some logs in server.c to see what state in the moment.

add logs as below :

(1.4.35 server.c)

+ log_error_write(srv, __FILE__, __LINE__, "sds", "(server) fd ", con->fd, connection_get_state(con->state));
if (con->state == CON_STATE_READ || con->state == CON_STATE_READ_POST) {
  if (con->request_count == 1 || con->state == CON_STATE_READ_POST) {
    if (srv->cur_ts - con->read_idle_ts > con->conf.max_read_idle) {

(1.4.54 server.c)

+ log_error_write(srv, __FILE__, __LINE__, "sds", "(server) fd ", con->fd, connection_get_state(con->state));
if (con->state == CON_STATE_CLOSE) {
  if (srv->cur_ts - con->close_timeout_ts > HTTP_LINGER_TIMEOUT) {

In 1.4.54 the state prints CON_STATE_READ when I broke the connection, but in 1.4.35 prints CON_STATE_READ_POST
why it prints different state ?

Thank you.


Replies (3)

RE: About upload file con_state - Added by gstrauss about 2 years ago

In 1.4.54 the state prints CON_STATE_READ when I broke the connection, but in 1.4.35 prints CON_STATE_READ_POST why it prints different state ?

The short answer to your question is that lighttpd changed how it handled the request body. (Duh. I am sure you figured that out, hence your question.) The answer to the "why" part is that lighttpd changed how it handled the request body when lighttpd added the feature to be able to stream the request body to the backend in lighttpd 1.4.40, which was released in Jul 2016, almost 6 years ago. The request body is not read unless a module assigns a handler to pick up the request, and until that handler "pulls" to read the request body.

In case you did not get the hint from my email, lighttpd 1.4.54 is old, and lighttpd 1.4.35 is ancient. The current version of lighttpd is lighttpd 1.4.64.

Whatever someone did for a custom lighttpd module in lighttpd 1.4.35 could probably be thrown away with current versions of lighttpd. If you still need some programmed customizations, then see lighttpd mod_magnet

RE: About upload file con_state - Added by sky404 about 2 years ago

It seldom prints CON_STATE_READ when I used lighttpd 1.4.35.

lighttpd added the feature to be able to stream the request body to the backend in lighttpd 1.4.40, which was released in Jul 2016, almost 6 years ago.

Is that a normally state in 1.4.35 ?
because you said added feature to read the request body in 1.4.40.

RE: About upload file con_state - Added by gstrauss about 2 years ago

Is that a normally state in 1.4.35 ?
because you said added feature to read the request body in 1.4.40.

I said that I added the feature to stream the request body to the backend in 1.4.40.

If your company would like to pay for support for ancient code, please find my email in the git log and send a private message to me containing an RFP.

    (1-3/3)