FAQ
Bonjour tout le monde,

Just a quick question about the http 2 library.
http.Server.ListenAndServeTLS() appends “http/1.1” to config.NextProtos after running the http2 setup function. However if I want to use a custom net.Listener with http.Server.Serve(), but I can’t have “http/1.1” in config.NextProtos.
http.Server.Serve() doesn’t append it and If I add it myself before I call http.Server.Serve(), the “http/1.1” at the front of config.NextProtos prevents http2.

Its not a big problem, but thoughts?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Brad Fitzpatrick at Mar 25, 2016 at 10:33 pm
    Got code? I'm a little confused by what some of your "it" words refer to.

    For example, you wrote "http.Server.Serve() doesn’t append it and If I add
    it myself"

    Reading that sentence in isolation, there doesn't seem to be a problem,
    because "it" doesn't need to be added twice.

    But seeing your code might clarify.

    On Fri, Mar 25, 2016 at 9:39 PM, Anmol Sethi wrote:

    Bonjour tout le monde,

    Just a quick question about the http 2 library.
    http.Server.ListenAndServeTLS() appends “http/1.1” to config.NextProtos
    after running the http2 setup function. However if I want to use a custom
    net.Listener with http.Server.Serve(), but I can’t have “http/1.1” in
    config.NextProtos.
    http.Server.Serve() doesn’t append it and If I add it myself before I call
    http.Server.Serve(), the “http/1.1” at the front of config.NextProtos
    prevents http2.

    Its not a big problem, but thoughts?

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Anmol Sethi at Mar 26, 2016 at 1:30 pm
    I was setting config.NextProtos like this

    config.NextProtos = []string{"http/1.1"}

    I called Server.Serve() with a custom listener, but then after the http2 setup, “h2” and “h2-14” were appended to make it look like this:

    config.NextProtos = []string{"http/1.1”, "h2", "h2-14”}

    Since in this case, "http/1.1” is first, it was being used instead of http 2.

    So one solution is to set config.NextProtos like this before calling Server.Serve():

    config.NextProtos = []string{"h2", "http/1.1”}

    After http2 setup, it looks like this:

    config.NextProtos = []string{"h2", "http/1.1”, “h2-14"}

    Is it fine to have “h2-14” at the end? I didn’t add it in the initialization because the http2 setup function never checks if its already there, it always appends it.
    On Mar 25, 2016, at 6:33 PM, Brad Fitzpatrick wrote:

    Got code? I'm a little confused by what some of your "it" words refer to.

    For example, you wrote "http.Server.Serve() doesn’t append it and If I add it myself"

    Reading that sentence in isolation, there doesn't seem to be a problem, because "it" doesn't need to be added twice.

    But seeing your code might clarify.


    On Fri, Mar 25, 2016 at 9:39 PM, Anmol Sethi wrote:
    Bonjour tout le monde,

    Just a quick question about the http 2 library.
    http.Server.ListenAndServeTLS() appends “http/1.1” to config.NextProtos after running the http2 setup function. However if I want to use a custom net.Listener with http.Server.Serve(), but I can’t have “http/1.1” in config.NextProtos.
    http.Server.Serve() doesn’t append it and If I add it myself before I call http.Server.Serve(), the “http/1.1” at the front of config.NextProtos prevents http2.

    Its not a big problem, but thoughts?

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Brad Fitzpatrick at Mar 26, 2016 at 8:49 pm
    "h2" and "h2-14" are basically equivalent. It's harmless, but I'll probably
    remove it before Go 1.7.

    On Sun, Mar 27, 2016 at 12:30 AM, Anmol Sethi wrote:

    I was setting config.NextProtos like this

    config.NextProtos = []string{"http/1.1"}

    I called Server.Serve() with a custom listener, but then after the http2
    setup, “h2” and “h2-14” were appended to make it look like this:

    config.NextProtos = []string{"http/1.1”, "h2", "h2-14”}

    Since in this case, "http/1.1” is first, it was being used instead of http
    2.

    So one solution is to set config.NextProtos like this before calling
    Server.Serve():

    config.NextProtos = []string{"h2", "http/1.1”}

    After http2 setup, it looks like this:

    config.NextProtos = []string{"h2", "http/1.1”, “h2-14"}

    Is it fine to have “h2-14” at the end? I didn’t add it in the
    initialization because the http2 setup function never checks if its already
    there, it always appends it.
    On Mar 25, 2016, at 6:33 PM, Brad Fitzpatrick wrote:

    Got code? I'm a little confused by what some of your "it" words refer to.

    For example, you wrote "http.Server.Serve() doesn’t append it and If I
    add it myself"
    Reading that sentence in isolation, there doesn't seem to be a problem,
    because "it" doesn't need to be added twice.
    But seeing your code might clarify.


    On Fri, Mar 25, 2016 at 9:39 PM, Anmol Sethi wrote:
    Bonjour tout le monde,

    Just a quick question about the http 2 library.
    http.Server.ListenAndServeTLS() appends “http/1.1” to config.NextProtos
    after running the http2 setup function. However if I want to use a custom
    net.Listener with http.Server.Serve(), but I can’t have “http/1.1” in
    config.NextProtos.
    http.Server.Serve() doesn’t append it and If I add it myself before I
    call http.Server.Serve(), the “http/1.1” at the front of config.NextProtos
    prevents http2.
    Its not a big problem, but thoughts?

    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 25, '16 at 10:39a
activeMar 26, '16 at 8:49p
posts4
users2
websitegolang.org

2 users in discussion

Anmol Sethi: 2 posts Brad Fitzpatrick: 2 posts

People

Translate

site design / logo © 2021 Grokbase