| 21 | } |
| 22 | |
| 23 | bool 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 | } |
nothing calls this directly
no test coverage detected