<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi,</div><div>IIUC, the problem is not in  </div><div><span style="display: inline !important; float: none; background-color: transparent; color: rgb(0, 0, 0); font-family: arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;">ZnMultiValueDictionary>>#at: key add: value<br> "Store value under key. </span><span style="text-align: left; color: rgb(255, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !important; white-space: pre-wrap; word-wrap: break-word; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transparent;">If key already exists, store multiple values as Array</span><span style="display: inline !important; float: none; background-color: transparent; color: rgb(0, 0, 0); font-family: arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;">"</span><br></div><div><br></div><div>value maybe an array that is  Correct.</div><div><br></div><div><span style="display: inline !important; float: none; background-color: transparent; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 23.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">problem is in Here,</span></div><div><span style="display: inline !important; float: none; background-color: transparent; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 23.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">ZnMessage >> </span><span style="display: inline !important; float: none; background-color: transparent; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 23.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">isConnectionClose<br></span></div><div><span style="display: inline !important; float: none; background-color: transparent; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 23.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> | value |<br> value := self headers at: 'Connection' ifAbsent: [ ^ false ].</span></div><div><span style="color: rgb(255, 0, 0);">"the value maybe a String or an Array "</span><span style="display: inline !important; float: none; background-color: transparent; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 23.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"></span></div><div><span style="display: inline !important; float: none; background-color: transparent; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 23.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><span style="background-color: transparent; color: rgb(0, 0, 0); display: inline; float: none; font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 23.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"></span><span style="background-color: transparent; color: rgb(255, 0, 0); display: inline; float: none; font-family: Arial; font-size: 14px; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 23.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">  " if aString that is OKay, </span></span></div><div><span style="display: inline !important; float: none; background-color: transparent; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 23.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><span style="background-color: transparent; color: rgb(255, 0, 0); display: inline; float: none; font-family: Arial; font-size: 14px; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 23.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">if an Array  sameAs:   DNUŁĄŁĄ"</span><br> ^ value sameAs: 'close'     </span></div><div><br></div><div>SoŁŹ</div><div><span style="display: inline !important; float: none; background-color: transparent; color: rgb(0, 0, 0); font-family: arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;"><span style="display: inline !important; float: none; background-color: transparent; color: rgb(0, 0, 0); font-family: Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 23.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">ZnMessage >></span>isConnectionClose<br> | value |<br> value := self headers at: 'Connection' ifAbsent: [ ^ false ].<br>  value isArray ifTrue: [^ value includes: 'close'].<br>  value isString ifTrue: [^ value sameAs: 'close'].<br> ^false</span><br></div><div><br></div><div>Same as: </div><div>isConnectionKeepAlive<br> | value |<br> value := self headers at: 'Connection' ifAbsent: [ ^ false ].<br> ^ value sameAs: 'keep-alive'<br><br></div><div style="position:relative;zoom:1"></div><div id="divNeteaseMailCard"></div>Liang<br><pre><br>At 2018-04-27 20:28:19, "Sven Van Caekenberghe" <sven@stfx.eu> wrote:
>Hi,
>
>I would still like to understand how you get in this situation.
>
>You could try the following modification:
>
>ZnMultiValueDictionary>>#at: key add: value
>  "Store value under key. If key already exists, store multiple values as Array"
>    
>  | existingValue newValue |
>  existingValue := self at: key ifAbsent: [ nil ].
>  newValue := existingValue isNil
>    ifTrue: [ value ] 
>    ifFalse: [
>      existingValue isArray 
>        ifTrue: [ 
>          (existingValue includes: value) ifTrue: [ ^ value ].
>          existingValue copyWith: value ]
>        ifFalse: [
>          existingValue = value ifTrue: [ ^ value ].
>          Array with: existingValue with: value ] ].
>  ^ self at: key put: newValue 
>
>This changes one method in a data structure underlying ZnHeaders to prevent it from accepting double entries.
>
>This way, the following expression,
>
>  ZnMultiValueDictionary new at: 'Connection' add: 'close'; at: 'Connection' add: 'close'; yourself.
>
>will result in just one simple association being stored.
>
>Please let me know if this helps.
>
>Sven
>
>> On 27 Apr 2018, at 14:06, lb <liangbing64@126.com> wrote:
>> 
>> Hi Sven
>> It came again.
>> Array(Object)>>doesNotUnderstand: #sameAs:
>> ZnRequest(ZnMessage)>>isConnectionClose
>> ZnRequest>>wantsConnectionClose
>> ZnResponse>>setConnectionCloseFor:
>> ZnManagingMultiThreadedServer(ZnMultiThreadedServer)>>augmentResponse:forRequest:
>> ZnManagingMultiThreadedServer(ZnMultiThreadedServer)>>executeOneRequestResponseOn:
>> [ [ self executeOneRequestResponseOn: stream ] whileFalse ] in ZnManagingMultiThreadedServer(ZnMultiThreadedServer)>>executeRequestResponseLoopOn:
>> [ activeProcess psValueAt: index put: anObject.
>> aBlock value ] in ZnCurrentServer(DynamicVariable)>>value:during:
>> BlockClosure>>ensure:
>> ZnCurrentServer(DynamicVariable)>>value:during:
>> ZnCurrentServer class(DynamicVariable class)>>value:during:
>> ZnManagingMultiThreadedServer(ZnMultiThreadedServer)>>executeRequestResponseLoopOn:
>> [ self executeRequestResponseLoopOn: stream ] in [ [ self executeRequestResponseLoopOn: stream ]
>>  ensure: [ self logConnectionClosed: stream.
>>   self closeSocketStream: stream ] ] in [ [ [ self executeRequestResponseLoopOn: stream ]
>>  ensure: [ self logConnectionClosed: stream.
>>   self closeSocketStream: stream ] ]
>>  ifCurtailed: [ socket destroy ] ] in ZnManagingMultiThreadedServer(ZnMultiThreadedServer)>>serveConnectionsOn:
>> BlockClosure>>ensure:
>> [ [ self executeRequestResponseLoopOn: stream ]
>>  ensure: [ self logConnectionClosed: stream.
>>   self closeSocketStream: stream ] ] in [ [ [ self executeRequestResponseLoopOn: stream ]
>>  ensure: [ self logConnectionClosed: stream.
>>   self closeSocketStream: stream ] ]
>>  ifCurtailed: [ socket destroy ] ] in ZnManagingMultiThreadedServer(ZnMultiThreadedServer)>>serveConnectionsOn:
>> BlockClosure>>ifCurtailed:
>> [ [ [ self executeRequestResponseLoopOn: stream ]
>>  ensure: [ self logConnectionClosed: stream.
>>   self closeSocketStream: stream ] ]
>>  ifCurtailed: [ socket destroy ] ] in ZnManagingMultiThreadedServer(ZnMultiThreadedServer)>>serveConnectionsOn:
>> [ self value.
>> Processor terminateActive ] in BlockClosure>>newProcess
>> 
>> 
>> 
>> At 2018-04-12 21:47:24, "lb" <liangbing64@126.com> wrote:
>> Hi, Sven,
>> Thank you very much,
>> But I am not familiar with HTTP. I recover to original code now.
>> when that occurs next time, I will copy the error stack here.
>> 
>> 
>> Best regards
>> 
>> Liang
>> 
>> 
>> 
>> At 2018-04-12 20:21:07, "Sven Van Caekenberghe" <sven@stfx.eu
>> > wrote:
>> >Hi Liang,
>> >
>> >Headers in HTTP (as represented/implemented by the ZnHeaders object in Pharo) can be multi-valued. That is, a certain header name (key) can occur more than once. That creates a multi-valued situation. For example, there can be multiple cookies being set. But almost always, there is only one header with a unique name.
>> >
>> >What you see must be the result of the 'Connection:close' header line being present twice. I would like to understand how that can happen. Do you have any idea ?
>> >
>> >I am also not sure (I should check) what the spec says.
>> >
>> >What is special here is that although the header line occurs twice, it has the same/identical value.
>> >
>> >In any case, it is the first time I hear about this situation.
>> >
>> >Sven 
>> >
>> >> On 12 Apr 2018, at 11:30, lb <
>> liangbing64@126.com
>> > wrote:
>> >> 
>> >> Hi,
>> >> my website always receives a sameAs: DNU from :
>> >> ZnMessage>>isConnectionClose
>> >>  | value |
>> >>  value := self headers at: 'Connection' ifAbsent: [ ^ false ].
>> >>  ^ value sameAs: 'close'
>> >> 
>> >> value is an Array like #('close' 'close').
>> >> 
>> >> I fix like this to avoid receiving DNU message.
>> >> isConnectionClose
>> >>  | value |
>> >>  value := self headers at: 'Connection' ifAbsent: [ ^ false ].
>> >>  value isArray ifTrue: [^ (value at: 1) sameAs: 'close'].
>> >>  value isString ifTrue: [^ value sameAs: 'close'].
>> >>  ^false
>> >> I can not confirm that fix is correct.
>> >> Liang
>> >> _______________________________________________
>> >> seaside mailing list
>> >> 
>> seaside@lists.squeakfoundation.org
>> 
>> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> >
>> >_______________________________________________
>> >seaside mailing list
>> >
>> seaside@lists.squeakfoundation.org
>> 
>> >http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> 
>> <PharoScreenshot.png>_______________________________________________
>> seaside mailing list
>> seaside@lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>_______________________________________________
>seaside mailing list
>seaside@lists.squeakfoundation.org
>http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
</pre></div>