[twsocket] BNF2TCP creates socket automatons from a protocol's BNF

2011-04-30 Thread Stanislav

Hello, everybody!

Back in 2004 we have held here, on the twsockets mailing list, a discussion
regarding a possibility of implementing a general automaton capable of
handling almost any communication protocol using its BNF description.
I started to work on this idea in a short time after the discussion, but
unfortunately had to stop it after a while, and it has been suspended for
several years. Now I've managed to resume the process, and may announce a
pre-alpha product BNF2TCP. If someone is interested in the project and
has a will to participate, I can share with them the source codes under
the terms of non-disclosure agreement.
Public distribution is not planned until beta stage.

The program is written in C++, using (a little bit outdated) ICS twsockets
for communications, which can be easily replaced with latest components.
The program plays a role of a BNF editor/verifier/debugger and contains
core classes bringing the magic into life: a LL-parser and controllers
(automaton engines). The program utilizes a kinda extreme programming style
and has a lot of legacy code (don't forget the years of the cease), so it
needs a refactoring for adherence to good design principles and extension
according to requirements and use cases which were most likely overlooked
by myself.

For testing purposes simplified versions of a POP3-client and server have
been made. 


Here is how an excerpt of the BNF looks like:

  ...
SERVER ::= Start WaitAckListen
WaitAckListen ::= AckListen WaitCmdConnect
WaitCmdConnect ::= CmdConnect WaitAckAccept
WaitAckAccept ::= AckAccept SessionOpt | AckError Stopping
SessionOpt ::= Login | SomehowDisconnect
Login ::= CmdUser LoginAck
LoginAck ::= AckOK PasswordOpt | AckError SessionOpt
PasswordOpt ::= CmdPass PassAck | SomehowDisconnect
PassAck ::= AckOK Transaction | AckError SessionOpt
Transaction ::= CmdList ListAck | CmdStat StatAck | CmdRetr RetrAck | 
SomehowDisconnect
ListAck ::= AckListResult Transaction | AckError Transaction
StatAck ::= AckStatResult Transaction | AckError Transaction
RetrAck ::= AckRetrResult Transaction | AckError Transaction
QuitAck ::= AckOK Stopping
SomehowDisconnect ::= CmdQuit QuitAck | Stop
Stopping ::= AckDisconnect Stop
Stop ::= CmdDisconnected Idle
Idle ::= AckShutdown Down | AckStandBy WaitCmdConnect
Down ::= AckEnd

// =

CmdList ::= 'LIST' OptParam %x0D %x0A
OptParam ::= %x20 %msgnum%
%msgnum% ::= number
number ::= DIGIT digits
digits ::= number | _
DIGIT ::= %x30-%x39
+Delimiters=None
.
  ...

This is a portion of source code:

   // create automaton
   pSocketCtrl = new SocketController;

   // set some event handlers
   pSocketCtrl-OnGetSubSource = OnGetSubSourceEvent;
   pSocketCtrl-OnGetParam = OnGetCtrlParam;
   pSocketCtrl-OnSetParam = OnSetCtrlParam;
   pSocketCtrl-OnDisplay = OnCtrlDisplay;
   pSocketCtrl-OnError = OnCtrlError;

   // load BNF
   pSocketCtrl-LoadGrammar(asBNFGrammarFile);

   // run
   pSocketCtrl-Start();

I don't have a documentation yet, but can answer your questions. You can
contact me directly via e-mail, or on the list.
What I plan to do next is a BNF of IMAP client as a proof of concept.

Best wishes,
Stan
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] HTTP Location

2010-05-20 Thread Stanislav

Hi, Angus,

I'm not sure if it's valid, but it is used by server-side scripts for assigning
some cookies and reloading the same page under new conditions:

Location: /

It's up to the site to prevent looping.

Stan

- Original Message - 
From: Angus Robertson - Magenta Systems Ltd an...@magsys.co.uk

To: twsocket@elists.org
Sent: Thursday, May 20, 2010 1:12 PM
Subject: [twsocket] HTTP Location


Is it valid for an HHTP header to relocate to an empty URL? 


Currently, HttpProt seems to parse the relocation to the same URL, and
goes into a loop.   


 HTTP/1.1 302 Found
 Location: http://

Temporary Redirection: http://www.telecomstrader.com/ to:
http://www.telecomstrader.com/

