-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
curl doesn't update cookie file #10120
Comments
When checking if there is a "secure context", which it is if the connection is to localhost even if the protocol is HTTP, the comparison for ::1 was done incorrectly and included brackets. Reported-by: BratSinot on github Fixes #10120
Also here is minimal reproducible example: package main
import (
"fmt"
"net/http"
)
func helloHandler(w http.ResponseWriter, req *http.Request) {
// set cookie for storing token
cookie := &http.Cookie {
Name: "name1",
Value: "Value1",
Secure: true,
HttpOnly: true,
}
http.SetCookie(w, cookie)
fmt.Printf("Got cookies: `%v`\n", req.Cookies())
fmt.Fprintf(w, "Hello World!\n")
}
func main() {
fmt.Println(":1025")
http.HandleFunc("/notifications", helloHandler)
http.ListenAndServe(":1025", nil)
} cookie.txt:
curl:
http.go:
And cookie.txt doesn't change.
I've also checked it in |
The bug is that curl checks for the host name |
Discussed in #10117
Originally posted by BratSinot December 19, 2022
Greetings!
I have some file with cookie and I want curl to use that file and update it with new cookies from response. I try to use this:
but curl ignores
set-cookies
from response (response haveset-cookies
, I check it through Wireshark). How can I overcome this behaviour?cookie.sub:
Curl version:
The text was updated successfully, but these errors were encountered: