From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.136.102 with SMTP id k99mr16127863iod.32.1449265402671; Fri, 04 Dec 2015 13:43:22 -0800 (PST) X-Received: by 10.182.53.234 with SMTP id e10mr110547obp.7.1449265402621; Fri, 04 Dec 2015 13:43:22 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!mv3no9320416igc.0!news-out.google.com!f6ni16318igq.0!nntp.google.com!mv3no11672107igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 4 Dec 2015 13:43:22 -0800 (PST) In-Reply-To: <19i08yxoly6r5.lk9snum67ier.dlg@40tude.net> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.99.95.2; posting-account=sDyr7QoAAAA7hiaifqt-gaKY2K7OZ8RQ NNTP-Posting-Host: 83.99.95.2 References: <17lytwwdndg6u.1o21jn6ox2sd4$.dlg@40tude.net> <2c489db5-0d14-4a1e-9883-cf018c3a0b83@googlegroups.com> <19i08yxoly6r5.lk9snum67ier.dlg@40tude.net> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Problem with Unbounded Strings From: Laurent Injection-Date: Fri, 04 Dec 2015 21:43:22 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:28644 Date: 2015-12-04T13:43:22-08:00 List-Id: On Friday, 4 December 2015 21:34:59 UTC+1, Dmitry A. Kazakov wrote: > On Fri, 4 Dec 2015 08:53:54 -0800 (PST), in comp.lang.ada you wrote: >=20 > > I don't use append? >=20 > No. There is nothing that is not in the buffer read already. Why would yo= u > append anything? >=20 > In some protocols payload data are accumulated from several packets. > Unbounded_String is not used for that either. You want to limit the size = of > the accumulated data to prevent DoS attacks unless the protocol limits th= at > already, as most protocols do. Simply keep the buffer in the communicatio= n > object, that is all. DoS attacks? Why should I care in this case. It is more an exercise/for fun= . If the guy from the company which installed the communication apps is rig= ht, then I won't need to suck this informations from the log files. For the= case that he is wrong and the informations haven't been stored somewhere o= n the server, the devs can write their own thing. I don't get paid for this= . Is still better than watching the crap on tv. > The point is to visit each source character just once and prevent excessi= ve > copying. That is also the reason why you practically never need or should > not use Unbounded_String for I/O. It won't make your life easier anyway. > You would have to convert it to String anytime you would use its contents > as your code demonstrates. The code will be cleaner, safer and many times > faster. I don't have the necessary skills/experience to argument about this.=20 I use the Unbounded Strings because I don't know in advance how many lines = the message will be long. So I collect everything in a buffer, appending th= e following lines, so that it makes sense and when the message is complete,= feed it to next procedure which slices of the interesting parts and uses t= hem to generate a message object which I store somewhere or whatever if I s= hould ever get so far. A short example from the log file. Every new line begins with the time stam= p. The only thing I want to get are those lines containing an and whic= h is behind. Because the length of the lines is fixed to 121 chars, everyth= ing which is too long gets hard wrapped. If I don't put everything together= I will lose informations, won't I? [19/09/2015 00:05:39:526][INFO ] <- [19/09/2015 00:05:39:564][INFO ] -> [19/09/2015 00:05:39:565][INFO ] <- [19/09/2015 00:05:39:565][INFO ] <- mtmpr|pi2015120412345|pnTest_Name|= pb08/08/1990|psF|si|ssURINES|stUrines spon [19/09/2015 00:05:39:650][INFO ] <- tanees|sp903775|pp903775|pa18/09/2= 015|s119/09/2015|s212:00|s319/09/2015|s412:04| [19/09/2015 00:05:39:735][INFO ] <- ci501509190001|ctAERO|sl100115|pl1= 00115|pda|sxA|zz| [19/09/2015 00:05:39:787][INFO ] <- 53 [19/09/2015 00:05:39:793][INFO ] <- [19/09/2015 00:05:39:834][INFO ] -> [19/09/2015 00:05:39:839][INFO ] <- [19/09/2015 01:37:43:096][WARN ] Handle event: TIMEOUT_EVENT HostResponseT= imeout (3000 milliseconds) [19/09/2015 01:37:43:096][INFO ] <- [19/09/2015 01:37:46:109][WARN ] Handle event: TIMEOUT_EVENT HostResponseT= imeout (3000 milliseconds) [19/09/2015 01:37:46:109][ERROR] Report Enq failure [19/09/2015 01:37:46:109][ERROR] Signal Enq failure [19/09/2015 01:37:46:109][INFO ] <- [19/09/2015 01:37:49:119][WARN ] Handle event: TIMEOUT_EVENT HostResponseT= imeout (3000 milliseconds) [19/09/2015 01:37:49:119][ERROR] Report Enq failure [19/09/2015 01:37:49:119][ERROR] Signal Enq failure [19/09/2015 01:37:49:119][INFO ] <- [19/09/2015 01:38:00:088][INFO ] <- [19/09/2015 01:38:03:096][WARN ] Handle event: TIMEOUT_EVENT HostResponseT= imeout (3000 milliseconds) [19/09/2015 01:38:03:096][INFO ] <- [19/09/2015 07:09:32:624][INFO ] -> [19/09/2015 07:09:32:624][INFO ] <- [19/09/2015 07:09:32:662][INFO ] -> [19/09/2015 07:09:32:782][INFO ] -> mtrsl|pi2015120412345|p2185|pp9063= 47|p5906347|si|s044587|ssHEMO|s5HEMO|ci5015091 [19/09/2015 07:09:32:879][INFO ] -> 70001|c044587|ctHEMOAE|ta|rtAST-N2= 64|rr11437321|t11|o1esccol|ra|a1tem|a3<=3D4|a4S| [19/09/2015 07:09:32:976][INFO ] -> ra|a1am|a3>=3D32|a4R|ra|a1amc|a38|= a4S|ra|a1tzp|a3<=3D4|a4S|ra|a1rox|a34|a4S|ra|a1tax [19/09/2015 07:09:33:072][INFO ] -> |a3<=3D1|a4S|ra|a1taz|a3<=3D1|a4S|= ra|a1fep|a3<=3D1|a4S|ra|a1etp|a3<=3D0,5|a4S|ra|a1mem|a [19/09/2015 07:09:33:169][INFO ] -> 3<=3D0,25|a4S|ra|a1an|a3<=3D2|a4S|= ra|a1gm|a3<=3D1|a4S|ra|a1cip|a3<=3D0,25|a4S|ra|a1lev|a [19/09/2015 07:09:33:266][INFO ] -> 3<=3D0,12|a4S|ra|a1tgc|a3<=3D0,5|a= 4S|ra|a1fos|a3<=3D16|a4S|ra|a1ftn|a3<=3D16|a4S|ra|a1sx [19/09/2015 07:09:33:309][INFO ] -> t|a3<=3D20|a4S|zz| [19/09/2015 07:09:33:309][INFO ] -> 1c [19/09/2015 07:09:33:332][INFO ] -> [19/09/2015 07:09:33:337][INFO ] <- [19/09/2015 07:09:33:375][INFO ] ->