openresty / openresty/lua-nginx-module

ngx.req.raw_header on SSL

Open
#821 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.8k
Forks
2.1k
Avg merge
6h 1m
Merged PRs (30d)
6

Description

For some reason on SSL connections, nginx is crashing when trying to get the raw headers using lua, on non ssl-connections it works fine.

local function get_req_headers(self)
    local req_headers = ngx.req.raw_header()
    return req_headers
end

local function get_sock()
    local host = ngx.var.upstream_host
    local http = http_lib:new()
    local port = get_port()
    local c, err = http:connect(host, port)
    if not c then
        log(ERR, "cannot connect origin.", err)
        http:close()
        return nil, err
    end

    return http, err
end

sock, err = get_sock()
if sock then 
    headers = get_req_headers()
end

Nginx 1.8
CentOS
ngx_lua

2016/07/21 03:00:28 [alert] 25628#0: worker process 29903 exited on signal 11
2016/07/21 03:00:34 [alert] 25628#0: worker process 30653 exited on signal 11
2016/07/21 03:01:06 [alert] 31550#0: worker process 31559 exited on signal 11
2016/07/21 03:01:07 [alert] 31550#0: worker process 31555 exited on signal 11
2016/07/21 03:01:15 [alert] 31550#0: worker process 31604 exited on signal 11

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the crash with the shown ngx.req.raw_header() call on an SSL connection using Nginx 1.8 on CentOS, then inspect the ngx.req.raw_header entry point and its SSL-specific path. Done means the request no longer exits the worker with signal 11 while raw headers are retrieved.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua, nginx
Domain
backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.