Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1722)

Side by Side Diff: net/tools/fetch/fetch_server.cc

Issue 99333: A utility driver for doing client/server HTTP transaction... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/tools/fetch/fetch_client.cc ('k') | net/tools/fetch/http_listen_socket.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/at_exit.h"
6 #include "base/command_line.h"
7 #include "base/message_loop.h"
8 #include "base/singleton.h"
9 #include "base/stats_counters.h"
10 #include "net/base/completion_callback.h"
11 #include "net/base/io_buffer.h"
12 #include "net/base/net_errors.h"
13 #include "net/base/winsock_init.h"
14 #include "net/http/http_network_layer.h"
15 #include "net/http/http_request_info.h"
16 #include "net/http/http_transaction.h"
17 #include "net/proxy/proxy_service.h"
18 #include "net/tools/fetch/http_server.h"
19
20 void usage(const char* program_name) {
21 printf("usage: %s\n", program_name);
22 exit(-1);
23 }
24
25 int main(int argc, char**argv) {
26 base::AtExitManager exit;
27 StatsTable table("fetchserver", 50, 1000);
28 table.set_current(&table);
29
30 net::EnsureWinsockInit();
31
32 CommandLine::Init(0, NULL);
33 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
34
35 // Do work here.
36 MessageLoop loop;
37 HttpServer server("", 80); // TODO(mbelshe): make port configurable
38 MessageLoop::current()->Run();
39
40 if (parsed_command_line.HasSwitch(L"stats")) {
41 // Dump the stats table.
42 printf("<stats>\n");
43 int counter_max = table.GetMaxCounters();
44 for (int index=0; index < counter_max; index++) {
45 std::string name(table.GetRowName(index));
46 if (name.length() > 0) {
47 int value = table.GetRowValue(index);
48 printf("%s:\t%d\n", name.c_str(), value);
49 }
50 }
51 printf("</stats>\n");
52 }
53
54 }
OLDNEW
« no previous file with comments | « net/tools/fetch/fetch_client.cc ('k') | net/tools/fetch/http_listen_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698