The browser tries to put a nice icon to the side of the link. Usually this can 
be accomplished with a meta tag, but the browser also tries the well-known 
location favicon.ico to retrieve it if there is no meta-tag. That's why you see 
two requests.

[Joop Kiefte - Chat @ 
Spike](https://spikenow.com/r/a/?ref=spike-organic-signature&_ts=p7hpq)   
[p7hpq]

On September 25, 2020 at 17:34 GMT, gaurav <gaurav.pa...@gmail.com> wrote:

First request must be OPTION and second must be GET/ POST , This is default 
browser behaviour.

On Friday, 25 September 2020 at 15:22:27 UTC+5:30 smartaq...@gmail.com wrote:

Team,

Hi all, hope you are doing good.

I've made a hosted a small api on my windows 10 enterprise machine:

```

func main() {
srv := &http.Server{Addr: ":8000", Handler: http.HandlerFunc(handle)}
log.Fatal(srv.ListenAndServeTLS("certificate.crt", "certificate.key"))
}

func handle(w http.ResponseWriter, r *http.Request) {
// Log the request protocol
log.Printf("Got connection: %s", r.Proto)

// Send a message back to the client
w.Write([]byte("Hello"))
}
```
The moment I call this api using different 
browsers(IE/Chrome)([https://localhost:8000](https://localhost:8000/)) or curl 
request I receive these kind of outputs:

- In browser I receive "Hello" which is correct
- In golang console prompt I get this log twice:
With TLS:
[Capture.PNG]
Without TLS:
[Capture.PNG]
[Capture.PNG]

- But, while making a curl request I get this log & only once:
[Capture.PNG]

What is the difference between point 2 & 3. I've tried both tls and non tls 
version with browsers but in both the cases logs are coming twice. I don't know 
why this favicon.ico call is going.

Am I missing something here. Please help. Thank you

--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
[https://groups.google.com/d/msgid/golang-nuts/7da5a20a-1661-4b1d-ac5b-074a12208622n%40googlegroups.com](https://groups.google.com/d/msgid/golang-nuts/7da5a20a-1661-4b1d-ac5b-074a12208622n%40googlegroups.com?utm_medium=email&utm_source=footer).

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c-64693-kfijdhwx-aptd3h%3D95yzis%402.gethop.com.

Reply via email to