FAQ
This is probably as designed, but I thought I post this just in case it
isn't:

In Hugo we have a Travis build set up for Go 1.4.3, 1.5.2 and tip. Recently
we started to get failures from a test using the http test server, see:

https://github.com/spf13/hugo/blob/dd2ab2820ec9f894d56b7917a39dfdff5774075d/tpl/template_resources_test.go#L120-L122

Two issues:

1. Without the change above, on 1.6 the endpoint returned "400 Bad Request:
malformed Host header".

2. After adding a dummy value to request.Host, the test passes on 1.6, but fails on 1.4.3 with an empty body and no error.

So I added the Golang version check to make it pass on all three.

Don't ask me about the test code or the code under test -- I didn't write it, so you can read it as well as me.

About 1): If I read the documentation correctly, shouldn't the the Host header for clients inherit its from the URL.Host if not set?

bep




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

Search Discussions

  • Brad Fitzpatrick at Dec 18, 2015 at 9:50 pm
    Why are you setting the Host to "Host: foo" instead of just "foo"?

    On Fri, Dec 18, 2015 at 1:45 PM, Bjørn Erik Pedersen wrote:

    This is probably as designed, but I thought I post this just in case it
    isn't:

    In Hugo we have a Travis build set up for Go 1.4.3, 1.5.2 and tip.
    Recently we started to get failures from a test using the http test server,
    see:


    https://github.com/spf13/hugo/blob/dd2ab2820ec9f894d56b7917a39dfdff5774075d/tpl/template_resources_test.go#L120-L122

    Two issues:

    1. Without the change above, on 1.6 the endpoint returned "400 Bad
    Request: malformed Host header".

    2. After adding a dummy value to request.Host, the test passes on 1.6, but fails on 1.4.3 with an empty body and no error.

    So I added the Golang version check to make it pass on all three.

    Don't ask me about the test code or the code under test -- I didn't write it, so you can read it as well as me.

    About 1): If I read the documentation correctly, shouldn't the the Host header for clients inherit its from the URL.Host if not set?

    bep




    --
    You received this message because you are subscribed to the Google Groups
    "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-dev+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-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Bjørn Erik Pedersen at Dec 18, 2015 at 10:07 pm
    I spent 20 seconds reading the "HTTP Host header spec" ... And I might have
    read it wrong. But I was happy to get a green test ...

    bep

    fredag 18. desember 2015 22.50.22 UTC+1 skrev Brad Fitzpatrick følgende:
    Why are you setting the Host to "Host: foo" instead of just "foo"?


    On Fri, Dec 18, 2015 at 1:45 PM, Bjørn Erik Pedersen <
    bjorn.eri...@gmail.com <javascript:>> wrote:
    This is probably as designed, but I thought I post this just in case it
    isn't:

    In Hugo we have a Travis build set up for Go 1.4.3, 1.5.2 and tip.
    Recently we started to get failures from a test using the http test server,
    see:


    https://github.com/spf13/hugo/blob/dd2ab2820ec9f894d56b7917a39dfdff5774075d/tpl/template_resources_test.go#L120-L122

    Two issues:

    1. Without the change above, on 1.6 the endpoint returned "400 Bad
    Request: malformed Host header".

    2. After adding a dummy value to request.Host, the test passes on 1.6, but fails on 1.4.3 with an empty body and no error.

    So I added the Golang version check to make it pass on all three.

    Don't ask me about the test code or the code under test -- I didn't write it, so you can read it as well as me.

    About 1): If I read the documentation correctly, shouldn't the the Host header for clients inherit its from the URL.Host if not set?

    bep




    --
    You received this message because you are subscribed to the Google Groups
    "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-dev+...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Brad Fitzpatrick at Dec 18, 2015 at 10:25 pm
    You were reading the wrong docs. :) You should read the Go docs instead of
    the HTTP wire format docs. Since Go's speaking HTTP for you, you don't have
    have to format it as it appears on the wire.

    What was it trying to test with the unicode in the domain name?

    On Fri, Dec 18, 2015 at 2:07 PM, Bjørn Erik Pedersen wrote:

    I spent 20 seconds reading the "HTTP Host header spec" ... And I might
    have read it wrong. But I was happy to get a green test ...

    bep

    fredag 18. desember 2015 22.50.22 UTC+1 skrev Brad Fitzpatrick følgende:
    Why are you setting the Host to "Host: foo" instead of just "foo"?


    On Fri, Dec 18, 2015 at 1:45 PM, Bjørn Erik Pedersen <
    bjorn.eri...@gmail.com> wrote:
    This is probably as designed, but I thought I post this just in case it
    isn't:

    In Hugo we have a Travis build set up for Go 1.4.3, 1.5.2 and tip.
    Recently we started to get failures from a test using the http test server,
    see:


    https://github.com/spf13/hugo/blob/dd2ab2820ec9f894d56b7917a39dfdff5774075d/tpl/template_resources_test.go#L120-L122

    Two issues:

    1. Without the change above, on 1.6 the endpoint returned "400 Bad
    Request: malformed Host header".

    2. After adding a dummy value to request.Host, the test passes on 1.6, but fails on 1.4.3 with an empty body and no error.

    So I added the Golang version check to make it pass on all three.

    Don't ask me about the test code or the code under test -- I didn't write it, so you can read it as well as me.

    About 1): If I read the documentation correctly, shouldn't the the Host header for clients inherit its from the URL.Host if not set?

    bep




    --
    You received this message because you are subscribed to the Google
    Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-dev+...@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-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-dev+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-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Bjørn Erik Pedersen at Dec 18, 2015 at 10:43 pm
    Yea, removing the "Host:" prefix and not it tests fine on both 1.4.3, 1.5.2
    and 1.6.

    About the Unicode test: I have no idea: I have written a lot of the code in
    Hugo, but not that particular part.

    bep

    fredag 18. desember 2015 23.25.29 UTC+1 skrev Brad Fitzpatrick følgende:
    You were reading the wrong docs. :) You should read the Go docs instead of
    the HTTP wire format docs. Since Go's speaking HTTP for you, you don't have
    have to format it as it appears on the wire.

    What was it trying to test with the unicode in the domain name?


    On Fri, Dec 18, 2015 at 2:07 PM, Bjørn Erik Pedersen <
    bjorn.eri...@gmail.com <javascript:>> wrote:
    I spent 20 seconds reading the "HTTP Host header spec" ... And I might
    have read it wrong. But I was happy to get a green test ...

    bep

    fredag 18. desember 2015 22.50.22 UTC+1 skrev Brad Fitzpatrick følgende:
    Why are you setting the Host to "Host: foo" instead of just "foo"?


    On Fri, Dec 18, 2015 at 1:45 PM, Bjørn Erik Pedersen <
    bjorn.eri...@gmail.com> wrote:
    This is probably as designed, but I thought I post this just in case it
    isn't:

    In Hugo we have a Travis build set up for Go 1.4.3, 1.5.2 and tip.
    Recently we started to get failures from a test using the http test server,
    see:


    https://github.com/spf13/hugo/blob/dd2ab2820ec9f894d56b7917a39dfdff5774075d/tpl/template_resources_test.go#L120-L122

    Two issues:

    1. Without the change above, on 1.6 the endpoint returned "400 Bad
    Request: malformed Host header".

    2. After adding a dummy value to request.Host, the test passes on 1.6, but fails on 1.4.3 with an empty body and no error.

    So I added the Golang version check to make it pass on all three.

    Don't ask me about the test code or the code under test -- I didn't write it, so you can read it as well as me.

    About 1): If I read the documentation correctly, shouldn't the the Host header for clients inherit its from the URL.Host if not set?

    bep




    --
    You received this message because you are subscribed to the Google
    Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-dev+...@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-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-dev+...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Brad Fitzpatrick at Dec 18, 2015 at 9:53 pm
    The issue is probably this test line:

    {"http://Doppel.Gänger/foo_Bar-Foo <http://doppel.xn--gnger-gra/foo_Bar-Foo>",
    []byte(`T€st Cont€nt 123`), false},

    The a umlaut is being sent literally as UTF-8 bytes in the host header by
    Go's HTTP client, but Go's HTTP server now rejects it.

    I'll file a bug.

    On Fri, Dec 18, 2015 at 1:45 PM, Bjørn Erik Pedersen wrote:

    This is probably as designed, but I thought I post this just in case it
    isn't:

    In Hugo we have a Travis build set up for Go 1.4.3, 1.5.2 and tip.
    Recently we started to get failures from a test using the http test server,
    see:


    https://github.com/spf13/hugo/blob/dd2ab2820ec9f894d56b7917a39dfdff5774075d/tpl/template_resources_test.go#L120-L122

    Two issues:

    1. Without the change above, on 1.6 the endpoint returned "400 Bad
    Request: malformed Host header".

    2. After adding a dummy value to request.Host, the test passes on 1.6, but fails on 1.4.3 with an empty body and no error.

    So I added the Golang version check to make it pass on all three.

    Don't ask me about the test code or the code under test -- I didn't write it, so you can read it as well as me.

    About 1): If I read the documentation correctly, shouldn't the the Host header for clients inherit its from the URL.Host if not set?

    bep




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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedDec 18, '15 at 9:45p
activeDec 18, '15 at 10:43p
posts6
users2
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase