aboutsummaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2013-09-12 13:51:04 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-01-29 10:24:05 +0100
commit8d3608f2ad29bb65ce0926a45b46ff29902c279f (patch)
tree1d9ddec9546056b9ad7d6d94b545e0492c7ebe95 /lib/http.c
parent8bcf677a30cc1559b635c0eca7dd29ac2ab5f4bb (diff)
http2: handle 101 responses and switch to HTTP2
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/http.c b/lib/http.c
index da03a44c5..8df0105a1 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -2872,10 +2872,27 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
k->header = TRUE;
k->headerline = 0; /* restart the header line counter */
- /* if we did wait for this do enable write now! */
- if(k->exp100) {
- k->exp100 = EXP100_SEND_DATA;
- k->keepon |= KEEP_SEND;
+ /* "A user agent MAY ignore unexpected 1xx status responses." */
+ switch(k->httpcode) {
+ case 100:
+ /* if we did wait for this do enable write now! */
+ if(k->exp100) {
+ k->exp100 = EXP100_SEND_DATA;
+ k->keepon |= KEEP_SEND;
+ }
+ break;
+ case 101:
+ /* Switching Protocols */
+ if(k->upgr101 == UPGR101_REQUESTED) {
+ infof(data, "Received 101\n");
+ k->upgr101 = UPGR101_RECEIVED;
+
+ /* switch to http2 now */
+ Curl_http2_switched(conn);
+ }
+ break;
+ default:
+ break;
}
}
else {