FAQ
I have a problem passing "#" in URL to my http server:
func getVal(r *http.Request, key string) string {
     q := r.URL.Query()
     return q.Get(key)
}
func handler(w http.ResponseWriter, r *http.Request) {
...
case "/SetName":
         tmp := getVal(r, "name")
         fmt.Printf("name=%s len=%d\n", tmp, len(tmp))
...
}
func main() {
..
http.HandleFunc("/", handler)
     err := http.ListenAndServe("0.0.0.0:9092", nil)
     if err != nil {
         printf(ERR, "%v\n", err)
     }
}
  When i try to call "curl http://localhost:9092/SetName?name=is#victor"
server prints "is", looks as "Get" drops the rest after "#" ...
How can i handle this problem in server-side code without passing "special
sequences" in url?
Thanks,

--
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

  • James Bardin at Jan 5, 2016 at 4:58 pm

    On Tuesday, January 5, 2016 at 11:52:33 AM UTC-5, Victor L wrote:

    When i try to call "curl http://localhost:9092/SetName?name=is#victor"
    server prints "is", looks as "Get" drops the rest after "#" ...
    How can i handle this problem in server-side code without passing "special
    sequences" in url?
    Thanks,
    Fragments only exist in the context of the client, they're never net to the
    server.

    https://en.wikipedia.org/wiki/Fragment_identifier

    --
    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.
  • James Bardin at Jan 5, 2016 at 4:59 pm

    On Tuesday, January 5, 2016 at 11:57:54 AM UTC-5, James Bardin wrote:

    Fragments only exist in the context of the client, they're never net to
    the server.
    that is, "never sent to the server"

    --
    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.
  • Manlio Perillo at Jan 5, 2016 at 5:02 pm
    Il giorno martedì 5 gennaio 2016 17:52:33 UTC+1, Victor L ha scritto:
    I have a problem passing "#" in URL to my http server:
    From https://en.wikipedia.org/wiki/Fragment_identifier:
    "The fragment identifier functions differently than the rest of the URI:
    namely, its processing is exclusively client-side
    <https://en.wikipedia.org/wiki/Client_(computing)> with no participation
    from the web server <https://en.wikipedia.org/wiki/Web_server>"
    [...]
    Regards Manlio

    --
    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.
  • Victor L at Jan 5, 2016 at 5:05 pm
    ok, how can i set it on the client side?
    Thanks again
    On Tue, Jan 5, 2016 at 12:02 PM, Manlio Perillo wrote:

    Il giorno martedì 5 gennaio 2016 17:52:33 UTC+1, Victor L ha scritto:
    I have a problem passing "#" in URL to my http server:
    From https://en.wikipedia.org/wiki/Fragment_identifier:
    "The fragment identifier functions differently than the rest of the URI:
    namely, its processing is exclusively client-side
    <https://en.wikipedia.org/wiki/Client_(computing)> with no participation
    from the web server <https://en.wikipedia.org/wiki/Web_server>"
    [...]
    Regards Manlio
    --
    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.
  • Volker Dobler at Jan 5, 2016 at 5:12 pm

    Am Dienstag, 5. Januar 2016 18:05:44 UTC+1 schrieb Victor L:
    ok, how can i set it on the client side?
    Thanks again
    As mentioned: You cannot.
    But you can quote the # character as %23

    V

    --
    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.
  • Manlio Perillo at Jan 5, 2016 at 5:24 pm
    Il giorno martedì 5 gennaio 2016 18:05:44 UTC+1, Victor L ha scritto:
    ok, how can i set it on the client side?
    Thanks again
    "Processed exclusively client-side" means that it is processed by the
    browser.
    You set it in the browser address bar, and the browser interprets it
    according to the currently loaded document type.


    Regards Manlio

    --
    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
postedJan 5, '16 at 4:52p
activeJan 5, '16 at 5:24p
posts7
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase