Skip to content

Commit bc49a4b

Browse files
committed
spec/: pass :scheme header
1 parent 814ed01 commit bc49a4b

4 files changed

+34
-16
lines changed

spec/h1_stream_spec.lua

+30-15
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ describe("http1 stream", function()
3030
local stream = client:new_stream()
3131
client:shutdown()
3232
local headers = new_headers()
33-
headers:append(":authority", "myauthority")
3433
headers:append(":method", "GET")
34+
headers:append(":scheme", "http")
35+
headers:append(":authority", "myauthority")
3536
headers:append(":path", "/a")
3637
assert.same(ce.EPIPE, select(3, stream:write_headers(headers, true)))
3738
client:close()
@@ -43,8 +44,9 @@ describe("http1 stream", function()
4344
cq:wrap(function()
4445
local stream = client:new_stream()
4546
local req_headers = new_headers()
46-
req_headers:append(":authority", "myauthority")
4747
req_headers:append(":method", "GET")
48+
req_headers:append(":scheme", "http")
49+
req_headers:append(":authority", "myauthority")
4850
req_headers:append(":path", "/a")
4951
assert(stream:write_headers(req_headers, true))
5052
local res_headers = assert(stream:get_headers())
@@ -91,8 +93,9 @@ describe("http1 stream", function()
9193
local server, client = new_pair(1.1)
9294
local stream = client:new_stream()
9395
local headers = new_headers()
94-
headers:append(":authority", "myauthority")
9596
headers:append(":method", "GET")
97+
headers:append(":scheme", "http")
98+
headers:append(":authority", "myauthority")
9699
headers:append(":path", "/a")
97100
assert(stream:write_headers(headers, true))
98101
local cq = cqueues.new():wrap(function()
@@ -109,8 +112,9 @@ describe("http1 stream", function()
109112
cq:wrap(function()
110113
local stream = client:new_stream()
111114
local req_headers = new_headers()
112-
req_headers:append(":authority", "myauthority")
113115
req_headers:append(":method", "GET")
116+
req_headers:append(":scheme", "http")
117+
req_headers:append(":authority", "myauthority")
114118
req_headers:append(":path", "/a")
115119
assert(stream:write_headers(req_headers, true))
116120
local res_headers = assert(stream:get_headers())
@@ -135,8 +139,9 @@ describe("http1 stream", function()
135139
cq:wrap(function()
136140
local stream = client:new_stream()
137141
local req_headers = new_headers()
138-
req_headers:append(":authority", "myauthority")
139142
req_headers:append(":method", "GET")
143+
req_headers:append(":scheme", "http")
144+
req_headers:append(":authority", "myauthority")
140145
req_headers:append(":path", "/a")
141146
assert(stream:write_headers(req_headers, true))
142147
assert(stream:get_headers())
@@ -166,8 +171,9 @@ describe("http1 stream", function()
166171
cq:wrap(function()
167172
local stream = client:new_stream()
168173
local headers = new_headers()
169-
headers:append(":authority", "myauthority")
170174
headers:append(":method", "GET")
175+
headers:append(":scheme", "http")
176+
headers:append(":authority", "myauthority")
171177
headers:append(":path", "/a")
172178
headers:append("transfer-encoding", "chunked")
173179
assert(stream:write_headers(headers, false))
@@ -217,8 +223,9 @@ describe("http1 stream", function()
217223
cq:wrap(function()
218224
local stream = client:new_stream()
219225
local headers = new_headers()
220-
headers:append(":authority", "myauthority")
221226
headers:append(":method", "GET")
227+
headers:append(":scheme", "http")
228+
headers:append(":authority", "myauthority")
222229
headers:append(":path", "/a")
223230
headers:append("transfer-encoding", "chunked")
224231
assert(stream:write_headers(headers, false))
@@ -248,8 +255,9 @@ describe("http1 stream", function()
248255
do
249256
local stream = client:new_stream()
250257
local headers = new_headers()
251-
headers:append(":authority", "myauthority")
252258
headers:append(":method", "GET")
259+
headers:append(":scheme", "http")
260+
headers:append(":authority", "myauthority")
253261
headers:append(":path", "/a")
254262
headers:append("content-length", "100")
255263
assert(stream:write_headers(headers, false))
@@ -258,8 +266,9 @@ describe("http1 stream", function()
258266
do
259267
local stream = client:new_stream()
260268
local headers = new_headers()
261-
headers:append(":authority", "myauthority")
262269
headers:append(":method", "GET")
270+
headers:append(":scheme", "http")
271+
headers:append(":authority", "myauthority")
263272
headers:append(":path", "/b")
264273
headers:append("content-length", "0")
265274
assert(stream:write_headers(headers, true))
@@ -313,17 +322,19 @@ describe("http1 stream", function()
313322
if client_sync then client_sync:wait() end
314323
local a = client:new_stream()
315324
local ah = new_headers()
316-
ah:append(":authority", "myauthority")
317325
ah:append(":method", "GET")
326+
ah:append(":scheme", "http")
327+
ah:append(":authority", "myauthority")
318328
ah:append(":path", "/a")
319329
assert(a:write_headers(ah, true))
320330
end)
321331
cq:wrap(function()
322332
client_sync:signal(); client_sync = nil;
323333
local b = client:new_stream()
324334
local bh = new_headers()
325-
bh:append(":authority", "myauthority")
326335
bh:append(":method", "POST")
336+
bh:append(":scheme", "http")
337+
bh:append(":authority", "myauthority")
327338
bh:append(":path", "/b")
328339
assert(b:write_headers(bh, false))
329340
cqueues.sleep(0.01)
@@ -332,8 +343,9 @@ describe("http1 stream", function()
332343
cq:wrap(function()
333344
local c = client:new_stream()
334345
local ch = new_headers()
335-
ch:append(":authority", "myauthority")
336346
ch:append(":method", "GET")
347+
ch:append(":scheme", "http")
348+
ch:append(":authority", "myauthority")
337349
ch:append(":path", "/c")
338350
assert(c:write_headers(ch, true))
339351
end)
@@ -375,8 +387,9 @@ describe("http1 stream", function()
375387

376388
do
377389
local h = new_headers()
378-
h:append(":authority", "myauthority")
379390
h:append(":method", "POST")
391+
h:append(":scheme", "http")
392+
h:append(":authority", "myauthority")
380393
h:append(":path", "/")
381394
h:upsert("id", "a")
382395
assert(a:write_headers(h, false))
@@ -443,8 +456,9 @@ describe("http1 stream", function()
443456
cq:wrap(function()
444457
local a = client:new_stream()
445458
local h = new_headers()
446-
h:append(":authority", "myauthority")
447459
h:append(":method", "POST")
460+
h:append(":scheme", "http")
461+
h:append(":authority", "myauthority")
448462
h:append(":path", "/a")
449463
h:append("expect", "100-continue")
450464
assert(a:write_headers(h, false))
@@ -476,8 +490,9 @@ describe("http1 stream", function()
476490
cq:wrap(function()
477491
local a = client:new_stream()
478492
local h = new_headers()
479-
h:append(":authority", "myauthority")
480493
h:append(":method", "GET")
494+
h:append(":scheme", "http")
495+
h:append(":authority", "myauthority")
481496
h:append(":path", "/")
482497
assert(a:write_headers(h, true))
483498
end)

spec/server_spec.lua

+1
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ describe("http.server module", function()
268268
}))
269269
local headers = http_headers.new()
270270
headers:append(":method", "GET")
271+
headers:append(":scheme", "http")
271272
headers:append(":path", "/")
272273
headers:append(":authority", "foo")
273274
-- Normal request

spec/stream_common_spec.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ describe("http.stream_common", function()
1212
end
1313
local function new_request_headers()
1414
local headers = new_headers()
15-
headers:append(":authority", "myauthority")
1615
headers:append(":method", "GET")
16+
headers:append(":scheme", "http")
17+
headers:append(":authority", "myauthority")
1718
headers:append(":path", "/")
1819
return headers
1920
end

spec/websocket_spec.lua

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ describe("http.websocket", function()
9292
end
9393
local correct_headers = http_headers.new()
9494
correct_headers:append(":method", "GET")
95+
correct_headers:append(":scheme", "http")
9596
correct_headers:append(":authority", "example.com")
9697
correct_headers:append(":path", "/")
9798
correct_headers:append("upgrade", "websocket")

0 commit comments

Comments
 (0)