July 02, 2015 [Issue 14762] New: Do not use other method options on persistent connection. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=14762 Issue ID: 14762 Summary: Do not use other method options on persistent connection. Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: karo+dlang@karonori.com without clearing options in perform function, libcurl use previous options. - Prefer CUSTOM request by libcurl https://github.com/bagder/curl/blob/master/lib/http.c#L1834 // prefer_custom_request.d import std.net.curl; void main() { auto url = "http://localhost:8080/"; auto http = HTTP(); // any CUSTOM request trace(url, http); // Prefer CUSTOM request by libcurl // https://github.com/bagder/curl/blob/master/lib/http.c#L1834 auto a = get(url, http); assert(HTTP.Method.get == http.method); assert(a == "GET", a); // => a is "TRACE" } - Change to PUT after PUT by libcurl https://github.com/bagder/curl/blob/master/lib/http.c#L1830 // put_post.d import std.net.curl; void main() { auto http = HTTP(); auto url = "http://localhost:8080/"; auto a = put(url, "", http); assert(a == "PUT", a); // Change to PUT after PUT by libcurl // https://github.com/bagder/curl/blob/master/lib/http.c#L1830 auto b = post(url, "", http); assert(b == "POST", b); // b is "PUT" } It is http server to respond method name by golang. // method.go // go run method.go package main import ( "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { w.Write([]byte(r.Method)) } func main() { http.HandleFunc("/", handler) http.ListenAndServe(":8080", nil) } -- |
Copyright © 1999-2021 by the D Language Foundation