MCPcopy Create free account
hub / github.com/catboost/catboost / ProcessHeaders

Method ProcessHeaders

library/cpp/http/server/http_ex.cpp:23–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23bool THttpClientRequestExtension::ProcessHeaders(TBaseServerRequestData& rd, TBlob& postData) {
24 for (const auto& header : ParsedHeaders) {
25 rd.AddHeader(header.first, header.second);
26 }
27
28 char* s = RequestString.begin();
29
30 enum EMethod {
31 NotImplemented,
32 Get,
33 Post,
34 Put,
35 Patch,
36 Delete,
37 Options,
38 };
39
40 enum EMethod foundMethod;
41 char* urlStart;
42
43 if (strnicmp(s, "GET ", 4) == 0) {
44 foundMethod = Get;
45 urlStart = s + 4;
46 } else if (strnicmp(s, "POST ", 5) == 0) {
47 foundMethod = Post;
48 urlStart = s + 5;
49 } else if (strnicmp(s, "PUT ", 4) == 0) {
50 foundMethod = Put;
51 urlStart = s + 4;
52 } else if (strnicmp(s, "PATCH ", 6) == 0) {
53 foundMethod = Patch;
54 urlStart = s + 6;
55 } else if (strnicmp(s, "DELETE ", 7) == 0) {
56 foundMethod = Delete;
57 urlStart = s + 7;
58 } else if (strnicmp(s, "OPTIONS ", 8) == 0) {
59 foundMethod = Options;
60 urlStart = s + 8;
61 } else {
62 foundMethod = NotImplemented;
63 }
64
65 switch (foundMethod) {
66 case Get:
67 case Delete:
68 if (!Parse(urlStart, rd)) {
69 return false;
70 }
71 break;
72
73 case Post:
74 case Put:
75 case Patch:
76 try {
77 ui64 contentLength = 0;
78 if (Input().HasExpect100Continue()) {
79 Output().SendContinue();
80 }

Callers

nothing calls this directly

Calls 13

LoadOrFailMethod · 0.80
SetBodyMethod · 0.80
ParseFunction · 0.50
AddHeaderMethod · 0.45
beginMethod · 0.45
HasExpect100ContinueMethod · 0.45
SendContinueMethod · 0.45
ContentEncodedMethod · 0.45
GetContentLengthMethod · 0.45
OptionsMethod · 0.45
FinishMethod · 0.45
DataMethod · 0.45

Tested by

no test coverage detected