зеркало из https://github.com/Azure/iisnode.git
fix #156: support for multiple HTTP response headers with the same name
This commit is contained in:
Родитель
5fa47e9851
Коммит
0f65ec94f0
|
@ -498,7 +498,7 @@ HRESULT CHttpProtocol::ParseResponseHeaders(CNodeHttpStoredContext* context)
|
|||
while (*(data + nameEndOffset) == ' ') // data is already zero-terminated, so this loop has sentinel value
|
||||
nameEndOffset++;
|
||||
|
||||
CheckError(response->SetHeader(data + offset, data + nameEndOffset, valueEndOffset - nameEndOffset, TRUE));
|
||||
CheckError(response->SetHeader(data + offset, data + nameEndOffset, valueEndOffset - nameEndOffset, FALSE));
|
||||
}
|
||||
else if ((valueEndOffset - nameEndOffset) >= 5 && 0 == memcmp((void*)(data + valueEndOffset - 5), "close", 5))
|
||||
{
|
||||
|
|
|
@ -255,6 +255,7 @@ copy /y $(ProjectDir)\..\config\* $(ProjectDir)\..\..\build\$(Configuration)\$(P
|
|||
<None Include="..\..\test\functional\tests\119_servervars.js" />
|
||||
<None Include="..\..\test\functional\tests\120_dev_errors_exception.js" />
|
||||
<None Include="..\..\test\functional\tests\121_watchedFiles.js" />
|
||||
<None Include="..\..\test\functional\tests\122_multipleResponseHeaders.js" />
|
||||
<None Include="..\..\test\functional\tests\200_samples.bat" />
|
||||
<None Include="..\..\test\functional\tests\node_modules\iisnodeassert.js" />
|
||||
<None Include="..\..\test\functional\tests\parts\106_autoupdate_first.js" />
|
||||
|
@ -310,6 +311,8 @@ copy /y $(ProjectDir)\..\config\* $(ProjectDir)\..\..\build\$(Configuration)\$(P
|
|||
<None Include="..\..\test\functional\www\120_dev_errors_exception\web.config" />
|
||||
<None Include="..\..\test\functional\www\121_watchedFiles\hello.js" />
|
||||
<None Include="..\..\test\functional\www\121_watchedFiles\web.config" />
|
||||
<None Include="..\..\test\functional\www\122_multipleResponseHeaders\hello.js" />
|
||||
<None Include="..\..\test\functional\www\122_multipleResponseHeaders\web.config" />
|
||||
<None Include="..\..\test\performance\client.bat" />
|
||||
<None Include="..\..\test\performance\localRun.bat" />
|
||||
<None Include="..\..\test\performance\readme.txt" />
|
||||
|
|
|
@ -132,6 +132,9 @@
|
|||
<Filter Include="Tests\functional\www\121_watchedFiles">
|
||||
<UniqueIdentifier>{53a23746-6411-4600-8315-bc8a1b2120da}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Tests\functional\www\122_multipleResponseHeaders">
|
||||
<UniqueIdentifier>{53b5e674-69d5-4bae-9629-49cd8b7c7c45}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
|
@ -576,6 +579,15 @@
|
|||
<None Include="..\..\test\functional\www\121_watchedFiles\web.config">
|
||||
<Filter>Tests\functional\www\121_watchedFiles</Filter>
|
||||
</None>
|
||||
<None Include="..\..\test\functional\www\122_multipleResponseHeaders\hello.js">
|
||||
<Filter>Tests\functional\www\122_multipleResponseHeaders</Filter>
|
||||
</None>
|
||||
<None Include="..\..\test\functional\www\122_multipleResponseHeaders\web.config">
|
||||
<Filter>Tests\functional\www\122_multipleResponseHeaders</Filter>
|
||||
</None>
|
||||
<None Include="..\..\test\functional\tests\122_multipleResponseHeaders.js">
|
||||
<Filter>Tests\functional\tests</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="iisnode.rc" />
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
A simple GET request receives a hello world response
|
||||
*/
|
||||
|
||||
var net = require('net')
|
||||
, assert = require('assert');
|
||||
|
||||
var timeout = setTimeout(function () {
|
||||
console.error('Timeout occurred');
|
||||
assert.ok(false, 'request timed out');
|
||||
}, 10000);
|
||||
|
||||
var host = process.env.IISNODETEST_HOST || 'localhost';
|
||||
var port = process.env.IISNODETEST_PORT || 31415;
|
||||
|
||||
var client = net.connect(port, host, function () {
|
||||
client.setEncoding('utf8');
|
||||
client.write('GET /122_multipleResponseHeaders/hello.js HTTP/1.1\r\nHost: ' + host + ':' + port + '\r\n\r\n');
|
||||
});
|
||||
|
||||
client.on('data', function (data) {
|
||||
clearTimeout(timeout);
|
||||
assert.ok(data.indexOf('Foo: Val1') > 0, 'First instance of Foo header exists in the response');
|
||||
assert.ok(data.indexOf('Foo: Val2') > 0, 'Second instance of Foo header exists in the response');
|
||||
client.end();
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
var http = require('http');
|
||||
|
||||
http.createServer(function (req, res) {
|
||||
res.writeHead(200, [['Foo','Val1'], ['Foo','Val2']]);
|
||||
res.end('Hello, world!');
|
||||
}).listen(process.env.PORT);
|
|
@ -0,0 +1,7 @@
|
|||
<configuration>
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="iisnode" path="hello.js" verb="*" modules="iisnode" />
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
</configuration>
|
Загрузка…
Ссылка в новой задаче