Skip to content

🪲: stalwart-cli: JMAP-related actions fail when target host/listener on non-standard port #2221

@se2342

Description

@se2342

What happened?

stalwart-cli fails on JMAP-related actions with Aborting redirect request to unknown host when trying to use an URL that contains a non-standard port, such as http://localhost:8080.

Why is this happening (my humble research)

Consider the following function:

pub fn host(url: &str) -> Option<&str> {

The function is being called in the setup code of the JMAP client:

.follow_redirects([host(&self.url).expect("Invalid host").to_owned()])

Because of the nature of comparison that happens within the JMAP client, this always results in an error (jumps to the else condition of the comparison within stalwart-cli's code):

https://github.com/stalwartlabs/jmap-client/blob/ed12a1286252cff9a0d1b06fe94b7e83fad2126e/src/client.rs#L221

How can we reproduce the problem?

  • Set up an HTTP listener with a non-default port, i.e. HTTP on localhost:8080. Try to pass it to stalwart-cli as URL argument. stalwart-cli will fail to work.
  • Move the HTTP listener to port 80 and omit the port in the URL entirely: Then the CLI will work.

Version

v0.13.x

What database are you using?

RocksDB

What blob storage are you using?

Filesystem

Where is your directory located?

Internal

What operating system are you using?

Linux

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions