winddriver/Delphi-Cross-Socket

正则处理是不有问题。

Closed this issue · 9 comments

          正则处理是不有问题。

.Get('/json|/queryjson|/queryip|/query'。。。。。。
.Get('/str|/querystr/'。。。。。。
结果/querystr匹配到第一个里面去了

Originally posted by @wr960204 in #137 (comment)

实测未发现问题,麻烦发有问题的测试工程源码

时灵时不灵,我先研究一下。有问题我把代码发给你帮我看看

是我的问题,在Centos上旧的进程没有退出,新的进程又在运行。居然几个进程同时监听同一个端口,有的进程是老的,有的是新的。所以表现是时灵时不灵。

因为默认启用了端口复用,所以多个进程是可以监听同一个端口的

改进了正则匹配,拉最新版代码再试试

兄弟更新版加参数没问题了,但是又带来了新的问题。
例子如下:
lHttpServer.Get('/Test',
procedure(const ARequest: ICrossHttpRequest;
const AResponse: ICrossHttpResponse; var AHandled: Boolean)
begin

    AResponse.Send('(1)Test');
  end).Get('/json|/queryjson|/queryip|/query',
  procedure(const ARequest: ICrossHttpRequest;
    const AResponse: ICrossHttpResponse; var AHandled: Boolean)
  begin
    AResponse.Send('(2)' + ARequest.Path);
  end).Get('/str|/querystr',
  procedure(const ARequest: ICrossHttpRequest;
    const AResponse: ICrossHttpResponse; var AHandled: Boolean)
  begin
    AResponse.Send('(3)' + ARequest.Path);
  end);

访问/querystr的时候走道的是(2)这个流程,而不是预期的(3).
也就是带参数可以正确匹配了,不带参数反而匹配出错。

又更新了一版,再试试

OK.这次正常了。
十分感激!