Giter Club home page Giter Club logo

Comments (5)

svenstaro avatar svenstaro commented on April 27, 2024 1

Fixed in v0.2.0.

from miniserve.

svenstaro avatar svenstaro commented on April 27, 2024

Good idea. Will do. Of course, you can also go ahead and make a PR if you would like to take a stab at this yourself.

from miniserve.

hellow554 avatar hellow554 commented on April 27, 2024

I just discovered, that it is already capable of running Ipv6, just pass e.g. :: as interface and it will serve it just fine.

cargo run --release -- -i '::' .
    Finished release [optimized] target(s) in 1.25s
    Running `target/release/miniserve -i '::' .`
miniserve is serving your files at http://:::8080
Currently serving path /tmp/tmp.Mkfpy6fbam/miniserve

(please note the "wrong" format:

http://:::8080
       ^-- here

it should be http://[::]:8080)

There is a problem though.
On linux, it will bind on both, IPv4 and IPv6. On windows on the otherhand, it will only bind on either (source).
So I have a few ideas in mind.

  1. Check if it is an IPv6 addr and try to bind on both. This will mean we get an error on Linux, but not on windows. Shall be check the OS (on compile- or runtime?) and do different things?
  2. Check explicitly in is_valid_interface for Ipv4 addr (which is trivial :) ) and only accept IPv4 addr on --if and add another option (maybe --if6)?
  3. When default is given (no --if parameter at all) do a double bind, and only if either option is given (--if or --if6) bind to that protocol but not on the other (unless both options are given)
  4. ??? -> Profit?

from miniserve.

svenstaro avatar svenstaro commented on April 27, 2024

One more note: If it is an IPv6, the URL should be displayed like this: `http://[::]:8080'.

from miniserve.

svenstaro avatar svenstaro commented on April 27, 2024

@hellow554 Thanks for considering this so thoroughly!

About your 1.: I don't quite understand. How would you even go about binding on both interfaces if you provide an IPv6? It could just be that an interface does not even have an IPv4 even if it has an IPv6. Basically, I think that if an explicit IPv4 or IPv6 is given, we should not try to bind on anything except those provided.

I think --if should accept both IPv6 and IPv4. There doesn't really seem to be an issue with that. Also, we should allow for --if to be called multiple times.

  1. I agree with this. It should try to bind on all interfaces on both protocols in the correct way on all OS.

from miniserve.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.