Go to the documentation of this file.
30 #include "absl/strings/str_cat.h"
31 #include "absl/strings/str_format.h"
32 #include "absl/strings/str_join.h"
33 #include "absl/strings/string_view.h"
40 const char* host,
const char*
path,
41 bool connection_close,
42 std::vector<std::string>*
buf) {
44 buf->push_back(
" HTTP/1.1\r\n");
45 buf->push_back(
"Host: ");
47 buf->push_back(
"\r\n");
48 if (connection_close)
buf->push_back(
"Connection: close\r\n");
51 for (
size_t i = 0;
i <
request->hdr_count;
i++) {
55 buf->push_back(
"\r\n");
60 const char* host,
const char*
path) {
61 std::vector<std::string>
out;
62 out.push_back(
"GET ");
64 out.push_back(
"\r\n");
72 std::vector<std::string>
out;
73 out.push_back(
"POST ");
76 bool has_content_type =
false;
77 for (
size_t i = 0;
i <
request->hdr_count;
i++) {
78 if (strcmp(
request->hdrs[
i].key,
"Content-Type") == 0) {
79 has_content_type =
true;
83 if (!has_content_type) {
84 out.push_back(
"Content-Type: text/plain\r\n");
88 static_cast<unsigned long>(
request->body_length)));
90 out.push_back(
"\r\n");
100 const char* host,
const char*
path) {
101 std::vector<std::string>
out;
102 out.push_back(
"PUT ");
104 if (
request->body !=
nullptr) {
105 bool has_content_type =
false;
106 for (
size_t i = 0;
i <
request->hdr_count;
i++) {
107 if (strcmp(
request->hdrs[
i].key,
"Content-Type") == 0) {
108 has_content_type =
true;
112 if (!has_content_type) {
113 out.push_back(
"Content-Type: text/plain\r\n");
117 static_cast<unsigned long>(
request->body_length)));
119 out.push_back(
"\r\n");
121 if (
request->body !=
nullptr) {
131 std::vector<std::string>
out;
132 out.push_back(
"CONNECT ");
134 out.push_back(
"\r\n");
void StrAppend(std::string *dest, const AlphaNum &a)
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
std::string StrJoin(Iterator start, Iterator end, absl::string_view sep, Formatter &&fmt)
#define GRPC_HTTPCLI_USER_AGENT
GPRAPI grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:22