Re: [reSIProcate] Fast streams encode std::endl incorrectly on *nix systems
Quick scan for std::endl usages with possible issues:
* repro's webadmin uses some std::endl when writing HTML
* CertMessage uses endl when encoding a MessageId.
* EncryptionRequest::encode
Thanks,
-justin
-----Original Message-----
From: Robert Sparks [mailto:rjsparks@xxxxxxxxxxx]
Sent: Tuesday, December 02, 2008 12:07 PM
To: Justin Matthews
Cc: 'Byron Campen'; 'resiprocate-devel@xxxxxxxxxxxxxx'
Subject: Re: [reSIProcate] Fast streams encode std::endl incorrectly on *nix
systems
I wasn't trying to suggest the change was wrong, and I agree with your
assessment.
My point was to get anyone who's down in that code to think if they've
seen places where someone wrote something that assumed that CRLF when
building SIP or SDP. Its not been around long enough for there to be
much of that I suppose.
RjS
On Dec 2, 2008, at 10:47 AM, Justin Matthews wrote:
> The STL libraries that I checked use '\n' for std::ostream/std::endl
> processing. The faststream implementation was using "\r\n", so I
> would
> think that if anything the faststream implementation would break
> existing
> code. This change modifies faststream to behave the same as the
> default STL
> std::ostream encoding. Unless I misunderstood your comment.
>
> Thanks,
>
> -justin
>
> -----Original Message-----
> From: Robert Sparks [mailto:rjsparks@xxxxxxxxxxx]
> Sent: Tuesday, December 02, 2008 10:51 AM
> To: Justin Matthews
> Cc: Byron Campen; resiprocate-devel@xxxxxxxxxxxxxx
> Subject: Re: [reSIProcate] Fast streams encode std::endl incorrectly
> on *nix
> systems
>
> (resending - apologies if this is a duplicate):
>
> Its probably worth skimming to make sure nothing was counting on that
> \r\n behavior when encoding SIP messages
> (which require CRLF regardless of platform).
>
> RjS
>
> On Dec 1, 2008, at 7:35 PM, Justin Matthews wrote:
>
>> Done. Let me know if you have issues.
>>
>> Thanks,
>>
>>
>> -justin
>>
>> -----Original Message-----
>> From: Byron Campen [mailto:bcampen@xxxxxxxxxxxx]
>> Sent: Monday, December 01, 2008 8:28 PM
>> To: Justin Matthews
>> Cc: 'resiprocate-devel@xxxxxxxxxxxxxx'
>> Subject: Re: [reSIProcate] Fast streams encode std::endl incorrectly
>> on *nix
>> systems
>>
>> Ok, fine by me!
>>
>> Best regards,
>> Byron Campen
>>
>>> I think we can change this to '\n' for all platforms, Visual C++
>>> actually
>>> uses '\n' for its STL implementation. Not sure why "\r\n" was
>>> picked :-).
>>>
>>> Thanks,
>>>
>>> -justin
>>>
>>> -----Original Message-----
>>> From: resiprocate-devel-bounces@xxxxxxxxxxxxxxx
>>> [mailto:resiprocate-devel-bounces@xxxxxxxxxxxxxxx] On Behalf Of
>>> Byron Campen
>>> Sent: Monday, December 01, 2008 8:01 PM
>>> To: resiprocate-devel@xxxxxxxxxxxxxx
>>> Subject: [reSIProcate] Fast streams encode std::endl incorrectly on
>>> *nix
>>> systems
>>>
>>> On *nix systems, std::endl is encoded as '\n', but the following
>>> code in resipfaststreams.hxx encodes it as "\r\n"
>>>
>>> *snip*
>>> if (_Pfn == static_cast<std::ostream& (*)
>>> (std::ostream&)>(std::endl))
>>> {
>>> if (buf_->writebuf("\r\n",2) < 2)
>>> {
>>> good_ = false;
>>> }
>>> }
>>>
>>> *snip*
>>>
>>> Is there going to be an easy way to make this behavior consistent
>>> with whatever the platform does? Just using an #ifdef WIN32 won't
>>> get this
>>> quite right, but it may be good enough for us. Thoughts?
>>>
>>> Best regards,
>>> Byron Campen
>>>
>>>
>>
>> _______________________________________________
>> resiprocate-devel mailing list
>> resiprocate-devel@xxxxxxxxxxxxxxx
>> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
>