-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathutils.hpp
48 lines (41 loc) · 1.55 KB
/
utils.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// Created by ramsay on 8/1/19.
//
#ifndef DOUBANCRAWLER_UTILS_H
#define DOUBANCRAWLER_UTILS_H
#include <iostream>
namespace crawler {
// http header constants
namespace header {
const char *const CONNECTION = "Connection";
const char *const HOST = "Host";
} // namespace header
// http method constants
namespace method {
const char *const GET = "GET";
const char *const POST = "POST";
} // namespace method
namespace constants {
const char *const HTTP_SEPARATOR = "\r\n";
const char *const HTTP_COLON = ": ";
} // namespace constants
} // namespace crawler
#define MAXLINE 4096
#ifdef DEBUG
#define debug_print(fmt, ...) \
do { \
if (DEBUG) \
fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, \
__VA_ARGS__); \
} while (0)
#define TRACE(x) \
do { \
if (DEBUG) \
debug_print x; \
} while (0)
#else
#define TRACE(x) \
do { \
} while (0)
#endif // DEBUG
#endif // DOUBANCRAWLER_UTILS_H