Bug 14762 – Do not use other method options on persistent connection.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-07-02T15:50:00Z
Last change time
2015-10-04T18:20:05Z
Assigned to
nobody
Creator
karo+dlang

Comments

Comment #0 by karo+dlang — 2015-07-02T15:50:27Z
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) }
Comment #1 by github-bugzilla — 2015-07-28T07:28:18Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/7877708089c5b6b33d88c4c0279ae367e624df1e Fix issue 14762 without clearing options in perform, curl use previous options. - Prefer CUSTOM request by libcurl https://github.com/bagder/curl/blob/master/lib/http.c#L1834 - Change to PUT after PUT by libcurl https://github.com/bagder/curl/blob/master/lib/http.c#L1830 https://github.com/D-Programming-Language/phobos/commit/b34ff324f0bfe539a12797f0b29359681c8c888b Merge pull request #3465 from karronoli/fix-curl-http Issue 14762 - Reduce confusion for libcurl after HTTP request.
Comment #2 by github-bugzilla — 2015-10-04T18:20:05Z