summary refs log tree commit homepage
path: root/ext/unicorn_http/unicorn_http_common.rl
diff options
authorMishael A Sibiryakov <>2016-10-20 12:05:32 +0300
committerEric Wong <>2016-10-20 17:39:11 +0000
commitd5fbbf547203061b1eaafbe80c4538a37fce5a34 (patch)
tree1609758e298a21d921c4bd09f4c7da6e29eb4c66 /ext/unicorn_http/unicorn_http_common.rl
parentc47d13d2c5ce75cca5ac11eda6d6a0e54015e711 (diff)
Hi all.

We're implementing client certificate authentication with nginx and

Nginx configured in the following way:

proxy_set_header X-SSL-Client-Cert $ssl_client_cert;

When client submits certificate and nginx passes it to the unicorn,
unicorn responds with 400 (Bad Request). This caused because nginx
doesn't use "\r\n" they using just "\n" and multilne headers is failed
to parse (I've added test).

Accorording to RFC2616 section 19.3:

"The line terminator for message-header fields is the sequence CRLF.
However, we recommend that applications, when parsing such headers,
recognize a single LF as a line terminator and ignore the leading CR."

CRLF changed to ("\r\n" | "\n")

Github commit

PS: Googling "nginx unicorn ssl_client_cert" shows the problem. 
Diffstat (limited to 'ext/unicorn_http/unicorn_http_common.rl')
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/unicorn_http/unicorn_http_common.rl b/ext/unicorn_http/unicorn_http_common.rl
index cc1d455..0988b54 100644
--- a/ext/unicorn_http/unicorn_http_common.rl
+++ b/ext/unicorn_http/unicorn_http_common.rl
@@ -4,7 +4,7 @@
 # line endings
-  CRLF = "\r\n";
+  CRLF = ("\r\n" | "\n");
 # character types
   CTL = (cntrl | 127);