Angus

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] HTTP Location

2010-05-20 Thread Stanislav

Not exactly what I said  ;-)

I said that irrespective to what RFC could imply, some sites intentionally
use redirection to the same location, and the site (server) should normally
prevent endless looping. If it's not, than indeed a client should protect itself
- whether it is implemented in HttpProt or outside. Other fields of http-header
except Location should be also considered for proper loop detection.
For example, the URL checker should accept and preserve cookies
between requests and alert looping only if cookies do not change.

It is not clear to me from the spec, but if it makes the express assertion that it SHOULD give the new URI in the response to 
non-HEAD requests, by omission it seems to me that it then MUST do so for HEAD.


Either way, I wouldn't rely on a URI being given, ever.  Like Stan said, it is 
up to the client to avoid loops.

dZ.


--
DZ-Jay [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Filtering HTTP content - an approach to choose

2010-04-27 Thread Stanislav

Hi, everybody!

I need to implement a kind of HTTP content filter for an end-user PC.
The easiest way is probably using a proxy like GpHTTPProxy. But it's a little 
bit
difficult to integrate the proxy into all existing browsers and ensure that it 
is not
switched off by unathorized user. Another option is to build some stuff
over WinPcap, but it's not good because the application will require
3-d party product to be installed. I'd prefer to build a self-contained
application, capable of analyzing traffic as firewalls and anti-viral software
do. Could someone suggest a source to start from? Any other approaches
to mention?

Thanks in advance.
Stan
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] WSAECONNABORTED (10053) when connecting to server

2010-04-27 Thread Stanislav

What is the servers you are trying to connect to? Microsoft products often use
abortion as a preferred method for disconnecting, i.e. they don't use graceful
close. As for the reason why the servers decided to disconnect - this is another
question. Suppose, some restriction on a number of concurrent connections
may by applied.


-Oorspronkelijk bericht-
Van: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] Namens
Anton Sviridov
Verzonden: dinsdag 27 april 2010 12:00
Aan: twsocket@elists.org
Onderwerp: [twsocket] WSAECONNABORTED (10053) when connecting to server

Hello all,
I faced strange issue in my app. I develop an application which opens ~15
connections to several servers, ~3-5 connections per server. After
establishing the connection it receives data flow.
But when I start it, some connections fail with WSAECONNABORTED (10053) -
and the oddest thing is that they fail after receiving some data. Reconnect
after 5 sec pause works fine.

I asked our admin, but he says the PC which my app runs on has no
restrictions on the router at all. Moreover, I have no problem on my own PC
with XP (PC where I run app has W2003 server). So it is unlikely bug in my
or ICS code.

I found description of MS bug here:
http://support.microsoft.com/?kbid=931319 and applied the patch provided,
but it only turned the things worse so I uninstalled it.

Do you have any advice? Maybe someone have already faced with such issue?

--
Anton
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] GpHTTPProxy v2.4 (the patched 2.0)

2010-04-21 Thread Stanislav

Unfortunately, I can't do that. As you may recollect, it took approx 1.5 years
for me to find a free time for fixing the bug. ICS has changed tremendously
during this period, and I did not follow the changes, alas. One of the reasons
for this is that the old version works stable and upgrade is needless.

As for the bug itself, the last discussion seems dated by september 2008,
under the subject GpHTTPProxy doesn't work correctly, so anybody who
wants to know about the issue, can search archives and read.


- Original Message - 
From: Francois PIETTE francois.pie...@skynet.be

To: ICS support mailing twsocket@elists.org
Sent: Wednesday, April 21, 2010 7:59 PM
Subject: Re: [twsocket] GpHTTPProxy v2.4 (the patched 2.0)



If  anybody wants to continue work on the GpHTTPProxy I would be happy
to   revoke any rights on that unit (except as the original author). I
would also change the license if required .


Maybe Stanislav will take the lead on this component ?

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] GpHTTPProxy v2.4 (the patched 2.0)

2010-04-20 Thread Stanislav

Hello everybody,

In the past some people have posted messages here exposing their interest in
a HTTP-proxy. They tried to use the GpHTTPProxy component, but it has one
critical bug with persistent connections.

