Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors with Swim apps installed in folder names with characters that are disallowed in the URI syntax #56

Open
ajay-gov opened this issue Jun 10, 2020 · 0 comments
Assignees
Labels
C-bug Category: bug I-hangs Impact: process hangs

Comments

@ajay-gov
Copy link
Member

ajay-gov commented Jun 10, 2020

Consider an app with the following server.recon file:

tutorial: @fabric {
  @plane(class: "swim.tutorial.TutorialPlane")
}

@web(port: 9001) {
  space: "tutorial"
  documentRoot: "./ui/"
  @websocket {
    serverCompressionLevel: 0# -1 = default; 0 = off; 1-9 = deflate level
    clientCompressionLevel: 0# -1 = default; 0 = off; 1-9 = deflate level
  }
}

If this app is installed in a folder say: /home/user name/abc then it will fail with the following exception when it is run:

--> :1:28
  |
1 | /home/user name/abc
  |                            
        at swim.codec/swim.codec.Parser.error(Parser.java:142)
        at swim.uri/swim.uri.UriParser.parsePathString(UriParser.java:214)
        at swim.uri/swim.uri.UriPath.parse(UriPath.java:314)
        at swim.service.web/swim.service.web.WebServer.<init>(WebServer.java:62)
        at swim.service.web/swim.service.web.WebService.createServer(WebService.java:118)
        at swim.io.http/swim.io.http.HttpSocketService.createSocket(HttpSocketService.java:51)
        at swim.io/swim.io.TcpService.doAccept(TcpService.java:117)
        at swim.io/swim.io.StationTransport.doAccept(Station.java:453)
        at swim.io/swim.io.StationThread.doAccept(Station.java:1079)
        at swim.io/swim.io.StationThread.select(Station.java:1005)
        at swim.io/swim.io.StationThread.run(Station.java:882)

Note that this issue applies only for apps that have a DocumentRoot in the recon configuration file.
This occurs because the File's absolute path gets parsed into a Uri object which fails if the file path of the DocumentRoot has characters that aren't compliant with the URI syntax.

A possible solution would be to URI encode the absolute path of the File

@ajay-gov ajay-gov added the C-bug Category: bug label Jun 10, 2020
@ajay-gov ajay-gov self-assigned this Jun 10, 2020
@ajay-gov ajay-gov added the I-hangs Impact: process hangs label Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug I-hangs Impact: process hangs
Projects
None yet
Development

No branches or pull requests

1 participant