Index: docs/libcurl/curl_easy_getinfo.3
===================================================================
RCS file: /cvsroot/curl/curl/docs/libcurl/curl_easy_getinfo.3,v
retrieving revision 1.42
diff -u -p -r1.42 curl_easy_getinfo.3
--- docs/libcurl/curl_easy_getinfo.3	7 May 2009 09:31:24 -0000	1.42
+++ docs/libcurl/curl_easy_getinfo.3	22 Jun 2009 00:55:32 -0000
@@ -53,6 +53,10 @@ this.
 .IP CURLINFO_HTTP_CONNECTCODE
 Pass a pointer to a long to receive the last received proxy response code to a
 CONNECT request.
+.IP CURLINFO_RESPONSE_VERSION
+Pass a pointer to a long to receive the last received HTTP version. The HTTP
+version is converted to a long by multiplying by 10. This value will be zero
+for other protocols. 
 .IP CURLINFO_FILETIME
 Pass a pointer to a long to receive the remote time of the retrieved document
 (in number of seconds since 1 jan 1970 in the GMT/UTC time zone). If you get
Index: include/curl/curl.h
===================================================================
RCS file: /cvsroot/curl/curl/include/curl/curl.h,v
retrieving revision 1.388
diff -u -p -r1.388 curl.h
--- include/curl/curl.h	10 Jun 2009 02:49:43 -0000	1.388
+++ include/curl/curl.h	22 Jun 2009 00:55:32 -0000
@@ -1638,9 +1638,10 @@ typedef enum {
   CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,
   CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,
   CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,
+  CURLINFO_RESPONSE_VERSION = CURLINFO_LONG   + 36,
   /* Fill in new entries below here! */
 
-  CURLINFO_LASTONE          = 35
+  CURLINFO_LASTONE          = 36
 } CURLINFO;
 
 /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
Index: lib/getinfo.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/getinfo.c,v
retrieving revision 1.68
diff -u -p -r1.68 getinfo.c
--- lib/getinfo.c	21 Apr 2009 11:46:16 -0000	1.68
+++ lib/getinfo.c	22 Jun 2009 00:55:33 -0000
@@ -235,6 +235,9 @@ CURLcode Curl_getinfo(struct SessionHand
     /* return if the condition prevented the document to get transfered */
     *param_longp = data->info.timecond;
     break;
+  case CURLINFO_RESPONSE_VERSION:
+    *param_longp = data->info.httpversion;
+    break;
   default:
     return CURLE_BAD_FUNCTION_ARGUMENT;
   }
Index: src/writeout.c
===================================================================
RCS file: /cvsroot/curl/curl/src/writeout.c,v
retrieving revision 1.34
diff -u -p -r1.34 writeout.c
--- src/writeout.c	30 Jul 2008 21:24:19 -0000	1.34
+++ src/writeout.c	22 Jun 2009 00:55:33 -0000
@@ -54,6 +54,7 @@ typedef enum {
   VAR_SPEED_UPLOAD,
   VAR_HTTP_CODE,
   VAR_HTTP_CODE_PROXY,
+  VAR_RESPONSE_VERSION,
   VAR_HEADER_SIZE,
   VAR_REQUEST_SIZE,
   VAR_EFFECTIVE_URL,
@@ -77,6 +78,7 @@ static const struct variable replacement
   {"url_effective", VAR_EFFECTIVE_URL},
   {"http_code", VAR_HTTP_CODE},
   {"response_code", VAR_HTTP_CODE},
+  {"response_version", VAR_RESPONSE_VERSION},
   {"http_connect", VAR_HTTP_CODE_PROXY},
   {"time_total", VAR_TOTAL_TIME},
   {"time_namelookup", VAR_NAMELOOKUP_TIME},
@@ -140,6 +142,11 @@ void ourWriteOut(CURL *curl, const char 
                    curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &longinfo))
                   fprintf(stream, "%03ld", longinfo);
                 break;
+              case VAR_RESPONSE_VERSION:
+                if(CURLE_OK ==
+                   curl_easy_getinfo(curl, CURLINFO_RESPONSE_VERSION, &longinfo))
+                  fprintf(stream, "%02ld", longinfo);
+                break;
               case VAR_HTTP_CODE_PROXY:
                 if(CURLE_OK ==
                    curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE,
Index: tests/data/test1089
===================================================================
RCS file: /cvsroot/curl/curl/tests/data/test1089,v
retrieving revision 1.2
diff -u -p -r1.2 test1089
--- tests/data/test1089	7 Jan 2009 21:57:26 -0000	1.2
+++ tests/data/test1089	22 Jun 2009 00:55:33 -0000
@@ -43,7 +43,7 @@ http
 HTTP GET --write-out with redirected fetch
  </name>
  <command>
-http://%HOSTIP:%HTTPPORT/1089 -w "%{num_connects}\n%{num_redirects}\n%{size_download}\n%{url_effective}\n%{content_type}\n%{response_code}\n" -L
+http://%HOSTIP:%HTTPPORT/1089 -w "%{num_connects}\n%{num_redirects}\n%{size_download}\n%{url_effective}\n%{content_type}\n%{response_code}\n%{response_version}\n" -L
 </command>
 </client>
 
@@ -85,6 +85,7 @@ bigger monster
 http://%HOSTIP:%HTTPPORT/10890001
 text/plain; charset=us-ascii
 200
+11
 </stdout>
 
 </verify>
Index: tests/data/test1090
===================================================================
RCS file: /cvsroot/curl/curl/tests/data/test1090,v
retrieving revision 1.3
diff -u -p -r1.3 test1090
--- tests/data/test1090	7 Jan 2009 21:57:26 -0000	1.3
+++ tests/data/test1090	22 Jun 2009 00:55:33 -0000
@@ -50,7 +50,7 @@ http
 HTTP GET --write-out with redirected fetch and chunked reply
  </name>
  <command>
-http://%HOSTIP:%HTTPPORT/1090 -w "%{num_connects}\n%{num_redirects}\n%{size_download}\n%{url_effective}\n%{content_type}\n%{response_code}\n" -L
+http://%HOSTIP:%HTTPPORT/1090 -w "%{num_connects}\n%{num_redirects}\n%{size_download}\n%{url_effective}\n%{content_type}\n%{response_code}\n%{response_version}\n" -L
 </command>
 </client>
 
@@ -92,6 +92,7 @@ bigger monster
 http://%HOSTIP:%HTTPPORT/10900001
 text/plain; charset=us-ascii
 200
+11
 </stdout>
 
 </verify>

