Created
November 6, 2012 04:05
-
-
Save kazeburo/4022476 to your computer and use it in GitHub Desktop.
http_load_isucon2 patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- http_load/http_load-12mar2006/http_load.c 2006-03-13 04:17:03.000000000 +0900 | |
+++ http_load_isucon2/http_load.c 2012-10-29 01:21:42.000000000 +0900 | |
@@ -1019,13 +1019,21 @@ | |
} | |
else | |
bytes = snprintf( | |
- buf, sizeof(buf), "GET %.500s HTTP/1.0\r\n", | |
+ buf, sizeof(buf), "GET %.500s HTTP/1.1\r\n", | |
urls[url_num].filename ); | |
bytes += snprintf( | |
+ &buf[bytes], sizeof(buf) - bytes, "User-Agent: %s\r\n", "ISUCON Agent 2012" ); | |
+ bytes += snprintf( | |
&buf[bytes], sizeof(buf) - bytes, "Host: %s\r\n", | |
urls[url_num].hostname ); | |
bytes += snprintf( | |
- &buf[bytes], sizeof(buf) - bytes, "User-Agent: %s\r\n", VERSION ); | |
+ &buf[bytes], sizeof(buf) - bytes, "Connection: close\r\n" ); | |
+ bytes += snprintf( | |
+ &buf[bytes], sizeof(buf) - bytes, "Accept-Encoding: gzip\r\n" ); | |
+ if ( (unsigned long) random() % 100 >= 97 ) { | |
+ bytes += snprintf( | |
+ &buf[bytes], sizeof(buf) - bytes, "Cache-Control: max-age=2\r\n" ); | |
+ } | |
bytes += snprintf( &buf[bytes], sizeof(buf) - bytes, "\r\n" ); | |
/* Send the request. */ | |
@@ -1682,6 +1690,7 @@ | |
++http_status_counts[connections[cnum].http_status]; | |
url_num = connections[cnum].url_num; | |
+ /* | |
if ( do_checksum ) | |
{ | |
if ( ! urls[url_num].got_checksum ) | |
@@ -1716,6 +1725,7 @@ | |
} | |
} | |
} | |
+ */ | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment