Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
http_load_isucon2 patch
--- 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
You can’t perform that action at this time.