Now it seems that I managed to fix the bug using the proprietary sources 
provided
by Primoz Gabrijelcic as a reference for me by a non-disclosure agreement.
As the agreement concerns the proprietary sources only, and the patched source
is the GpHTTPProxy indeed, I suppose the agreement does not cover the
patched version and it can be published. Moreover, Primoz seems
not having time (long since) for patching the stuff himself, and does not 
respond.
So, I think I could post or submit the patched version to the overbyte site.
The version is not thoroughly tested, and I can't provide a support for it,
because I work on it in my spare time. Also, the patch does not deal with
chunked encoding and leaves it unsupported.

Please, note that the original version of GpHTTPProxy used for the patch
is outdated with regard to ICS itslef, though this is the latest version of 
GpHTTPProxy
publicly available. I will NOT port the GpHTTPProxy v.2.4 to the latest ICS 
version
in the near future.

Francois, Wilfried, Arno,  Angus, fellows - what do you think?

Best wishes,
Stan Korotky.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Full URL decode (unescape)

2010-01-11 Thread Stanislav

I've looked at the module before writing the initial post.
What do you mean exactly? There is no a function for
unescaping.

- Original Message - 
From: Francois PIETTE francois.pie...@skynet.be

To: ICS support mailing twsocket@elists.org
Sent: Sunday, January 10, 2010 7:05 PM
Subject: Re: [twsocket] Full URL decode (unescape)



Have a look at OverbyteIcsUrl unit.

--
francois.pie...@overbyte.be
http://www.overbyte.be

- Original Message - 
From: Stanislav stas...@orc.ru

To: ICS support mailing twsocket@elists.org
Sent: Sunday, January 10, 2010 12:07 AM
Subject: [twsocket] Full URL decode (unescape)



Hi everyone,

Perhaps, this is a silly question, but I don't see a function for
unescaping URLs. HttpSrv module does have TextToHtmlText and
RemoveHtmlSpecialChars functions, but does not have anything
for reverse translation. UrlDecode does not look at html entities
either. Of course, we can code such things in our applications
on our own, but why doesn't HTTP server component (or IcsUrl)
provide unescaping, if it provides escaping? If I overlooked it,
please, point me out the place where to look at.

Best wishes,
Stanislav.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Full URL decode (unescape)

2010-01-11 Thread Stanislav

As I wrote, there is no a method to provide the reverse functionality for
TextToHtmlText and RemoveHtmlSpecialChars,
i.e. unescaping html entities, such as amp; etc., into single characters.

By the way, both names of the functions seems to be misleading, IMHO.
TextToHtmlText should read something like HtmlEntityEncode or
HtmlSpecialCharsEncode. RemoveHtmlSpecialChars looks like a
stripped down version of the TextToHtmlText. Why do we have both?

With the existing names used for back compatibility, I'd suggest to introduce
new alias (either of abovementioned). And add
HtmlEntity/SpecialCharsDecode of course.

- Original Message - 
From: Francois PIETTE francois.pie...@skynet.be

To: ICS support mailing twsocket@elists.org
Sent: Monday, January 11, 2010 9:35 PM
Subject: Re: [twsocket] Full URL decode (unescape)



UrlDecode ?
If this doesn't fit your need, please give an example of what you need.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

- Original Message - 
From: Stanislav stas...@orc.ru

To: ICS support mailing twsocket@elists.org
Sent: Monday, January 11, 2010 9:15 AM
Subject: Re: [twsocket] Full URL decode (unescape)



I've looked at the module before writing the initial post.
What do you mean exactly? There is no a function for
unescaping.

- Original Message - 
From: Francois PIETTE francois.pie...@skynet.be

To: ICS support mailing twsocket@elists.org
Sent: Sunday, January 10, 2010 7:05 PM
Subject: Re: [twsocket] Full URL decode (unescape)



Have a look at OverbyteIcsUrl unit.

--
francois.pie...@overbyte.be
http://www.overbyte.be

- Original Message - 
From: Stanislav stas...@orc.ru

To: ICS support mailing twsocket@elists.org
Sent: Sunday, January 10, 2010 12:07 AM
Subject: [twsocket] Full URL decode (unescape)



Hi everyone,

Perhaps, this is a silly question, but I don't see a function for
unescaping URLs. HttpSrv module does have TextToHtmlText and
RemoveHtmlSpecialChars functions, but does not have anything
for reverse translation. UrlDecode does not look at html entities
either. Of course, we can code such things in our applications
on our own, but why doesn't HTTP server component (or IcsUrl)
provide unescaping, if it provides escaping? If I overlooked it,
please, point me out the place where to look at.

Best wishes,
Stanislav.
--


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Full URL decode (unescape)

2010-01-09 Thread Stanislav

Hi everyone,

Perhaps, this is a silly question, but I don't see a function for
unescaping URLs. HttpSrv module does have TextToHtmlText and
RemoveHtmlSpecialChars functions, but does not have anything
for reverse translation. UrlDecode does not look at html entities
either. Of course, we can code such things in our applications
on our own, but why doesn't HTTP server component (or IcsUrl)
provide unescaping, if it provides escaping? If I overlooked it,
please, point me out the place where to look at.

Best wishes,
Stanislav.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Smoothed and weighted round robin distribution

2009-12-15 Thread Stanislav

Hi, everybody,

I need to implement a kind of weighted round robin distribution
for HTTP ICS-based reverse-proxy. I've found some info about
packets distribution but neither about users (sessions) distribution.
The difference is that, according to the algorithms, packets can be
left in a queue (so load balancing is achieved), while users should not.

The given data is a list of N servers and their relative weights W[n].

Could someone suggest a link for appropriate algorithm?

I tried to use the well-known round robin modification of constructing
a virtual cicrle, divided into N sectors, each of which is proportional
to corresponding server weight. But it may produce very uneven
distribution in time, that is for a period it draws a series with some
servers probabilities far from their weights, then it begins to draw
a series with other servers probabilities far from their weights.
I could show an example, but it's not necessary, I think.
For a large period the mean values approximate to the weights.
But I'd like to have a short time smooth distribution.

Thanks in advance.

Best wishes,
Stanislav Korotky.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Clustering/failover support for ICS servercomponents--especially Web Server

2009-10-23 Thread Stanislav

Hello,

Don't you think that reverse-proxy is sufficient for that purposes, with no need
to modify servers themselves? Failover facilities should be external to
a server, imho, because they may fail if they are embedded into a server
which undergoes a failure.

Best wishes,
Stanislav Korotky.

- Original Message - 
From: Fastream Technologies ga...@fastream.com

To: ICS support mailing twsocket@elists.org
Sent: Friday, October 23, 2009 11:29 AM
Subject: [twsocket] Clustering/failover support for ICS 
servercomponents--especially Web Server



Hello,

I wonder if this is in somebody's to-do list. Don't you see the demand I see
in this? If so, maybe we can collect money similar to what we did for the
ICS-SSL project which succeeded.

Best Regards,

SubZero
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TPop3Cli is halted while receiving a message over 4Mb

2005-07-27 Thread Stanislav Korotky
 (taking into account that
 they disclose themselves in such a negligible, infrequent manner)?

Do you mean that it doesn't always occur with the same 4MB message ?

Yes. Today the program fetches the same message (it remains on a server)
successfully (several times for testing).

Now I can't investigate the matter, alas.

Best wishes,
Stanislav Korotky,
Russia, Moscow, CET +02:00

--
[EMAIL PROTECTED]
http://www.overbyte.be



-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] TPop3Cli is halted while receiving a message over 4 Mb

2005-07-26 Thread Stanislav Korotky
Hello All!

I use TPop3Cli in my application. I thought it worked well so far,
but I've just stumbled on a strange thing. The application tries
to fetch new message with a size over 4 Mb. According to a progress
indicator I have in the application the message is downloaded till
97% but the rest of it never arrives, i.e. there is no more data
available to an underlying socket, and the application waits the
missing data for ever (actually, timeout). An ordinary mail client
fetches the same message without a problem. I do understand that this
seems to be a bug in my application, but considering that the application
successfully works with million (!) of messages since several last years
(i.e. it is tested to a certain degree) and does not produce any
exceptions under debugger I don't have an idea how to track down
problems with such a message. Could someone imagine mistakes of any
kind which could lead to similiar symptoms (taking into account that
they disclose themselves in such a negligible, infrequent manner)?

Best wishes,
Stanislav Korotky,
Russia, Moscow, CET +02:00


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] How to determine DNS settings?

2005-07-11 Thread Stanislav Korotky
Hello All!

Is it possible to determine current DNS address used by a system
if DNS is obtained automatically, that is DNS is not written into
the registry?

Best wishes,
Stanislav Korotky,
Russia, Moscow, CET +02:00



-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be