aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
2017-05-09open_steam(): Parse URL inputTeddy Wing
Parse the URL coming in from the TCP stream to check that it's a valid URL. This allows us to fail early and not try to open strings that are not URLs. Leverage the "url" crate to do the parsing. Return a `Box<Error>` from `open_stream()` to enable us to return either an `io` or a `Url` error in our `Result`. Remove the `trim_right()` call on `url` since it's now a `Url` type instead of a `String`, and as a result of parsing to a `Url`, it no longer has the problematic trailing newline.
2017-05-07open_stream(): Remove hard-coded browser & portTeddy Wing
Instead get these from function arguments, which in turn get fed from the command line arguments passed by the user.
2017-05-07main.rs: Add a constant for default portTeddy Wing
Remove the magic number and replace it with a named value.
2017-05-07main.rs: Add port command line optionTeddy Wing
Provide users with an option to change the default port the program listens on.
2017-05-07main.rs: Match `Option` when setting browserTeddy Wing
Instead of checking for the presence of the `-b` option before setting it, just use an `Option` match since `opt_str` returns an `Option<String>`.
2017-05-07main.rs: Add browser optionTeddy Wing
This will be used to set the browser to open URLs in.
2017-05-07main.rs: Add command line options parsingTeddy Wing
Use Getopts to parse command line options. Currently only has a 'help' option, but this lays the foundation for user-customisable browser and port values.
2017-04-13main.rs: Clean up `main` error handlingTeddy Wing
Remove the `match` call from efa7f80d962aa0f55f3addbac1da206538d9242e and use `unwrap_or_else` instead since we don't need to do anything extra in the `Ok` case.
2017-04-13main.rs: Handle `main` errorsTeddy Wing
Print all errors to STDERR.
2017-04-13main.rs: Open the stream input in OperaTeddy Wing
Use the Mac OS X `open` command to open Opera and pass in the contents of the TCP stream as an argument, assuming it to be a URL that should be opened in the browser. Only dealing with the `open` command for now. Will be extending this to support user-customisable browsers, so that any GUI browser that can be opened with `open` can be used.
2017-04-13main.rs: Add `try!` around STDERR writerTeddy Wing
The call to write to STDERR returns a `Result`. Wrap it in a `try!` to handle the result and eliminate the "unused result" compilation warning.
2017-04-13main.rs: Remove unused import TcpStreamTeddy Wing
We only need the `TcpListener` for what we're doing.
2017-04-13main.rs: Write TCP stream errors to STDERRTeddy Wing
2017-04-13main.rs: Get rid of UDP codeTeddy Wing
Going with TCP as that seems like it will work well. Get rid of our UDP code.
2017-04-13main.rs: Try out TcpListenerTeddy Wing
Replicate the TcpListener example from the Rust standard library docs. Using TCP instead of UDP allows us to read directly to a string and read arbitrary length streams. Here we just print the stream input to the console.
2017-03-16main.rs: Copy UdpSocket example to test out socketsTeddy Wing
Copies the example given at https://doc.rust-lang.org/std/net/struct.UdpSocket.html to experiment with receiving and sending data over the socket.
2017-03-16Initial commit. Base project generated from `cargo init`.Teddy Wing
Rust v1.13.0. $ cargo init --bin