kuksugen / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

enable_keep_alive and htaccess with password file hanging #292

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. set enable_keep_alive=true
2. create .htaccess and .htpasswd file
3. surf to the password protected folder/file

What is the expected output? What do you see instead?
With enable_keep_alive=true browser don't open login box till connection will 
be closed.

What version of the product are you using? On what operating system?
Mongoose 3.0 at Debian 5 (x64)

Please provide any additional information below.
With enable_keep_alive=false it works fine.

Original issue reported on code.google.com by mhais...@gmail.com on 10 Nov 2011 at 8:08

GoogleCodeExporter commented 9 years ago
I must correct my post. Login box appears at browser, but it doesn't handle 
login after that. It seems following helps:

static int should_keep_alive(const struct mg_connection *conn) {
  const char *http_version = conn->request_info.http_version;
  const char *header = mg_get_header(conn, "Connection");

/** keep-alive and authorization bug fix **/
  if (conn->request_info.status_code == 401)
    return 0;
/** end bug fix **/

  return (header == NULL && http_version && !strcmp(http_version, "1.1")) ||
      (header != NULL && !mg_strcasecmp(header, "keep-alive"));
}

Original comment by mhais...@gmail.com on 10 Nov 2011 at 9:50

GoogleCodeExporter commented 9 years ago

Original comment by valenok on 23 Sep 2012 at 12:25