This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- the nginx variable $http_x_spdy_protocol contains the value for X-SPDY-Protocol | |
local SPDY_REQ_HEADER_VAR='http_x_spdy_protocol' | |
local ALTERNATE_HEADER='Alternate-Protocol' | |
local ALTERNATE_VALUE='443:npn-spdy/2' | |
local function is_spdy_on() | |
local spdy_version = tonumber(ngx.var[SPDY_REQ_HEADER_VAR]) or 0 | |
ngx.log(ngx.DEBUG, 'SPDY Version: ', spdy_version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/http/ngx_http_spdy.c b/src/http/ngx_http_spdy.c | |
index 85b2620..7c55ca7 100644 | |
--- a/src/http/ngx_http_spdy.c | |
+++ b/src/http/ngx_http_spdy.c | |
@@ -268,6 +268,8 @@ ngx_http_init_spdy(ngx_event_t *rev) | |
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
"init spdy request"); | |
+ c->log->action = "spdy connection"; | |
+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Simple KV store in Ngx+Lua | |
local SHARED_MEM = ngx.shared.mem | |
local MAX_ARGS = 10 | |
local POST_CHUNK_SIZE = 4096 | |
-- Max size for POST == 1MB | |
local MAX_POST_SIZE = 1024 * 1024 | |
local DEBUG = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* inspired from ngx_http_log_module.c:ngx_http_log_request_time() */ | |
static ngx_int_t | |
ngx_http_request_time(ngx_http_request_t *r, | |
ngx_http_variable_value_t *v, | |
uintptr_t data) { | |
ngx_time_t *tp; | |
ngx_msec_int_t ms; | |
tp = ngx_timeofday(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http { | |
# Lua configuration | |
lua_package_path "$prefix/?.lua;;"; | |
lua_shared_dict log_dict 1M; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Copyright (C) 2012 Zhang "agentzh" Yichun (章亦春) | |
-- Copyright (C) 2012 Matthieu Tourne | |
module("multipart", package.seeall) | |
local STATE_BEGIN = 1 | |
local STATE_READING_HEADER = 2 | |
local STATE_READING_BODY = 3 | |
local STATE_ERROR = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local timer = { } | |
-- shared dictionary | |
local timer_queue = ngx.shared.timer_queue | |
local mt = { __index = timer } | |
local floor = math.floor | |
local ngx_now = ngx.now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- list of headers where tables are allowed | |
local ALLOWED_MULTI_HEADERS = { | |
["cookie"] = true, | |
} | |
local function sanitize_req_headers(req_headers) | |
for k, v in pairs(req_headers) do | |
if type(v) == "table" then | |
if not ALLOWED_MULTI_HEADERS[k] then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* clear all the headers */ | |
ngx_memzero(&r->headers_in, sizeof (ngx_http_headers_in)); | |
/* reinitialize headers */ | |
r->headers_in.content_length_n = -1; | |
r->headers_in.keep_alive_n = -1; | |
/* TODO (mtourne): init to the size of the table passed in param */ | |
if (ngx_list_init(&r->headers_in.headers, r->pool, 20, | |
sizeof(ngx_table_elt_t)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import pyparsing as pyp | |
import re | |
try: | |
from ..pylib import db | |
except (ImportError, ValueError): | |
from pylib import db | |
OlderNewer