Add HTTP request parsing.

This extends the existing http parser to support requests as well as responses.

httpcli continues to exist and work as it has previously, though in the new
directory src/core/http (to reflect the fact the directory now contains code
relevant to parsing requests, which httpcli would not generally involve itself
in).
pull/5383/head
Matthew Iselin 9 years ago
parent 39fd22193b
commit 1824f0519f
  1. 40
      BUILD
  2. 68
      Makefile
  3. 8
      binding.gyp
  4. 26
      build.yaml
  5. 10
      config.m4
  6. 20
      gRPC.podspec
  7. 14
      grpc.gemspec
  8. 14
      package.json
  9. 14
      package.xml
  10. 16
      src/core/http/format_request.c
  11. 8
      src/core/http/format_request.h
  12. 27
      src/core/http/httpcli.c
  13. 39
      src/core/http/httpcli.h
  14. 2
      src/core/http/httpcli_security_connector.c
  15. 313
      src/core/http/parser.c
  16. 116
      src/core/http/parser.h
  17. 211
      src/core/httpcli/parser.c
  18. 64
      src/core/httpcli/parser.h
  19. 25
      src/core/security/credentials.c
  20. 7
      src/core/security/credentials.h
  21. 9
      src/core/security/google_default_credentials.c
  22. 20
      src/core/security/jwt_verifier.c
  23. 8
      src/python/grpcio/grpc_core_dependencies.py
  24. 36
      test/core/http/format_request_test.c
  25. 8
      test/core/http/httpcli_test.c
  26. 8
      test/core/http/httpscli_test.c
  27. 135
      test/core/http/parser_test.c
  28. 2
      test/core/http/test_server.py
  29. 25
      test/core/security/credentials_test.c
  30. 10
      test/core/security/jwt_verifier_test.c
  31. 1
      test/core/util/port_posix.c
  32. 8
      test/core/util/port_server_client.c
  33. 1
      test/core/util/port_windows.c
  34. 14
      tools/doxygen/Doxyfile.core.internal
  35. 50
      tools/run_tests/sources_and_headers.json
  36. 4
      tools/run_tests/tests.json
  37. 36
      vsprojects/buildtests_c.sln
  38. 14
      vsprojects/vcxproj/grpc/grpc.vcxproj
  39. 32
      vsprojects/vcxproj/grpc/grpc.vcxproj.filters
  40. 12
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
  41. 28
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
  42. 8
      vsprojects/vcxproj/test/http_parser_test/http_parser_test.vcxproj
  43. 12
      vsprojects/vcxproj/test/http_parser_test/http_parser_test.vcxproj.filters
  44. 2
      vsprojects/vcxproj/test/httpcli_format_request_test/httpcli_format_request_test.vcxproj
  45. 8
      vsprojects/vcxproj/test/httpcli_format_request_test/httpcli_format_request_test.vcxproj.filters

40
BUILD

@ -190,9 +190,9 @@ cc_library(
"src/core/compression/algorithm_metadata.h",
"src/core/compression/message_compress.h",
"src/core/debug/trace.h",
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.h",
"src/core/http/format_request.h",
"src/core/http/httpcli.h",
"src/core/http/parser.h",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.h",
"src/core/iomgr/endpoint_pair.h",
@ -331,9 +331,9 @@ cc_library(
"src/core/compression/compression_algorithm.c",
"src/core/compression/message_compress.c",
"src/core/debug/trace.c",
"src/core/httpcli/format_request.c",
"src/core/httpcli/httpcli.c",
"src/core/httpcli/parser.c",
"src/core/http/format_request.c",
"src/core/http/httpcli.c",
"src/core/http/parser.c",
"src/core/iomgr/closure.c",
"src/core/iomgr/endpoint.c",
"src/core/iomgr/endpoint_pair_posix.c",
@ -429,7 +429,7 @@ cc_library(
"src/core/transport/static_metadata.c",
"src/core/transport/transport.c",
"src/core/transport/transport_op_string.c",
"src/core/httpcli/httpcli_security_connector.c",
"src/core/http/httpcli_security_connector.c",
"src/core/security/b64.c",
"src/core/security/client_auth_filter.c",
"src/core/security/credentials.c",
@ -562,9 +562,9 @@ cc_library(
"src/core/compression/algorithm_metadata.h",
"src/core/compression/message_compress.h",
"src/core/debug/trace.h",
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.h",
"src/core/http/format_request.h",
"src/core/http/httpcli.h",
"src/core/http/parser.h",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.h",
"src/core/iomgr/endpoint_pair.h",
@ -690,9 +690,9 @@ cc_library(
"src/core/compression/compression_algorithm.c",
"src/core/compression/message_compress.c",
"src/core/debug/trace.c",
"src/core/httpcli/format_request.c",
"src/core/httpcli/httpcli.c",
"src/core/httpcli/parser.c",
"src/core/http/format_request.c",
"src/core/http/httpcli.c",
"src/core/http/parser.c",
"src/core/iomgr/closure.c",
"src/core/iomgr/endpoint.c",
"src/core/iomgr/endpoint_pair_posix.c",
@ -1390,9 +1390,9 @@ objc_library(
"src/core/compression/compression_algorithm.c",
"src/core/compression/message_compress.c",
"src/core/debug/trace.c",
"src/core/httpcli/format_request.c",
"src/core/httpcli/httpcli.c",
"src/core/httpcli/parser.c",
"src/core/http/format_request.c",
"src/core/http/httpcli.c",
"src/core/http/parser.c",
"src/core/iomgr/closure.c",
"src/core/iomgr/endpoint.c",
"src/core/iomgr/endpoint_pair_posix.c",
@ -1488,7 +1488,7 @@ objc_library(
"src/core/transport/static_metadata.c",
"src/core/transport/transport.c",
"src/core/transport/transport_op_string.c",
"src/core/httpcli/httpcli_security_connector.c",
"src/core/http/httpcli_security_connector.c",
"src/core/security/b64.c",
"src/core/security/client_auth_filter.c",
"src/core/security/credentials.c",
@ -1566,9 +1566,9 @@ objc_library(
"src/core/compression/algorithm_metadata.h",
"src/core/compression/message_compress.h",
"src/core/debug/trace.h",
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.h",
"src/core/http/format_request.h",
"src/core/http/httpcli.h",
"src/core/http/parser.h",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.h",
"src/core/iomgr/endpoint_pair.h",

@ -927,8 +927,8 @@ grpc_security_connector_test: $(BINDIR)/$(CONFIG)/grpc_security_connector_test
grpc_verify_jwt: $(BINDIR)/$(CONFIG)/grpc_verify_jwt
hpack_parser_test: $(BINDIR)/$(CONFIG)/hpack_parser_test
hpack_table_test: $(BINDIR)/$(CONFIG)/hpack_table_test
http_parser_test: $(BINDIR)/$(CONFIG)/http_parser_test
httpcli_format_request_test: $(BINDIR)/$(CONFIG)/httpcli_format_request_test
httpcli_parser_test: $(BINDIR)/$(CONFIG)/httpcli_parser_test
httpcli_test: $(BINDIR)/$(CONFIG)/httpcli_test
httpscli_test: $(BINDIR)/$(CONFIG)/httpscli_test
init_test: $(BINDIR)/$(CONFIG)/init_test
@ -1236,8 +1236,8 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/grpc_security_connector_test \
$(BINDIR)/$(CONFIG)/hpack_parser_test \
$(BINDIR)/$(CONFIG)/hpack_table_test \
$(BINDIR)/$(CONFIG)/http_parser_test \
$(BINDIR)/$(CONFIG)/httpcli_format_request_test \
$(BINDIR)/$(CONFIG)/httpcli_parser_test \
$(BINDIR)/$(CONFIG)/httpcli_test \
$(BINDIR)/$(CONFIG)/httpscli_test \
$(BINDIR)/$(CONFIG)/init_test \
@ -1522,10 +1522,10 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/hpack_parser_test || ( echo test hpack_parser_test failed ; exit 1 )
$(E) "[RUN] Testing hpack_table_test"
$(Q) $(BINDIR)/$(CONFIG)/hpack_table_test || ( echo test hpack_table_test failed ; exit 1 )
$(E) "[RUN] Testing http_parser_test"
$(Q) $(BINDIR)/$(CONFIG)/http_parser_test || ( echo test http_parser_test failed ; exit 1 )
$(E) "[RUN] Testing httpcli_format_request_test"
$(Q) $(BINDIR)/$(CONFIG)/httpcli_format_request_test || ( echo test httpcli_format_request_test failed ; exit 1 )
$(E) "[RUN] Testing httpcli_parser_test"
$(Q) $(BINDIR)/$(CONFIG)/httpcli_parser_test || ( echo test httpcli_parser_test failed ; exit 1 )
$(E) "[RUN] Testing httpcli_test"
$(Q) $(BINDIR)/$(CONFIG)/httpcli_test || ( echo test httpcli_test failed ; exit 1 )
$(E) "[RUN] Testing httpscli_test"
@ -2437,9 +2437,9 @@ LIBGRPC_SRC = \
src/core/compression/compression_algorithm.c \
src/core/compression/message_compress.c \
src/core/debug/trace.c \
src/core/httpcli/format_request.c \
src/core/httpcli/httpcli.c \
src/core/httpcli/parser.c \
src/core/http/format_request.c \
src/core/http/httpcli.c \
src/core/http/parser.c \
src/core/iomgr/closure.c \
src/core/iomgr/endpoint.c \
src/core/iomgr/endpoint_pair_posix.c \
@ -2535,7 +2535,7 @@ LIBGRPC_SRC = \
src/core/transport/static_metadata.c \
src/core/transport/transport.c \
src/core/transport/transport_op_string.c \
src/core/httpcli/httpcli_security_connector.c \
src/core/http/httpcli_security_connector.c \
src/core/security/b64.c \
src/core/security/client_auth_filter.c \
src/core/security/credentials.c \
@ -2797,9 +2797,9 @@ LIBGRPC_UNSECURE_SRC = \
src/core/compression/compression_algorithm.c \
src/core/compression/message_compress.c \
src/core/debug/trace.c \
src/core/httpcli/format_request.c \
src/core/httpcli/httpcli.c \
src/core/httpcli/parser.c \
src/core/http/format_request.c \
src/core/http/httpcli.c \
src/core/http/parser.c \
src/core/iomgr/closure.c \
src/core/iomgr/endpoint.c \
src/core/iomgr/endpoint_pair_posix.c \
@ -7757,72 +7757,72 @@ endif
endif
HTTPCLI_FORMAT_REQUEST_TEST_SRC = \
test/core/httpcli/format_request_test.c \
HTTP_PARSER_TEST_SRC = \
test/core/http/parser_test.c \
HTTPCLI_FORMAT_REQUEST_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTPCLI_FORMAT_REQUEST_TEST_SRC))))
HTTP_PARSER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTP_PARSER_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/httpcli_format_request_test: openssl_dep_error
$(BINDIR)/$(CONFIG)/http_parser_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/httpcli_format_request_test: $(HTTPCLI_FORMAT_REQUEST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(BINDIR)/$(CONFIG)/http_parser_test: $(HTTP_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(HTTPCLI_FORMAT_REQUEST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/httpcli_format_request_test
$(Q) $(LD) $(LDFLAGS) $(HTTP_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/http_parser_test
endif
$(OBJDIR)/$(CONFIG)/test/core/httpcli/format_request_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/http/parser_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_httpcli_format_request_test: $(HTTPCLI_FORMAT_REQUEST_TEST_OBJS:.o=.dep)
deps_http_parser_test: $(HTTP_PARSER_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(HTTPCLI_FORMAT_REQUEST_TEST_OBJS:.o=.dep)
-include $(HTTP_PARSER_TEST_OBJS:.o=.dep)
endif
endif
HTTPCLI_PARSER_TEST_SRC = \
test/core/httpcli/parser_test.c \
HTTPCLI_FORMAT_REQUEST_TEST_SRC = \
test/core/http/format_request_test.c \
HTTPCLI_PARSER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTPCLI_PARSER_TEST_SRC))))
HTTPCLI_FORMAT_REQUEST_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTPCLI_FORMAT_REQUEST_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/httpcli_parser_test: openssl_dep_error
$(BINDIR)/$(CONFIG)/httpcli_format_request_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/httpcli_parser_test: $(HTTPCLI_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(BINDIR)/$(CONFIG)/httpcli_format_request_test: $(HTTPCLI_FORMAT_REQUEST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(HTTPCLI_PARSER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/httpcli_parser_test
$(Q) $(LD) $(LDFLAGS) $(HTTPCLI_FORMAT_REQUEST_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/httpcli_format_request_test
endif
$(OBJDIR)/$(CONFIG)/test/core/httpcli/parser_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/http/format_request_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_httpcli_parser_test: $(HTTPCLI_PARSER_TEST_OBJS:.o=.dep)
deps_httpcli_format_request_test: $(HTTPCLI_FORMAT_REQUEST_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(HTTPCLI_PARSER_TEST_OBJS:.o=.dep)
-include $(HTTPCLI_FORMAT_REQUEST_TEST_OBJS:.o=.dep)
endif
endif
HTTPCLI_TEST_SRC = \
test/core/httpcli/httpcli_test.c \
test/core/http/httpcli_test.c \
HTTPCLI_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTPCLI_TEST_SRC))))
ifeq ($(NO_SECURE),true)
@ -7842,7 +7842,7 @@ $(BINDIR)/$(CONFIG)/httpcli_test: $(HTTPCLI_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgr
endif
$(OBJDIR)/$(CONFIG)/test/core/httpcli/httpcli_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/http/httpcli_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_httpcli_test: $(HTTPCLI_TEST_OBJS:.o=.dep)
@ -7854,7 +7854,7 @@ endif
HTTPSCLI_TEST_SRC = \
test/core/httpcli/httpscli_test.c \
test/core/http/httpscli_test.c \
HTTPSCLI_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTPSCLI_TEST_SRC))))
ifeq ($(NO_SECURE),true)
@ -7874,7 +7874,7 @@ $(BINDIR)/$(CONFIG)/httpscli_test: $(HTTPSCLI_TEST_OBJS) $(LIBDIR)/$(CONFIG)/lib
endif
$(OBJDIR)/$(CONFIG)/test/core/httpcli/httpscli_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/http/httpscli_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_httpscli_test: $(HTTPSCLI_TEST_OBJS:.o=.dep)
@ -13378,7 +13378,7 @@ ifneq ($(OPENSSL_DEP),)
# This is to ensure the embedded OpenSSL is built beforehand, properly
# installing headers to their final destination on the drive. We need this
# otherwise parallel compilation will fail if a source is compiled first.
src/core/httpcli/httpcli_security_connector.c: $(OPENSSL_DEP)
src/core/http/httpcli_security_connector.c: $(OPENSSL_DEP)
src/core/security/b64.c: $(OPENSSL_DEP)
src/core/security/client_auth_filter.c: $(OPENSSL_DEP)
src/core/security/credentials.c: $(OPENSSL_DEP)

@ -592,9 +592,9 @@
'src/core/compression/compression_algorithm.c',
'src/core/compression/message_compress.c',
'src/core/debug/trace.c',
'src/core/httpcli/format_request.c',
'src/core/httpcli/httpcli.c',
'src/core/httpcli/parser.c',
'src/core/http/format_request.c',
'src/core/http/httpcli.c',
'src/core/http/parser.c',
'src/core/iomgr/closure.c',
'src/core/iomgr/endpoint.c',
'src/core/iomgr/endpoint_pair_posix.c',
@ -690,7 +690,7 @@
'src/core/transport/static_metadata.c',
'src/core/transport/transport.c',
'src/core/transport/transport_op_string.c',
'src/core/httpcli/httpcli_security_connector.c',
'src/core/http/httpcli_security_connector.c',
'src/core/security/b64.c',
'src/core/security/client_auth_filter.c',
'src/core/security/credentials.c',

@ -280,9 +280,9 @@ filegroups:
- src/core/compression/algorithm_metadata.h
- src/core/compression/message_compress.h
- src/core/debug/trace.h
- src/core/httpcli/format_request.h
- src/core/httpcli/httpcli.h
- src/core/httpcli/parser.h
- src/core/http/format_request.h
- src/core/http/httpcli.h
- src/core/http/parser.h
- src/core/iomgr/closure.h
- src/core/iomgr/endpoint.h
- src/core/iomgr/endpoint_pair.h
@ -401,9 +401,9 @@ filegroups:
- src/core/compression/compression_algorithm.c
- src/core/compression/message_compress.c
- src/core/debug/trace.c
- src/core/httpcli/format_request.c
- src/core/httpcli/httpcli.c
- src/core/httpcli/parser.c
- src/core/http/format_request.c
- src/core/http/httpcli.c
- src/core/http/parser.c
- src/core/iomgr/closure.c
- src/core/iomgr/endpoint.c
- src/core/iomgr/endpoint_pair_posix.c
@ -524,7 +524,7 @@ filegroups:
- src/core/tsi/transport_security.h
- src/core/tsi/transport_security_interface.h
src:
- src/core/httpcli/httpcli_security_connector.c
- src/core/http/httpcli_security_connector.c
- src/core/security/b64.c
- src/core/security/client_auth_filter.c
- src/core/security/credentials.c
@ -1560,21 +1560,21 @@ targets:
- grpc
- gpr_test_util
- gpr
- name: httpcli_format_request_test
- name: http_parser_test
build: test
language: c
src:
- test/core/httpcli/format_request_test.c
- test/core/http/parser_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: httpcli_parser_test
- name: httpcli_format_request_test
build: test
language: c
src:
- test/core/httpcli/parser_test.c
- test/core/http/format_request_test.c
deps:
- grpc_test_util
- grpc
@ -1585,7 +1585,7 @@ targets:
build: test
language: c
src:
- test/core/httpcli/httpcli_test.c
- test/core/http/httpcli_test.c
deps:
- grpc_test_util
- grpc
@ -1600,7 +1600,7 @@ targets:
build: test
language: c
src:
- test/core/httpcli/httpscli_test.c
- test/core/http/httpscli_test.c
deps:
- grpc_test_util
- grpc

@ -114,9 +114,9 @@ if test "$PHP_GRPC" != "no"; then
src/core/compression/compression_algorithm.c \
src/core/compression/message_compress.c \
src/core/debug/trace.c \
src/core/httpcli/format_request.c \
src/core/httpcli/httpcli.c \
src/core/httpcli/parser.c \
src/core/http/format_request.c \
src/core/http/httpcli.c \
src/core/http/parser.c \
src/core/iomgr/closure.c \
src/core/iomgr/endpoint.c \
src/core/iomgr/endpoint_pair_posix.c \
@ -212,7 +212,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/transport/static_metadata.c \
src/core/transport/transport.c \
src/core/transport/transport_op_string.c \
src/core/httpcli/httpcli_security_connector.c \
src/core/http/httpcli_security_connector.c \
src/core/security/b64.c \
src/core/security/client_auth_filter.c \
src/core/security/credentials.c \
@ -551,7 +551,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/client_config/resolvers)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/compression)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/debug)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/httpcli)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/http)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/iomgr)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/json)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/profiling)

@ -194,9 +194,9 @@ Pod::Spec.new do |s|
'src/core/compression/algorithm_metadata.h',
'src/core/compression/message_compress.h',
'src/core/debug/trace.h',
'src/core/httpcli/format_request.h',
'src/core/httpcli/httpcli.h',
'src/core/httpcli/parser.h',
'src/core/http/format_request.h',
'src/core/http/httpcli.h',
'src/core/http/parser.h',
'src/core/iomgr/closure.h',
'src/core/iomgr/endpoint.h',
'src/core/iomgr/endpoint_pair.h',
@ -348,9 +348,9 @@ Pod::Spec.new do |s|
'src/core/compression/compression_algorithm.c',
'src/core/compression/message_compress.c',
'src/core/debug/trace.c',
'src/core/httpcli/format_request.c',
'src/core/httpcli/httpcli.c',
'src/core/httpcli/parser.c',
'src/core/http/format_request.c',
'src/core/http/httpcli.c',
'src/core/http/parser.c',
'src/core/iomgr/closure.c',
'src/core/iomgr/endpoint.c',
'src/core/iomgr/endpoint_pair_posix.c',
@ -446,7 +446,7 @@ Pod::Spec.new do |s|
'src/core/transport/static_metadata.c',
'src/core/transport/transport.c',
'src/core/transport/transport_op_string.c',
'src/core/httpcli/httpcli_security_connector.c',
'src/core/http/httpcli_security_connector.c',
'src/core/security/b64.c',
'src/core/security/client_auth_filter.c',
'src/core/security/credentials.c',
@ -522,9 +522,9 @@ Pod::Spec.new do |s|
'src/core/compression/algorithm_metadata.h',
'src/core/compression/message_compress.h',
'src/core/debug/trace.h',
'src/core/httpcli/format_request.h',
'src/core/httpcli/httpcli.h',
'src/core/httpcli/parser.h',
'src/core/http/format_request.h',
'src/core/http/httpcli.h',
'src/core/http/parser.h',
'src/core/iomgr/closure.h',
'src/core/iomgr/endpoint.h',
'src/core/iomgr/endpoint_pair.h',

@ -190,9 +190,9 @@ Gem::Specification.new do |s|
s.files += %w( src/core/compression/algorithm_metadata.h )
s.files += %w( src/core/compression/message_compress.h )
s.files += %w( src/core/debug/trace.h )
s.files += %w( src/core/httpcli/format_request.h )
s.files += %w( src/core/httpcli/httpcli.h )
s.files += %w( src/core/httpcli/parser.h )
s.files += %w( src/core/http/format_request.h )
s.files += %w( src/core/http/httpcli.h )
s.files += %w( src/core/http/parser.h )
s.files += %w( src/core/iomgr/closure.h )
s.files += %w( src/core/iomgr/endpoint.h )
s.files += %w( src/core/iomgr/endpoint_pair.h )
@ -331,9 +331,9 @@ Gem::Specification.new do |s|
s.files += %w( src/core/compression/compression_algorithm.c )
s.files += %w( src/core/compression/message_compress.c )
s.files += %w( src/core/debug/trace.c )
s.files += %w( src/core/httpcli/format_request.c )
s.files += %w( src/core/httpcli/httpcli.c )
s.files += %w( src/core/httpcli/parser.c )
s.files += %w( src/core/http/format_request.c )
s.files += %w( src/core/http/httpcli.c )
s.files += %w( src/core/http/parser.c )
s.files += %w( src/core/iomgr/closure.c )
s.files += %w( src/core/iomgr/endpoint.c )
s.files += %w( src/core/iomgr/endpoint_pair_posix.c )
@ -429,7 +429,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/transport/static_metadata.c )
s.files += %w( src/core/transport/transport.c )
s.files += %w( src/core/transport/transport_op_string.c )
s.files += %w( src/core/httpcli/httpcli_security_connector.c )
s.files += %w( src/core/http/httpcli_security_connector.c )
s.files += %w( src/core/security/b64.c )
s.files += %w( src/core/security/client_auth_filter.c )
s.files += %w( src/core/security/credentials.c )

@ -132,9 +132,9 @@
"src/core/compression/algorithm_metadata.h",
"src/core/compression/message_compress.h",
"src/core/debug/trace.h",
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.h",
"src/core/http/format_request.h",
"src/core/http/httpcli.h",
"src/core/http/parser.h",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.h",
"src/core/iomgr/endpoint_pair.h",
@ -273,9 +273,9 @@
"src/core/compression/compression_algorithm.c",
"src/core/compression/message_compress.c",
"src/core/debug/trace.c",
"src/core/httpcli/format_request.c",
"src/core/httpcli/httpcli.c",
"src/core/httpcli/parser.c",
"src/core/http/format_request.c",
"src/core/http/httpcli.c",
"src/core/http/parser.c",
"src/core/iomgr/closure.c",
"src/core/iomgr/endpoint.c",
"src/core/iomgr/endpoint_pair_posix.c",
@ -371,7 +371,7 @@
"src/core/transport/static_metadata.c",
"src/core/transport/transport.c",
"src/core/transport/transport_op_string.c",
"src/core/httpcli/httpcli_security_connector.c",
"src/core/http/httpcli_security_connector.c",
"src/core/security/b64.c",
"src/core/security/client_auth_filter.c",
"src/core/security/credentials.c",

@ -194,9 +194,9 @@
<file baseinstalldir="/" name="src/core/compression/algorithm_metadata.h" role="src" />
<file baseinstalldir="/" name="src/core/compression/message_compress.h" role="src" />
<file baseinstalldir="/" name="src/core/debug/trace.h" role="src" />
<file baseinstalldir="/" name="src/core/httpcli/format_request.h" role="src" />
<file baseinstalldir="/" name="src/core/httpcli/httpcli.h" role="src" />
<file baseinstalldir="/" name="src/core/httpcli/parser.h" role="src" />
<file baseinstalldir="/" name="src/core/http/format_request.h" role="src" />
<file baseinstalldir="/" name="src/core/http/httpcli.h" role="src" />
<file baseinstalldir="/" name="src/core/http/parser.h" role="src" />
<file baseinstalldir="/" name="src/core/iomgr/closure.h" role="src" />
<file baseinstalldir="/" name="src/core/iomgr/endpoint.h" role="src" />
<file baseinstalldir="/" name="src/core/iomgr/endpoint_pair.h" role="src" />
@ -335,9 +335,9 @@
<file baseinstalldir="/" name="src/core/compression/compression_algorithm.c" role="src" />
<file baseinstalldir="/" name="src/core/compression/message_compress.c" role="src" />
<file baseinstalldir="/" name="src/core/debug/trace.c" role="src" />
<file baseinstalldir="/" name="src/core/httpcli/format_request.c" role="src" />
<file baseinstalldir="/" name="src/core/httpcli/httpcli.c" role="src" />
<file baseinstalldir="/" name="src/core/httpcli/parser.c" role="src" />
<file baseinstalldir="/" name="src/core/http/format_request.c" role="src" />
<file baseinstalldir="/" name="src/core/http/httpcli.c" role="src" />
<file baseinstalldir="/" name="src/core/http/parser.c" role="src" />
<file baseinstalldir="/" name="src/core/iomgr/closure.c" role="src" />
<file baseinstalldir="/" name="src/core/iomgr/endpoint.c" role="src" />
<file baseinstalldir="/" name="src/core/iomgr/endpoint_pair_posix.c" role="src" />
@ -433,7 +433,7 @@
<file baseinstalldir="/" name="src/core/transport/static_metadata.c" role="src" />
<file baseinstalldir="/" name="src/core/transport/transport.c" role="src" />
<file baseinstalldir="/" name="src/core/transport/transport_op_string.c" role="src" />
<file baseinstalldir="/" name="src/core/httpcli/httpcli_security_connector.c" role="src" />
<file baseinstalldir="/" name="src/core/http/httpcli_security_connector.c" role="src" />
<file baseinstalldir="/" name="src/core/security/b64.c" role="src" />
<file baseinstalldir="/" name="src/core/security/client_auth_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/security/credentials.c" role="src" />

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,7 +31,7 @@
*
*/
#include "src/core/httpcli/format_request.h"
#include "src/core/http/format_request.h"
#include <stdarg.h>
#include <stdio.h>
@ -46,7 +46,7 @@
static void fill_common_header(const grpc_httpcli_request *request,
gpr_strvec *buf) {
size_t i;
gpr_strvec_add(buf, gpr_strdup(request->path));
gpr_strvec_add(buf, gpr_strdup(request->http.path));
gpr_strvec_add(buf, gpr_strdup(" HTTP/1.0\r\n"));
/* just in case some crazy server really expects HTTP/1.1 */
gpr_strvec_add(buf, gpr_strdup("Host: "));
@ -56,10 +56,10 @@ static void fill_common_header(const grpc_httpcli_request *request,
gpr_strvec_add(buf,
gpr_strdup("User-Agent: " GRPC_HTTPCLI_USER_AGENT "\r\n"));
/* user supplied headers */
for (i = 0; i < request->hdr_count; i++) {
gpr_strvec_add(buf, gpr_strdup(request->hdrs[i].key));
for (i = 0; i < request->http.hdr_count; i++) {
gpr_strvec_add(buf, gpr_strdup(request->http.hdrs[i].key));
gpr_strvec_add(buf, gpr_strdup(": "));
gpr_strvec_add(buf, gpr_strdup(request->hdrs[i].value));
gpr_strvec_add(buf, gpr_strdup(request->http.hdrs[i].value));
gpr_strvec_add(buf, gpr_strdup("\r\n"));
}
}
@ -94,8 +94,8 @@ gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
fill_common_header(request, &out);
if (body_bytes) {
uint8_t has_content_type = 0;
for (i = 0; i < request->hdr_count; i++) {
if (strcmp(request->hdrs[i].key, "Content-Type") == 0) {
for (i = 0; i < request->http.hdr_count; i++) {
if (strcmp(request->http.hdrs[i].key, "Content-Type") == 0) {
has_content_type = 1;
break;
}

@ -31,10 +31,10 @@
*
*/
#ifndef GRPC_CORE_HTTPCLI_FORMAT_REQUEST_H
#define GRPC_CORE_HTTPCLI_FORMAT_REQUEST_H
#ifndef GRPC_CORE_HTTP_FORMAT_REQUEST_H
#define GRPC_CORE_HTTP_FORMAT_REQUEST_H
#include "src/core/httpcli/httpcli.h"
#include "src/core/http/httpcli.h"
#include <grpc/support/slice.h>
gpr_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request);
@ -42,4 +42,4 @@ gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
const char *body_bytes,
size_t body_size);
#endif /* GRPC_CORE_HTTPCLI_FORMAT_REQUEST_H */
#endif /* GRPC_CORE_HTTP_FORMAT_REQUEST_H */

@ -31,7 +31,7 @@
*
*/
#include "src/core/httpcli/httpcli.h"
#include "src/core/http/httpcli.h"
#include "src/core/iomgr/sockaddr.h"
#include <string.h>
@ -40,8 +40,8 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/httpcli/format_request.h"
#include "src/core/httpcli/parser.h"
#include "src/core/http/format_request.h"
#include "src/core/http/parser.h"
#include "src/core/iomgr/endpoint.h"
#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/resolve_address.h"
@ -50,7 +50,7 @@
typedef struct {
gpr_slice request_text;
grpc_httpcli_parser parser;
grpc_http_parser parser;
grpc_resolved_addresses *addresses;
size_t next_address;
grpc_endpoint *ep;
@ -99,8 +99,9 @@ static void finish(grpc_exec_ctx *exec_ctx, internal_request *req,
int success) {
grpc_pollset_set_del_pollset(exec_ctx, req->context->pollset_set,
req->pollset);
req->on_response(exec_ctx, req->user_data, success ? &req->parser.r : NULL);
grpc_httpcli_parser_destroy(&req->parser);
req->on_response(exec_ctx, req->user_data,
success ? &req->parser.http.response : NULL);
grpc_http_parser_destroy(&req->parser);
if (req->addresses != NULL) {
grpc_resolved_addresses_destroy(req->addresses);
}
@ -129,7 +130,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, bool success) {
for (i = 0; i < req->incoming.count; i++) {
if (GPR_SLICE_LENGTH(req->incoming.slices[i])) {
req->have_read_byte = 1;
if (!grpc_httpcli_parser_parse(&req->parser, req->incoming.slices[i])) {
if (!grpc_http_parser_parse(&req->parser, req->incoming.slices[i])) {
finish(exec_ctx, req, 0);
return;
}
@ -141,7 +142,11 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, bool success) {
} else if (!req->have_read_byte) {
next_address(exec_ctx, req);
} else {
finish(exec_ctx, req, grpc_httpcli_parser_eof(&req->parser));
int parse_success = grpc_http_parser_eof(&req->parser);
if (parse_success && (req->parser.type != GRPC_HTTP_RESPONSE)) {
parse_success = 0;
}
finish(exec_ctx, req, parse_success);
}
}
@ -223,7 +228,7 @@ static void internal_request_begin(
internal_request *req = gpr_malloc(sizeof(internal_request));
memset(req, 0, sizeof(*req));
req->request_text = request_text;
grpc_httpcli_parser_init(&req->parser);
grpc_http_parser_init(&req->parser);
req->on_response = on_response;
req->user_data = user_data;
req->deadline = deadline;
@ -255,7 +260,7 @@ void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
g_get_override(exec_ctx, request, deadline, on_response, user_data)) {
return;
}
gpr_asprintf(&name, "HTTP:GET:%s:%s", request->host, request->path);
gpr_asprintf(&name, "HTTP:GET:%s:%s", request->host, request->http.path);
internal_request_begin(exec_ctx, context, pollset, request, deadline,
on_response, user_data, name,
grpc_httpcli_format_get_request(request));
@ -274,7 +279,7 @@ void grpc_httpcli_post(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
on_response, user_data)) {
return;
}
gpr_asprintf(&name, "HTTP:POST:%s:%s", request->host, request->path);
gpr_asprintf(&name, "HTTP:POST:%s:%s", request->host, request->http.path);
internal_request_begin(
exec_ctx, context, pollset, request, deadline, on_response, user_data,
name, grpc_httpcli_format_post_request(request, body_bytes, body_size));

@ -31,27 +31,20 @@
*
*/
#ifndef GRPC_CORE_HTTPCLI_HTTPCLI_H
#define GRPC_CORE_HTTPCLI_HTTPCLI_H
#ifndef GRPC_CORE_HTTP_HTTPCLI_H
#define GRPC_CORE_HTTP_HTTPCLI_H
#include <stddef.h>
#include <grpc/support/time.h>
#include "src/core/http/parser.h"
#include "src/core/iomgr/endpoint.h"
#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/pollset_set.h"
/* User agent this library reports */
#define GRPC_HTTPCLI_USER_AGENT "grpc-httpcli/0.0"
/* Maximum length of a header string of the form 'Key: Value\r\n' */
#define GRPC_HTTPCLI_MAX_HEADER_LENGTH 4096
/* A single header to be passed in a request */
typedef struct grpc_httpcli_header {
char *key;
char *value;
} grpc_httpcli_header;
/* Tracks in-progress http requests
TODO(ctiller): allow caching and capturing multiple requests for the
@ -77,33 +70,21 @@ typedef struct grpc_httpcli_request {
char *host;
/* The host to verify in the SSL handshake (or NULL) */
char *ssl_host_override;
/* The path of the resource to fetch */
char *path;
/* Additional headers: count and key/values; the following are supplied
automatically and MUST NOT be set here:
/* The main part of the request
The following headers are supplied automatically and MUST NOT be set here:
Host, Connection, User-Agent */
size_t hdr_count;
grpc_httpcli_header *hdrs;
grpc_http_request http;
/* handshaker to use ssl for the request */
const grpc_httpcli_handshaker *handshaker;
} grpc_httpcli_request;
/* A response */
typedef struct grpc_httpcli_response {
/* HTTP status code */
int status;
/* Headers: count and key/values */
size_t hdr_count;
grpc_httpcli_header *hdrs;
/* Body: length and contents; contents are NOT null-terminated */
size_t body_length;
char *body;
} grpc_httpcli_response;
/* Expose the parser response type as a httpcli response too */
typedef struct grpc_http_response grpc_httpcli_response;
/* Callback for grpc_httpcli_get and grpc_httpcli_post. */
typedef void (*grpc_httpcli_response_cb)(grpc_exec_ctx *exec_ctx,
void *user_data,
const grpc_httpcli_response *response);
const grpc_http_response *response);
void grpc_httpcli_context_init(grpc_httpcli_context *context);
void grpc_httpcli_context_destroy(grpc_httpcli_context *context);
@ -160,4 +141,4 @@ typedef int (*grpc_httpcli_post_override)(
void grpc_httpcli_set_override(grpc_httpcli_get_override get,
grpc_httpcli_post_override post);
#endif /* GRPC_CORE_HTTPCLI_HTTPCLI_H */
#endif /* GRPC_CORE_HTTP_HTTPCLI_H */

@ -31,7 +31,7 @@
*
*/
#include "src/core/httpcli/httpcli.h"
#include "src/core/http/httpcli.h"
#include <string.h>

@ -0,0 +1,313 @@
/*
*
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/http/parser.h"
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
static char *buf2str(void *buffer, size_t length) {
char *out = gpr_malloc(length + 1);
memcpy(out, buffer, length);
out[length] = 0;
return out;
}
static int handle_response_line(grpc_http_parser *parser) {
uint8_t *beg = parser->cur_line;
uint8_t *cur = beg;
uint8_t *end = beg + parser->cur_line_length;
if (cur == end || *cur++ != 'H') goto error;
if (cur == end || *cur++ != 'T') goto error;
if (cur == end || *cur++ != 'T') goto error;
if (cur == end || *cur++ != 'P') goto error;
if (cur == end || *cur++ != '/') goto error;
if (cur == end || *cur++ != '1') goto error;
if (cur == end || *cur++ != '.') goto error;
if (cur == end || *cur < '0' || *cur++ > '1') goto error;
if (cur == end || *cur++ != ' ') goto error;
if (cur == end || *cur < '1' || *cur++ > '9') goto error;
if (cur == end || *cur < '0' || *cur++ > '9') goto error;
if (cur == end || *cur < '0' || *cur++ > '9') goto error;
parser->http.response.status =
(cur[-3] - '0') * 100 + (cur[-2] - '0') * 10 + (cur[-1] - '0');
if (cur == end || *cur++ != ' ') goto error;
/* we don't really care about the status code message */
return 1;
error:
gpr_log(GPR_ERROR, "Failed parsing response line");
return 0;
}
static int handle_request_line(grpc_http_parser *parser) {
uint8_t *beg = parser->cur_line;
uint8_t *cur = beg;
uint8_t *end = beg + parser->cur_line_length;
uint8_t vers_major = 0;
uint8_t vers_minor = 0;
while (cur != end && *cur++ != ' ')
;
if (cur == end) goto error;
parser->http.request.method = buf2str(beg, (size_t)(cur - beg - 1));
beg = cur;
while (cur != end && *cur++ != ' ')
;
if (cur == end) goto error;
parser->http.request.path = buf2str(beg, (size_t)(cur - beg - 1));
if (cur == end || *cur++ != 'H') goto error;
if (cur == end || *cur++ != 'T') goto error;
if (cur == end || *cur++ != 'T') goto error;
if (cur == end || *cur++ != 'P') goto error;
if (cur == end || *cur++ != '/') goto error;
vers_major = (uint8_t)(*cur++ - '1' + 1);
++cur;
if (cur == end) goto error;
vers_minor = (uint8_t)(*cur++ - '1' + 1);
if (vers_major == 1) {
if (vers_minor == 0) {
parser->http.request.version = GRPC_HTTP_HTTP10;
} else if (vers_minor == 1) {
parser->http.request.version = GRPC_HTTP_HTTP11;
} else {
goto error;
}
} else if (vers_major == 2) {
if (vers_minor == 0) {
parser->http.request.version = GRPC_HTTP_HTTP20;
} else {
goto error;
}
} else {
goto error;
}
return 1;
error:
gpr_log(GPR_ERROR, "Failed parsing request line");
return 0;
}
static int handle_first_line(grpc_http_parser *parser) {
if (parser->cur_line[0] == 'H') {
parser->type = GRPC_HTTP_RESPONSE;
return handle_response_line(parser);
} else {
parser->type = GRPC_HTTP_REQUEST;
return handle_request_line(parser);
}
}
static int add_header(grpc_http_parser *parser) {
uint8_t *beg = parser->cur_line;
uint8_t *cur = beg;
uint8_t *end = beg + parser->cur_line_length;
size_t *hdr_count = NULL;
grpc_http_header **hdrs = NULL;
grpc_http_header hdr = {NULL, NULL};
GPR_ASSERT(cur != end);
if (*cur == ' ' || *cur == '\t') {
gpr_log(GPR_ERROR, "Continued header lines not supported yet");
goto error;
}
while (cur != end && *cur != ':') {
cur++;
}
if (cur == end) {
gpr_log(GPR_ERROR, "Didn't find ':' in header string");
goto error;
}
GPR_ASSERT(cur >= beg);
hdr.key = buf2str(beg, (size_t)(cur - beg));
cur++; /* skip : */
while (cur != end && (*cur == ' ' || *cur == '\t')) {
cur++;
}
GPR_ASSERT(end - cur >= 2);
hdr.value = buf2str(cur, (size_t)(end - cur) - 2);
if (parser->type == GRPC_HTTP_RESPONSE) {
hdr_count = &parser->http.response.hdr_count;
hdrs = &parser->http.response.hdrs;
} else if (parser->type == GRPC_HTTP_REQUEST) {
hdr_count = &parser->http.request.hdr_count;
hdrs = &parser->http.request.hdrs;
} else {
return 0;
}
if (*hdr_count == parser->hdr_capacity) {
parser->hdr_capacity =
GPR_MAX(parser->hdr_capacity + 1, parser->hdr_capacity * 3 / 2);
*hdrs = gpr_realloc(*hdrs, parser->hdr_capacity * sizeof(**hdrs));
}
(*hdrs)[(*hdr_count)++] = hdr;
return 1;
error:
gpr_free(hdr.key);
gpr_free(hdr.value);
return 0;
}
static int finish_line(grpc_http_parser *parser) {
switch (parser->state) {
case GRPC_HTTP_FIRST_LINE:
if (!handle_first_line(parser)) {
return 0;
}
parser->state = GRPC_HTTP_HEADERS;
break;
case GRPC_HTTP_HEADERS:
if (parser->cur_line_length == 2) {
parser->state = GRPC_HTTP_BODY;
break;
}
if (!add_header(parser)) {
return 0;
}
break;
case GRPC_HTTP_BODY:
GPR_UNREACHABLE_CODE(return 0);
}
parser->cur_line_length = 0;
return 1;
}
static int addbyte_body(grpc_http_parser *parser, uint8_t byte) {
size_t *body_length = NULL;
char **body = NULL;
if (parser->type == GRPC_HTTP_RESPONSE) {
body_length = &parser->http.response.body_length;
body = &parser->http.response.body;
} else if (parser->type == GRPC_HTTP_REQUEST) {
body_length = &parser->http.request.body_length;
body = &parser->http.request.body;
} else {
return 0;
}
if (*body_length == parser->body_capacity) {
parser->body_capacity = GPR_MAX(8, parser->body_capacity * 3 / 2);
*body = gpr_realloc((void *)*body, parser->body_capacity);
}
(*body)[*body_length] = (char)byte;
(*body_length)++;
return 1;
}
static int addbyte(grpc_http_parser *parser, uint8_t byte) {
switch (parser->state) {
case GRPC_HTTP_FIRST_LINE:
case GRPC_HTTP_HEADERS:
if (parser->cur_line_length >= GRPC_HTTP_PARSER_MAX_HEADER_LENGTH) {
gpr_log(GPR_ERROR, "HTTP client max line length (%d) exceeded",
GRPC_HTTP_PARSER_MAX_HEADER_LENGTH);
return 0;
}
parser->cur_line[parser->cur_line_length] = byte;
parser->cur_line_length++;
if (parser->cur_line_length >= 2 &&
parser->cur_line[parser->cur_line_length - 2] == '\r' &&
parser->cur_line[parser->cur_line_length - 1] == '\n') {
return finish_line(parser);
} else {
return 1;
}
GPR_UNREACHABLE_CODE(return 0);
case GRPC_HTTP_BODY:
return addbyte_body(parser, byte);
}
GPR_UNREACHABLE_CODE(return 0);
}
void grpc_http_parser_init(grpc_http_parser *parser) {
memset(parser, 0, sizeof(*parser));
parser->state = GRPC_HTTP_FIRST_LINE;
parser->type = GRPC_HTTP_UNKNOWN;
}
void grpc_http_parser_destroy(grpc_http_parser *parser) {
size_t i;
if (parser->type == GRPC_HTTP_RESPONSE) {
gpr_free(parser->http.response.body);
for (i = 0; i < parser->http.response.hdr_count; i++) {
gpr_free(parser->http.response.hdrs[i].key);
gpr_free(parser->http.response.hdrs[i].value);
}
gpr_free(parser->http.response.hdrs);
} else if (parser->type == GRPC_HTTP_REQUEST) {
gpr_free(parser->http.request.body);
for (i = 0; i < parser->http.request.hdr_count; i++) {
gpr_free(parser->http.request.hdrs[i].key);
gpr_free(parser->http.request.hdrs[i].value);
}
gpr_free(parser->http.request.hdrs);
gpr_free(parser->http.request.method);
gpr_free(parser->http.request.path);
}
}
int grpc_http_parser_parse(grpc_http_parser *parser, gpr_slice slice) {
size_t i;
for (i = 0; i < GPR_SLICE_LENGTH(slice); i++) {
if (!addbyte(parser, GPR_SLICE_START_PTR(slice)[i])) {
return 0;
}
}
return 1;
}
int grpc_http_parser_eof(grpc_http_parser *parser) {
return parser->state == GRPC_HTTP_BODY;
}

@ -0,0 +1,116 @@
/*
*
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_CORE_HTTP_PARSER_H
#define GRPC_CORE_HTTP_PARSER_H
#include <grpc/support/port_platform.h>
#include <grpc/support/slice.h>
/* Maximum length of a header string of the form 'Key: Value\r\n' */
#define GRPC_HTTP_PARSER_MAX_HEADER_LENGTH 4096
/* A single header to be passed in a request */
typedef struct grpc_http_header {
char *key;
char *value;
} grpc_http_header;
typedef enum {
GRPC_HTTP_FIRST_LINE,
GRPC_HTTP_HEADERS,
GRPC_HTTP_BODY
} grpc_http_parser_state;
typedef enum {
GRPC_HTTP_HTTP10,
GRPC_HTTP_HTTP11,
GRPC_HTTP_HTTP20,
} grpc_http_version;
typedef enum {
GRPC_HTTP_RESPONSE,
GRPC_HTTP_REQUEST,
GRPC_HTTP_UNKNOWN
} grpc_http_type;
/* A request */
typedef struct grpc_http_request {
/* Method of the request (e.g. GET, POST) */
char *method;
/* The path of the resource to fetch */
char *path;
/* HTTP version to use */
grpc_http_version version;
/* Headers attached to the request */
size_t hdr_count;
grpc_http_header *hdrs;
/* Body: length and contents; contents are NOT null-terminated */
size_t body_length;
char *body;
} grpc_http_request;
/* A response */
typedef struct grpc_http_response {
/* HTTP status code */
int status;
/* Headers: count and key/values */
size_t hdr_count;
grpc_http_header *hdrs;
/* Body: length and contents; contents are NOT null-terminated */
size_t body_length;
char *body;
} grpc_http_response;
typedef struct {
grpc_http_parser_state state;
grpc_http_type type;
union {
grpc_http_response response;
grpc_http_request request;
} http;
size_t body_capacity;
size_t hdr_capacity;
uint8_t cur_line[GRPC_HTTP_PARSER_MAX_HEADER_LENGTH];
size_t cur_line_length;
} grpc_http_parser;
void grpc_http_parser_init(grpc_http_parser *parser);
void grpc_http_parser_destroy(grpc_http_parser *parser);
int grpc_http_parser_parse(grpc_http_parser *parser, gpr_slice slice);
int grpc_http_parser_eof(grpc_http_parser *parser);
#endif /* GRPC_CORE_HTTP_PARSER_H */

@ -1,211 +0,0 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/httpcli/parser.h"
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
static int handle_response_line(grpc_httpcli_parser *parser) {
uint8_t *beg = parser->cur_line;
uint8_t *cur = beg;
uint8_t *end = beg + parser->cur_line_length;
if (cur == end || *cur++ != 'H') goto error;
if (cur == end || *cur++ != 'T') goto error;
if (cur == end || *cur++ != 'T') goto error;
if (cur == end || *cur++ != 'P') goto error;
if (cur == end || *cur++ != '/') goto error;
if (cur == end || *cur++ != '1') goto error;
if (cur == end || *cur++ != '.') goto error;
if (cur == end || *cur < '0' || *cur++ > '1') goto error;
if (cur == end || *cur++ != ' ') goto error;
if (cur == end || *cur < '1' || *cur++ > '9') goto error;
if (cur == end || *cur < '0' || *cur++ > '9') goto error;
if (cur == end || *cur < '0' || *cur++ > '9') goto error;
parser->r.status =
(cur[-3] - '0') * 100 + (cur[-2] - '0') * 10 + (cur[-1] - '0');
if (cur == end || *cur++ != ' ') goto error;
/* we don't really care about the status code message */
return 1;
error:
gpr_log(GPR_ERROR, "Failed parsing response line");
return 0;
}
static char *buf2str(void *buffer, size_t length) {
char *out = gpr_malloc(length + 1);
memcpy(out, buffer, length);
out[length] = 0;
return out;
}
static int add_header(grpc_httpcli_parser *parser) {
uint8_t *beg = parser->cur_line;
uint8_t *cur = beg;
uint8_t *end = beg + parser->cur_line_length;
grpc_httpcli_header hdr = {NULL, NULL};
GPR_ASSERT(cur != end);
if (*cur == ' ' || *cur == '\t') {
gpr_log(GPR_ERROR, "Continued header lines not supported yet");
goto error;
}
while (cur != end && *cur != ':') {
cur++;
}
if (cur == end) {
gpr_log(GPR_ERROR, "Didn't find ':' in header string");
goto error;
}
GPR_ASSERT(cur >= beg);
hdr.key = buf2str(beg, (size_t)(cur - beg));
cur++; /* skip : */
while (cur != end && (*cur == ' ' || *cur == '\t')) {
cur++;
}
GPR_ASSERT(end - cur >= 2);
hdr.value = buf2str(cur, (size_t)(end - cur) - 2);
if (parser->r.hdr_count == parser->hdr_capacity) {
parser->hdr_capacity =
GPR_MAX(parser->hdr_capacity + 1, parser->hdr_capacity * 3 / 2);
parser->r.hdrs = gpr_realloc(
parser->r.hdrs, parser->hdr_capacity * sizeof(*parser->r.hdrs));
}
parser->r.hdrs[parser->r.hdr_count++] = hdr;
return 1;
error:
gpr_free(hdr.key);
gpr_free(hdr.value);
return 0;
}
static int finish_line(grpc_httpcli_parser *parser) {
switch (parser->state) {
case GRPC_HTTPCLI_INITIAL_RESPONSE:
if (!handle_response_line(parser)) {
return 0;
}
parser->state = GRPC_HTTPCLI_HEADERS;
break;
case GRPC_HTTPCLI_HEADERS:
if (parser->cur_line_length == 2) {
parser->state = GRPC_HTTPCLI_BODY;
break;
}
if (!add_header(parser)) {
return 0;
}
break;
case GRPC_HTTPCLI_BODY:
GPR_UNREACHABLE_CODE(return 0);
}
parser->cur_line_length = 0;
return 1;
}
static int addbyte(grpc_httpcli_parser *parser, uint8_t byte) {
switch (parser->state) {
case GRPC_HTTPCLI_INITIAL_RESPONSE:
case GRPC_HTTPCLI_HEADERS:
if (parser->cur_line_length >= GRPC_HTTPCLI_MAX_HEADER_LENGTH) {
gpr_log(GPR_ERROR, "HTTP client max line length (%d) exceeded",
GRPC_HTTPCLI_MAX_HEADER_LENGTH);
return 0;
}
parser->cur_line[parser->cur_line_length] = byte;
parser->cur_line_length++;
if (parser->cur_line_length >= 2 &&
parser->cur_line[parser->cur_line_length - 2] == '\r' &&
parser->cur_line[parser->cur_line_length - 1] == '\n') {
return finish_line(parser);
} else {
return 1;
}
GPR_UNREACHABLE_CODE(return 0);
case GRPC_HTTPCLI_BODY:
if (parser->r.body_length == parser->body_capacity) {
parser->body_capacity = GPR_MAX(8, parser->body_capacity * 3 / 2);
parser->r.body =
gpr_realloc((void *)parser->r.body, parser->body_capacity);
}
parser->r.body[parser->r.body_length] = (char)byte;
parser->r.body_length++;
return 1;
}
GPR_UNREACHABLE_CODE(return 0);
}
void grpc_httpcli_parser_init(grpc_httpcli_parser *parser) {
memset(parser, 0, sizeof(*parser));
parser->state = GRPC_HTTPCLI_INITIAL_RESPONSE;
parser->r.status = 500;
}
void grpc_httpcli_parser_destroy(grpc_httpcli_parser *parser) {
size_t i;
gpr_free(parser->r.body);
for (i = 0; i < parser->r.hdr_count; i++) {
gpr_free(parser->r.hdrs[i].key);
gpr_free(parser->r.hdrs[i].value);
}
gpr_free(parser->r.hdrs);
}
int grpc_httpcli_parser_parse(grpc_httpcli_parser *parser, gpr_slice slice) {
size_t i;
for (i = 0; i < GPR_SLICE_LENGTH(slice); i++) {
if (!addbyte(parser, GPR_SLICE_START_PTR(slice)[i])) {
return 0;
}
}
return 1;
}
int grpc_httpcli_parser_eof(grpc_httpcli_parser *parser) {
return parser->state == GRPC_HTTPCLI_BODY;
}

@ -1,64 +0,0 @@
/*
*
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_CORE_HTTPCLI_PARSER_H
#define GRPC_CORE_HTTPCLI_PARSER_H
#include "src/core/httpcli/httpcli.h"
#include <grpc/support/port_platform.h>
#include <grpc/support/slice.h>
typedef enum {
GRPC_HTTPCLI_INITIAL_RESPONSE,
GRPC_HTTPCLI_HEADERS,
GRPC_HTTPCLI_BODY
} grpc_httpcli_parser_state;
typedef struct {
grpc_httpcli_parser_state state;
grpc_httpcli_response r;
size_t body_capacity;
size_t hdr_capacity;
uint8_t cur_line[GRPC_HTTPCLI_MAX_HEADER_LENGTH];
size_t cur_line_length;
} grpc_httpcli_parser;
void grpc_httpcli_parser_init(grpc_httpcli_parser* parser);
void grpc_httpcli_parser_destroy(grpc_httpcli_parser* parser);
int grpc_httpcli_parser_parse(grpc_httpcli_parser* parser, gpr_slice slice);
int grpc_httpcli_parser_eof(grpc_httpcli_parser* parser);
#endif /* GRPC_CORE_HTTPCLI_PARSER_H */

@ -38,7 +38,8 @@
#include "src/core/channel/channel_args.h"
#include "src/core/channel/http_client_filter.h"
#include "src/core/httpcli/httpcli.h"
#include "src/core/http/parser.h"
#include "src/core/http/httpcli.h"
#include "src/core/iomgr/executor.h"
#include "src/core/json/json.h"
#include "src/core/support/string.h"
@ -539,7 +540,7 @@ static void oauth2_token_fetcher_destruct(grpc_call_credentials *creds) {
grpc_credentials_status
grpc_oauth2_token_fetcher_credentials_parse_server_response(
const grpc_httpcli_response *response, grpc_credentials_md_store **token_md,
const grpc_http_response *response, grpc_credentials_md_store **token_md,
gpr_timespec *token_lifetime) {
char *null_terminated_body = NULL;
char *new_access_token = NULL;
@ -629,7 +630,7 @@ end:
static void on_oauth2_token_fetcher_http_response(
grpc_exec_ctx *exec_ctx, void *user_data,
const grpc_httpcli_response *response) {
const grpc_http_response *response) {
grpc_credentials_metadata_request *r =
(grpc_credentials_metadata_request *)user_data;
grpc_oauth2_token_fetcher_credentials *c =
@ -706,13 +707,13 @@ static void compute_engine_fetch_oauth2(
grpc_exec_ctx *exec_ctx, grpc_credentials_metadata_request *metadata_req,
grpc_httpcli_context *httpcli_context, grpc_pollset *pollset,
grpc_httpcli_response_cb response_cb, gpr_timespec deadline) {
grpc_httpcli_header header = {"Metadata-Flavor", "Google"};
grpc_http_header header = {"Metadata-Flavor", "Google"};
grpc_httpcli_request request;
memset(&request, 0, sizeof(grpc_httpcli_request));
request.host = GRPC_COMPUTE_ENGINE_METADATA_HOST;
request.path = GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH;
request.hdr_count = 1;
request.hdrs = &header;
request.http.path = GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH;
request.http.hdr_count = 1;
request.http.hdrs = &header;
grpc_httpcli_get(exec_ctx, httpcli_context, pollset, &request, deadline,
response_cb, metadata_req);
}
@ -747,8 +748,8 @@ static void refresh_token_fetch_oauth2(
grpc_httpcli_response_cb response_cb, gpr_timespec deadline) {
grpc_google_refresh_token_credentials *c =
(grpc_google_refresh_token_credentials *)metadata_req->creds;
grpc_httpcli_header header = {"Content-Type",
"application/x-www-form-urlencoded"};
grpc_http_header header = {"Content-Type",
"application/x-www-form-urlencoded"};
grpc_httpcli_request request;
char *body = NULL;
gpr_asprintf(&body, GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING,
@ -756,9 +757,9 @@ static void refresh_token_fetch_oauth2(
c->refresh_token.refresh_token);
memset(&request, 0, sizeof(grpc_httpcli_request));
request.host = GRPC_GOOGLE_OAUTH2_SERVICE_HOST;
request.path = GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH;
request.hdr_count = 1;
request.hdrs = &header;
request.http.path = GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH;
request.http.hdr_count = 1;
request.http.hdrs = &header;
request.handshaker = &grpc_httpcli_ssl;
grpc_httpcli_post(exec_ctx, httpcli_context, pollset, &request, body,
strlen(body), deadline, response_cb, metadata_req);

@ -39,11 +39,12 @@
#include <grpc/grpc_security.h>
#include <grpc/support/sync.h>
#include "src/core/httpcli/httpcli.h"
#include "src/core/http/httpcli.h"
#include "src/core/http/parser.h"
#include "src/core/security/json_token.h"
#include "src/core/security/security_connector.h"
struct grpc_httpcli_response;
struct grpc_http_response;
/* --- Constants. --- */
@ -207,7 +208,7 @@ grpc_call_credentials *grpc_credentials_contains_type(
/* Exposed for testing only. */
grpc_credentials_status
grpc_oauth2_token_fetcher_credentials_parse_server_response(
const struct grpc_httpcli_response *response,
const struct grpc_http_response *response,
grpc_credentials_md_store **token_md, gpr_timespec *token_lifetime);
void grpc_flush_cached_google_default_credentials(void);

@ -39,7 +39,8 @@
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include "src/core/httpcli/httpcli.h"
#include "src/core/http/httpcli.h"
#include "src/core/http/parser.h"
#include "src/core/support/env.h"
#include "src/core/support/load_file.h"
#include "src/core/surface/api_trace.h"
@ -66,14 +67,14 @@ typedef struct {
static void on_compute_engine_detection_http_response(
grpc_exec_ctx *exec_ctx, void *user_data,
const grpc_httpcli_response *response) {
const grpc_http_response *response) {
compute_engine_detector *detector = (compute_engine_detector *)user_data;
if (response != NULL && response->status == 200 && response->hdr_count > 0) {
/* Internet providers can return a generic response to all requests, so
it is necessary to check that metadata header is present also. */
size_t i;
for (i = 0; i < response->hdr_count; i++) {
grpc_httpcli_header *header = &response->hdrs[i];
grpc_http_header *header = &response->hdrs[i];
if (strcmp(header->key, "Metadata-Flavor") == 0 &&
strcmp(header->value, "Google") == 0) {
detector->success = 1;
@ -109,7 +110,7 @@ static int is_stack_running_on_compute_engine(void) {
memset(&request, 0, sizeof(grpc_httpcli_request));
request.host = GRPC_COMPUTE_ENGINE_DETECTION_HOST;
request.path = "/";
request.http.path = "/";
grpc_httpcli_context_init(&context);

@ -36,7 +36,7 @@
#include <limits.h>
#include <string.h>
#include "src/core/httpcli/httpcli.h"
#include "src/core/http/httpcli.h"
#include "src/core/security/b64.h"
#include "src/core/tsi/ssl_types.h"
@ -635,11 +635,11 @@ static void on_openid_config_retrieved(grpc_exec_ctx *exec_ctx, void *user_data,
jwks_uri += 8;
req.handshaker = &grpc_httpcli_ssl;
req.host = gpr_strdup(jwks_uri);
req.path = strchr(jwks_uri, '/');
if (req.path == NULL) {
req.path = "";
req.http.path = strchr(jwks_uri, '/');
if (req.http.path == NULL) {
req.http.path = "";
} else {
*(req.host + (req.path - jwks_uri)) = '\0';
*(req.host + (req.http.path - jwks_uri)) = '\0';
}
grpc_httpcli_get(
exec_ctx, &ctx->verifier->http_ctx, ctx->pollset, &req,
@ -725,20 +725,20 @@ static void retrieve_key_and_verify(grpc_exec_ctx *exec_ctx,
req.host = gpr_strdup(mapping->key_url_prefix);
path_prefix = strchr(req.host, '/');
if (path_prefix == NULL) {
gpr_asprintf(&req.path, "/%s", iss);
gpr_asprintf(&req.http.path, "/%s", iss);
} else {
*(path_prefix++) = '\0';
gpr_asprintf(&req.path, "/%s/%s", path_prefix, iss);
gpr_asprintf(&req.http.path, "/%s/%s", path_prefix, iss);
}
http_cb = on_keys_retrieved;
} else {
req.host = gpr_strdup(strstr(iss, "https://") == iss ? iss + 8 : iss);
path_prefix = strchr(req.host, '/');
if (path_prefix == NULL) {
req.path = gpr_strdup(GRPC_OPENID_CONFIG_URL_SUFFIX);
req.http.path = gpr_strdup(GRPC_OPENID_CONFIG_URL_SUFFIX);
} else {
*(path_prefix++) = 0;
gpr_asprintf(&req.path, "/%s%s", path_prefix,
gpr_asprintf(&req.http.path, "/%s%s", path_prefix,
GRPC_OPENID_CONFIG_URL_SUFFIX);
}
http_cb = on_openid_config_retrieved;
@ -749,7 +749,7 @@ static void retrieve_key_and_verify(grpc_exec_ctx *exec_ctx,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay),
http_cb, ctx);
gpr_free(req.host);
gpr_free(req.path);
gpr_free(req.http.path);
return;
error:

@ -108,9 +108,9 @@ CORE_SOURCE_FILES = [
'src/core/compression/compression_algorithm.c',
'src/core/compression/message_compress.c',
'src/core/debug/trace.c',
'src/core/httpcli/format_request.c',
'src/core/httpcli/httpcli.c',
'src/core/httpcli/parser.c',
'src/core/http/format_request.c',
'src/core/http/httpcli.c',
'src/core/http/parser.c',
'src/core/iomgr/closure.c',
'src/core/iomgr/endpoint.c',
'src/core/iomgr/endpoint_pair_posix.c',
@ -206,7 +206,7 @@ CORE_SOURCE_FILES = [
'src/core/transport/static_metadata.c',
'src/core/transport/transport.c',
'src/core/transport/transport_op_string.c',
'src/core/httpcli/httpcli_security_connector.c',
'src/core/http/httpcli_security_connector.c',
'src/core/security/b64.c',
'src/core/security/client_auth_filter.c',
'src/core/security/credentials.c',

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,7 +31,7 @@
*
*/
#include "src/core/httpcli/format_request.h"
#include "src/core/http/format_request.h"
#include <string.h>
@ -39,15 +39,15 @@
#include "test/core/util/test_config.h"
static void test_format_get_request(void) {
grpc_httpcli_header hdr = {"x-yz", "abc"};
grpc_http_header hdr = {"x-yz", "abc"};
grpc_httpcli_request req;
gpr_slice slice;
memset(&req, 0, sizeof(req));
req.host = "example.com";
req.path = "/index.html";
req.hdr_count = 1;
req.hdrs = &hdr;
req.http.path = "/index.html";
req.http.hdr_count = 1;
req.http.hdrs = &hdr;
slice = grpc_httpcli_format_get_request(&req);
@ -64,7 +64,7 @@ static void test_format_get_request(void) {
}
static void test_format_post_request(void) {
grpc_httpcli_header hdr = {"x-yz", "abc"};
grpc_http_header hdr = {"x-yz", "abc"};
grpc_httpcli_request req;
gpr_slice slice;
char body_bytes[] = "fake body";
@ -72,9 +72,9 @@ static void test_format_post_request(void) {
memset(&req, 0, sizeof(req));
req.host = "example.com";
req.path = "/index.html";
req.hdr_count = 1;
req.hdrs = &hdr;
req.http.path = "/index.html";
req.http.hdr_count = 1;
req.http.hdrs = &hdr;
slice = grpc_httpcli_format_post_request(&req, body_bytes, body_len);
@ -94,15 +94,15 @@ static void test_format_post_request(void) {
}
static void test_format_post_request_no_body(void) {
grpc_httpcli_header hdr = {"x-yz", "abc"};
grpc_http_header hdr = {"x-yz", "abc"};
grpc_httpcli_request req;
gpr_slice slice;
memset(&req, 0, sizeof(req));
req.host = "example.com";
req.path = "/index.html";
req.hdr_count = 1;
req.hdrs = &hdr;
req.http.path = "/index.html";
req.http.hdr_count = 1;
req.http.hdrs = &hdr;
slice = grpc_httpcli_format_post_request(&req, NULL, 0);
@ -119,7 +119,7 @@ static void test_format_post_request_no_body(void) {
}
static void test_format_post_request_content_type_override(void) {
grpc_httpcli_header hdrs[2];
grpc_http_header hdrs[2];
grpc_httpcli_request req;
gpr_slice slice;
char body_bytes[] = "fake%20body";
@ -131,9 +131,9 @@ static void test_format_post_request_content_type_override(void) {
hdrs[1].value = "application/x-www-form-urlencoded";
memset(&req, 0, sizeof(req));
req.host = "example.com";
req.path = "/index.html";
req.hdr_count = 2;
req.hdrs = hdrs;
req.http.path = "/index.html";
req.http.hdr_count = 2;
req.http.hdrs = hdrs;
slice = grpc_httpcli_format_post_request(&req, body_bytes, body_len);

@ -31,7 +31,7 @@
*
*/
#include "src/core/httpcli/httpcli.h"
#include "src/core/http/httpcli.h"
#include <string.h>
@ -83,7 +83,7 @@ static void test_get(int port) {
memset(&req, 0, sizeof(req));
req.host = host;
req.path = "/get";
req.http.path = "/get";
req.handshaker = &grpc_httpcli_plaintext;
grpc_httpcli_get(&exec_ctx, &g_context, g_pollset, &req, n_seconds_time(15),
@ -114,7 +114,7 @@ static void test_post(int port) {
memset(&req, 0, sizeof(req));
req.host = host;
req.path = "/post";
req.http.path = "/post";
req.handshaker = &grpc_httpcli_plaintext;
grpc_httpcli_post(&exec_ctx, &g_context, g_pollset, &req, "hello", 5,
@ -161,7 +161,7 @@ int main(int argc, char **argv) {
} else {
arg_shift = 1;
gpr_asprintf(&args[0], "%s/../../tools/distrib/python_wrapper.sh", root);
gpr_asprintf(&args[1], "%s/../../test/core/httpcli/test_server.py", root);
gpr_asprintf(&args[1], "%s/../../test/core/http/test_server.py", root);
}
/* start the server */

@ -31,7 +31,7 @@
*
*/
#include "src/core/httpcli/httpcli.h"
#include "src/core/http/httpcli.h"
#include <string.h>
@ -84,7 +84,7 @@ static void test_get(int port) {
memset(&req, 0, sizeof(req));
req.host = host;
req.ssl_host_override = "foo.test.google.fr";
req.path = "/get";
req.http.path = "/get";
req.handshaker = &grpc_httpcli_ssl;
grpc_httpcli_get(&exec_ctx, &g_context, g_pollset, &req, n_seconds_time(15),
@ -116,7 +116,7 @@ static void test_post(int port) {
memset(&req, 0, sizeof(req));
req.host = host;
req.ssl_host_override = "foo.test.google.fr";
req.path = "/post";
req.http.path = "/post";
req.handshaker = &grpc_httpcli_ssl;
grpc_httpcli_post(&exec_ctx, &g_context, g_pollset, &req, "hello", 5,
@ -163,7 +163,7 @@ int main(int argc, char **argv) {
} else {
arg_shift = 1;
gpr_asprintf(&args[0], "%s/../../tools/distrib/python_wrapper.sh", root);
gpr_asprintf(&args[1], "%s/../../test/core/httpcli/test_server.py", root);
gpr_asprintf(&args[1], "%s/../../test/core/http/test_server.py", root);
}
/* start the server */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,7 +31,7 @@
*
*/
#include "src/core/httpcli/parser.h"
#include "src/core/http/parser.h"
#include <stdarg.h>
#include <string.h>
@ -43,9 +43,65 @@
#include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h"
static void test_request_succeeds(grpc_slice_split_mode split_mode,
char *request, char *expect_method,
grpc_http_version expect_version,
char *expect_path, char *expect_body, ...) {
grpc_http_parser parser;
gpr_slice input_slice = gpr_slice_from_copied_string(request);
size_t num_slices;
size_t i;
gpr_slice *slices;
va_list args;
grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices);
gpr_slice_unref(input_slice);
grpc_http_parser_init(&parser);
for (i = 0; i < num_slices; i++) {
GPR_ASSERT(grpc_http_parser_parse(&parser, slices[i]));
gpr_slice_unref(slices[i]);
}
GPR_ASSERT(grpc_http_parser_eof(&parser));
GPR_ASSERT(GRPC_HTTP_REQUEST == parser.type);
GPR_ASSERT(0 == strcmp(expect_method, parser.http.request.method));
GPR_ASSERT(0 == strcmp(expect_path, parser.http.request.path));
GPR_ASSERT(expect_version == parser.http.request.version);
if (expect_body != NULL) {
GPR_ASSERT(strlen(expect_body) == parser.http.request.body_length);
GPR_ASSERT(0 == memcmp(expect_body, parser.http.request.body,
parser.http.request.body_length));
} else {
GPR_ASSERT(parser.http.request.body_length == 0);
}
va_start(args, expect_body);
i = 0;
for (;;) {
char *expect_key;
char *expect_value;
expect_key = va_arg(args, char *);
if (!expect_key) break;
GPR_ASSERT(i < parser.http.request.hdr_count);
expect_value = va_arg(args, char *);
GPR_ASSERT(expect_value);
GPR_ASSERT(0 == strcmp(expect_key, parser.http.request.hdrs[i].key));
GPR_ASSERT(0 == strcmp(expect_value, parser.http.request.hdrs[i].value));
i++;
}
va_end(args);
GPR_ASSERT(i == parser.http.request.hdr_count);
grpc_http_parser_destroy(&parser);
gpr_free(slices);
}
static void test_succeeds(grpc_slice_split_mode split_mode, char *response,
int expect_status, char *expect_body, ...) {
grpc_httpcli_parser parser;
grpc_http_parser parser;
gpr_slice input_slice = gpr_slice_from_copied_string(response);
size_t num_slices;
size_t i;
@ -55,20 +111,22 @@ static void test_succeeds(grpc_slice_split_mode split_mode, char *response,
grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices);
gpr_slice_unref(input_slice);
grpc_httpcli_parser_init(&parser);
grpc_http_parser_init(&parser);
for (i = 0; i < num_slices; i++) {
GPR_ASSERT(grpc_httpcli_parser_parse(&parser, slices[i]));
GPR_ASSERT(grpc_http_parser_parse(&parser, slices[i]));
gpr_slice_unref(slices[i]);
}
GPR_ASSERT(grpc_httpcli_parser_eof(&parser));
GPR_ASSERT(grpc_http_parser_eof(&parser));
GPR_ASSERT(expect_status == parser.r.status);
GPR_ASSERT(GRPC_HTTP_RESPONSE == parser.type);
GPR_ASSERT(expect_status == parser.http.response.status);
if (expect_body != NULL) {
GPR_ASSERT(strlen(expect_body) == parser.r.body_length);
GPR_ASSERT(0 == memcmp(expect_body, parser.r.body, parser.r.body_length));
GPR_ASSERT(strlen(expect_body) == parser.http.response.body_length);
GPR_ASSERT(0 == memcmp(expect_body, parser.http.response.body,
parser.http.response.body_length));
} else {
GPR_ASSERT(parser.r.body_length == 0);
GPR_ASSERT(parser.http.response.body_length == 0);
}
va_start(args, expect_body);
@ -78,22 +136,22 @@ static void test_succeeds(grpc_slice_split_mode split_mode, char *response,
char *expect_value;
expect_key = va_arg(args, char *);
if (!expect_key) break;
GPR_ASSERT(i < parser.r.hdr_count);
GPR_ASSERT(i < parser.http.response.hdr_count);
expect_value = va_arg(args, char *);
GPR_ASSERT(expect_value);
GPR_ASSERT(0 == strcmp(expect_key, parser.r.hdrs[i].key));
GPR_ASSERT(0 == strcmp(expect_value, parser.r.hdrs[i].value));
GPR_ASSERT(0 == strcmp(expect_key, parser.http.response.hdrs[i].key));
GPR_ASSERT(0 == strcmp(expect_value, parser.http.response.hdrs[i].value));
i++;
}
va_end(args);
GPR_ASSERT(i == parser.r.hdr_count);
GPR_ASSERT(i == parser.http.response.hdr_count);
grpc_httpcli_parser_destroy(&parser);
grpc_http_parser_destroy(&parser);
gpr_free(slices);
}
static void test_fails(grpc_slice_split_mode split_mode, char *response) {
grpc_httpcli_parser parser;
grpc_http_parser parser;
gpr_slice input_slice = gpr_slice_from_copied_string(response);
size_t num_slices;
size_t i;
@ -103,20 +161,20 @@ static void test_fails(grpc_slice_split_mode split_mode, char *response) {
grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices);
gpr_slice_unref(input_slice);
grpc_httpcli_parser_init(&parser);
grpc_http_parser_init(&parser);
for (i = 0; i < num_slices; i++) {
if (!done && !grpc_httpcli_parser_parse(&parser, slices[i])) {
if (!done && !grpc_http_parser_parse(&parser, slices[i])) {
done = 1;
}
gpr_slice_unref(slices[i]);
}
if (!done && !grpc_httpcli_parser_eof(&parser)) {
if (!done && !grpc_http_parser_eof(&parser)) {
done = 1;
}
GPR_ASSERT(done);
grpc_httpcli_parser_destroy(&parser);
grpc_http_parser_destroy(&parser);
gpr_free(slices);
}
@ -145,6 +203,32 @@ int main(int argc, char **argv) {
"\r\n"
"hello world!",
200, "hello world!", "xyz", "abc", NULL);
test_request_succeeds(split_modes[i],
"GET / HTTP/1.0\r\n"
"\r\n",
"GET", GRPC_HTTP_HTTP10, "/", NULL, NULL);
test_request_succeeds(split_modes[i],
"GET / HTTP/1.0\r\n"
"\r\n"
"xyz",
"GET", GRPC_HTTP_HTTP10, "/", "xyz", NULL);
test_request_succeeds(split_modes[i],
"GET / HTTP/1.1\r\n"
"\r\n"
"xyz",
"GET", GRPC_HTTP_HTTP11, "/", "xyz", NULL);
test_request_succeeds(split_modes[i],
"GET / HTTP/2.0\r\n"
"\r\n"
"xyz",
"GET", GRPC_HTTP_HTTP20, "/", "xyz", NULL);
test_request_succeeds(split_modes[i],
"GET / HTTP/1.0\r\n"
"xyz: abc\r\n"
"\r\n"
"xyz",
"GET", GRPC_HTTP_HTTP10, "/", "xyz", "xyz", "abc",
NULL);
test_fails(split_modes[i], "HTTP/1.0\r\n");
test_fails(split_modes[i], "HTTP/1.2\r\n");
test_fails(split_modes[i], "HTTP/1.0 000 XYX\r\n");
@ -157,10 +241,15 @@ int main(int argc, char **argv) {
" def\r\n"
"\r\n"
"hello world!");
test_fails(split_modes[i], "GET\r\n");
test_fails(split_modes[i], "GET /\r\n");
test_fails(split_modes[i], "GET / HTTP/0.0\r\n");
test_fails(split_modes[i], "GET / ____/1.0\r\n");
test_fails(split_modes[i], "GET / HTTP/1.2\r\n");
tmp1 = gpr_malloc(2 * GRPC_HTTPCLI_MAX_HEADER_LENGTH);
memset(tmp1, 'a', 2 * GRPC_HTTPCLI_MAX_HEADER_LENGTH - 1);
tmp1[2 * GRPC_HTTPCLI_MAX_HEADER_LENGTH - 1] = 0;
tmp1 = gpr_malloc(2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH);
memset(tmp1, 'a', 2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH - 1);
tmp1[2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH - 1] = 0;
gpr_asprintf(&tmp2, "HTTP/1.0 200 OK\r\nxyz: %s\r\n\r\n", tmp1);
test_fails(split_modes[i], tmp2);
gpr_free(tmp1);

@ -1,5 +1,5 @@
#!/usr/bin/env python2.7
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

@ -44,7 +44,7 @@
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
#include "src/core/httpcli/httpcli.h"
#include "src/core/http/httpcli.h"
#include "src/core/security/json_token.h"
#include "src/core/support/env.h"
#include "src/core/support/tmpfile.h"
@ -536,12 +536,12 @@ static void validate_compute_engine_http_request(
GPR_ASSERT(request->handshaker != &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "metadata") == 0);
GPR_ASSERT(
strcmp(request->path,
strcmp(request->http.path,
"/computeMetadata/v1/instance/service-accounts/default/token") ==
0);
GPR_ASSERT(request->hdr_count == 1);
GPR_ASSERT(strcmp(request->hdrs[0].key, "Metadata-Flavor") == 0);
GPR_ASSERT(strcmp(request->hdrs[0].value, "Google") == 0);
GPR_ASSERT(request->http.hdr_count == 1);
GPR_ASSERT(strcmp(request->http.hdrs[0].key, "Metadata-Flavor") == 0);
GPR_ASSERT(strcmp(request->http.hdrs[0].value, "Google") == 0);
}
static int compute_engine_httpcli_get_success_override(
@ -639,11 +639,12 @@ static void validate_refresh_token_http_request(
gpr_free(expected_body);
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, GRPC_GOOGLE_OAUTH2_SERVICE_HOST) == 0);
GPR_ASSERT(strcmp(request->path, GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH) == 0);
GPR_ASSERT(request->hdr_count == 1);
GPR_ASSERT(strcmp(request->hdrs[0].key, "Content-Type") == 0);
GPR_ASSERT(
strcmp(request->hdrs[0].value, "application/x-www-form-urlencoded") == 0);
strcmp(request->http.path, GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH) == 0);
GPR_ASSERT(request->http.hdr_count == 1);
GPR_ASSERT(strcmp(request->http.hdrs[0].key, "Content-Type") == 0);
GPR_ASSERT(strcmp(request->http.hdrs[0].value,
"application/x-www-form-urlencoded") == 0);
}
static int refresh_token_httpcli_post_success(
@ -898,12 +899,12 @@ static int default_creds_gce_detection_httpcli_get_success_override(
gpr_timespec deadline, grpc_httpcli_response_cb on_response,
void *user_data) {
grpc_httpcli_response response = http_response(200, "");
grpc_httpcli_header header;
grpc_http_header header;
header.key = "Metadata-Flavor";
header.value = "Google";
response.hdr_count = 1;
response.hdrs = &header;
GPR_ASSERT(strcmp(request->path, "/") == 0);
GPR_ASSERT(strcmp(request->http.path, "/") == 0);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0);
on_response(exec_ctx, user_data, &response);
return 1;
@ -961,7 +962,7 @@ static int default_creds_gce_detection_httpcli_get_failure_override(
void *user_data) {
/* No magic header. */
grpc_httpcli_response response = http_response(200, "");
GPR_ASSERT(strcmp(request->path, "/") == 0);
GPR_ASSERT(strcmp(request->http.path, "/") == 0);
GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0);
on_response(exec_ctx, user_data, &response);
return 1;

@ -35,7 +35,7 @@
#include <string.h>
#include "src/core/httpcli/httpcli.h"
#include "src/core/http/httpcli.h"
#include "src/core/security/b64.h"
#include "src/core/security/json_token.h"
#include "test/core/util/test_config.h"
@ -288,7 +288,7 @@ static int httpcli_get_google_keys_for_email(
grpc_httpcli_response response = http_response(200, good_google_email_keys());
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "www.googleapis.com") == 0);
GPR_ASSERT(strcmp(request->path,
GPR_ASSERT(strcmp(request->http.path,
"/robot/v1/metadata/x509/"
"777-abaslkan11hlb6nmim3bpspl31ud@developer."
"gserviceaccount.com") == 0);
@ -336,7 +336,7 @@ static int httpcli_get_custom_keys_for_email(
grpc_httpcli_response response = http_response(200, gpr_strdup(good_jwk_set));
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "keys.bar.com") == 0);
GPR_ASSERT(strcmp(request->path, "/jwk/foo@bar.com") == 0);
GPR_ASSERT(strcmp(request->http.path, "/jwk/foo@bar.com") == 0);
on_response(exec_ctx, user_data, &response);
gpr_free(response.body);
return 1;
@ -372,7 +372,7 @@ static int httpcli_get_jwk_set(grpc_exec_ctx *exec_ctx,
grpc_httpcli_response response = http_response(200, gpr_strdup(good_jwk_set));
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "www.googleapis.com") == 0);
GPR_ASSERT(strcmp(request->path, "/oauth2/v3/certs") == 0);
GPR_ASSERT(strcmp(request->http.path, "/oauth2/v3/certs") == 0);
on_response(exec_ctx, user_data, &response);
gpr_free(response.body);
return 1;
@ -387,7 +387,7 @@ static int httpcli_get_openid_config(grpc_exec_ctx *exec_ctx,
http_response(200, gpr_strdup(good_openid_config));
GPR_ASSERT(request->handshaker == &grpc_httpcli_ssl);
GPR_ASSERT(strcmp(request->host, "accounts.google.com") == 0);
GPR_ASSERT(strcmp(request->path, GRPC_OPENID_CONFIG_URL_SUFFIX) == 0);
GPR_ASSERT(strcmp(request->http.path, GRPC_OPENID_CONFIG_URL_SUFFIX) == 0);
grpc_httpcli_set_override(httpcli_get_jwk_set,
httpcli_post_should_not_be_called);
on_response(exec_ctx, user_data, &response);

@ -49,6 +49,7 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/http/httpcli.h"
#include "src/core/support/env.h"
#include "test/core/util/port_server_client.h"

@ -47,7 +47,7 @@
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include "src/core/httpcli/httpcli.h"
#include "src/core/http/httpcli.h"
typedef struct freereq {
gpr_mu *mu;
@ -91,7 +91,7 @@ void grpc_free_port_using_server(char *server, int port) {
req.host = server;
gpr_asprintf(&path, "/drop/%d", port);
req.path = path;
req.http.path = path;
grpc_httpcli_context_init(&context);
grpc_httpcli_get(&exec_ctx, &context, pr.pollset, &req,
@ -150,7 +150,7 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
GPR_TIMESPAN)));
pr->retries++;
req.host = pr->server;
req.path = "/get";
req.http.path = "/get";
grpc_httpcli_get(exec_ctx, pr->ctx, pr->pollset, &req,
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), got_port_from_server,
pr);
@ -189,7 +189,7 @@ int grpc_pick_port_using_server(char *server) {
pr.ctx = &context;
req.host = server;
req.path = "/get";
req.http.path = "/get";
grpc_httpcli_context_init(&context);
grpc_httpcli_get(&exec_ctx, &context, pr.pollset, &req,

@ -47,6 +47,7 @@
#include <grpc/support/log.h>
#include "src/core/support/env.h"
#include "src/core/http/httpcli.h"
#include "src/core/iomgr/sockaddr_utils.h"
#include "test/core/util/port_server_client.h"

@ -806,9 +806,9 @@ src/core/client_config/uri_parser.h \
src/core/compression/algorithm_metadata.h \
src/core/compression/message_compress.h \
src/core/debug/trace.h \
src/core/httpcli/format_request.h \
src/core/httpcli/httpcli.h \
src/core/httpcli/parser.h \
src/core/http/format_request.h \
src/core/http/httpcli.h \
src/core/http/parser.h \
src/core/iomgr/closure.h \
src/core/iomgr/endpoint.h \
src/core/iomgr/endpoint_pair.h \
@ -947,9 +947,9 @@ src/core/client_config/uri_parser.c \
src/core/compression/compression_algorithm.c \
src/core/compression/message_compress.c \
src/core/debug/trace.c \
src/core/httpcli/format_request.c \
src/core/httpcli/httpcli.c \
src/core/httpcli/parser.c \
src/core/http/format_request.c \
src/core/http/httpcli.c \
src/core/http/parser.c \
src/core/iomgr/closure.c \
src/core/iomgr/endpoint.c \
src/core/iomgr/endpoint_pair_posix.c \
@ -1045,7 +1045,7 @@ src/core/transport/metadata_batch.c \
src/core/transport/static_metadata.c \
src/core/transport/transport.c \
src/core/transport/transport_op_string.c \
src/core/httpcli/httpcli_security_connector.c \
src/core/http/httpcli_security_connector.c \
src/core/security/b64.c \
src/core/security/client_auth_filter.c \
src/core/security/credentials.c \

@ -923,9 +923,9 @@
],
"headers": [],
"language": "c",
"name": "httpcli_format_request_test",
"name": "http_parser_test",
"src": [
"test/core/httpcli/format_request_test.c"
"test/core/http/parser_test.c"
],
"third_party": false,
"type": "target"
@ -939,9 +939,9 @@
],
"headers": [],
"language": "c",
"name": "httpcli_parser_test",
"name": "httpcli_format_request_test",
"src": [
"test/core/httpcli/parser_test.c"
"test/core/http/format_request_test.c"
],
"third_party": false,
"type": "target"
@ -957,7 +957,7 @@
"language": "c",
"name": "httpcli_test",
"src": [
"test/core/httpcli/httpcli_test.c"
"test/core/http/httpcli_test.c"
],
"third_party": false,
"type": "target"
@ -973,7 +973,7 @@
"language": "c",
"name": "httpscli_test",
"src": [
"test/core/httpcli/httpscli_test.c"
"test/core/http/httpscli_test.c"
],
"third_party": false,
"type": "target"
@ -3960,9 +3960,9 @@
"src/core/compression/algorithm_metadata.h",
"src/core/compression/message_compress.h",
"src/core/debug/trace.h",
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.h",
"src/core/http/format_request.h",
"src/core/http/httpcli.h",
"src/core/http/parser.h",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.h",
"src/core/iomgr/endpoint_pair.h",
@ -4157,13 +4157,13 @@
"src/core/compression/message_compress.h",
"src/core/debug/trace.c",
"src/core/debug/trace.h",
"src/core/httpcli/format_request.c",
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.c",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/httpcli_security_connector.c",
"src/core/httpcli/parser.c",
"src/core/httpcli/parser.h",
"src/core/http/format_request.c",
"src/core/http/format_request.h",
"src/core/http/httpcli.c",
"src/core/http/httpcli.h",
"src/core/http/httpcli_security_connector.c",
"src/core/http/parser.c",
"src/core/http/parser.h",
"src/core/iomgr/closure.c",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.c",
@ -4584,9 +4584,9 @@
"src/core/compression/algorithm_metadata.h",
"src/core/compression/message_compress.h",
"src/core/debug/trace.h",
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.h",
"src/core/http/format_request.h",
"src/core/http/httpcli.h",
"src/core/http/parser.h",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.h",
"src/core/iomgr/endpoint_pair.h",
@ -4766,12 +4766,12 @@
"src/core/compression/message_compress.h",
"src/core/debug/trace.c",
"src/core/debug/trace.h",
"src/core/httpcli/format_request.c",
"src/core/httpcli/format_request.h",
"src/core/httpcli/httpcli.c",
"src/core/httpcli/httpcli.h",
"src/core/httpcli/parser.c",
"src/core/httpcli/parser.h",
"src/core/http/format_request.c",
"src/core/http/format_request.h",
"src/core/http/httpcli.c",
"src/core/http/httpcli.h",
"src/core/http/parser.c",
"src/core/http/parser.h",
"src/core/iomgr/closure.c",
"src/core/iomgr/closure.h",
"src/core/iomgr/endpoint.c",

@ -1094,7 +1094,7 @@
"flaky": false,
"gtest": false,
"language": "c",
"name": "httpcli_format_request_test",
"name": "http_parser_test",
"platforms": [
"linux",
"mac",
@ -1115,7 +1115,7 @@
"flaky": false,
"gtest": false,
"language": "c",
"name": "httpcli_parser_test",
"name": "httpcli_format_request_test",
"platforms": [
"linux",
"mac",

@ -663,7 +663,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hpack_table_test", "vcxproj
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "httpcli_format_request_test", "vcxproj\test\httpcli_format_request_test\httpcli_format_request_test.vcxproj", "{A43C3292-CAE7-1B8C-A5FD-52D9E3DCFD82}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "http_parser_test", "vcxproj\test\http_parser_test\http_parser_test.vcxproj", "{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}"
ProjectSection(myProperties) = preProject
lib = "False"
EndProjectSection
@ -674,7 +674,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "httpcli_format_request_test
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "httpcli_parser_test", "vcxproj\test\httpcli_parser_test\httpcli_parser_test.vcxproj", "{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "httpcli_format_request_test", "vcxproj\test\httpcli_format_request_test\httpcli_format_request_test.vcxproj", "{A43C3292-CAE7-1B8C-A5FD-52D9E3DCFD82}"
ProjectSection(myProperties) = preProject
lib = "False"
EndProjectSection
@ -2405,6 +2405,22 @@ Global
{FF2CEE6D-850F-E22C-53A0-8C5912B14B20}.Release-DLL|Win32.Build.0 = Release|Win32
{FF2CEE6D-850F-E22C-53A0-8C5912B14B20}.Release-DLL|x64.ActiveCfg = Release|x64
{FF2CEE6D-850F-E22C-53A0-8C5912B14B20}.Release-DLL|x64.Build.0 = Release|x64
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Debug|Win32.ActiveCfg = Debug|Win32
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Debug|x64.ActiveCfg = Debug|x64
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Release|Win32.ActiveCfg = Release|Win32
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Release|x64.ActiveCfg = Release|x64
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Debug|Win32.Build.0 = Debug|Win32
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Debug|x64.Build.0 = Debug|x64
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Release|Win32.Build.0 = Release|Win32
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Release|x64.Build.0 = Release|x64
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Debug-DLL|Win32.Build.0 = Debug|Win32
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Debug-DLL|x64.ActiveCfg = Debug|x64
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Debug-DLL|x64.Build.0 = Debug|x64
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Release-DLL|Win32.ActiveCfg = Release|Win32
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Release-DLL|Win32.Build.0 = Release|Win32
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Release-DLL|x64.ActiveCfg = Release|x64
{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}.Release-DLL|x64.Build.0 = Release|x64
{A43C3292-CAE7-1B8C-A5FD-52D9E3DCFD82}.Debug|Win32.ActiveCfg = Debug|Win32
{A43C3292-CAE7-1B8C-A5FD-52D9E3DCFD82}.Debug|x64.ActiveCfg = Debug|x64
{A43C3292-CAE7-1B8C-A5FD-52D9E3DCFD82}.Release|Win32.ActiveCfg = Release|Win32
@ -2421,22 +2437,6 @@ Global
{A43C3292-CAE7-1B8C-A5FD-52D9E3DCFD82}.Release-DLL|Win32.Build.0 = Release|Win32
{A43C3292-CAE7-1B8C-A5FD-52D9E3DCFD82}.Release-DLL|x64.ActiveCfg = Release|x64
{A43C3292-CAE7-1B8C-A5FD-52D9E3DCFD82}.Release-DLL|x64.Build.0 = Release|x64
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Debug|Win32.ActiveCfg = Debug|Win32
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Debug|x64.ActiveCfg = Debug|x64
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Release|Win32.ActiveCfg = Release|Win32
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Release|x64.ActiveCfg = Release|x64
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Debug|Win32.Build.0 = Debug|Win32
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Debug|x64.Build.0 = Debug|x64
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Release|Win32.Build.0 = Release|Win32
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Release|x64.Build.0 = Release|x64
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Debug-DLL|Win32.Build.0 = Debug|Win32
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Debug-DLL|x64.ActiveCfg = Debug|x64
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Debug-DLL|x64.Build.0 = Debug|x64
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Release-DLL|Win32.ActiveCfg = Release|Win32
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Release-DLL|Win32.Build.0 = Release|Win32
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Release-DLL|x64.ActiveCfg = Release|x64
{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}.Release-DLL|x64.Build.0 = Release|x64
{117CA7AD-C42B-9217-6C95-42A801777BC5}.Debug|Win32.ActiveCfg = Debug|Win32
{117CA7AD-C42B-9217-6C95-42A801777BC5}.Debug|x64.ActiveCfg = Debug|x64
{117CA7AD-C42B-9217-6C95-42A801777BC5}.Release|Win32.ActiveCfg = Release|Win32

@ -315,9 +315,9 @@
<ClInclude Include="$(SolutionDir)\..\src\core\compression\algorithm_metadata.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\compression\message_compress.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\debug\trace.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\httpcli\format_request.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\httpcli\httpcli.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\httpcli\parser.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\http\format_request.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\http\httpcli.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\http\parser.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\closure.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\endpoint.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\endpoint_pair.h" />
@ -492,11 +492,11 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\debug\trace.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\format_request.c">
<ClCompile Include="$(SolutionDir)\..\src\core\http\format_request.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\httpcli.c">
<ClCompile Include="$(SolutionDir)\..\src\core\http\httpcli.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\parser.c">
<ClCompile Include="$(SolutionDir)\..\src\core\http\parser.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\iomgr\closure.c">
</ClCompile>
@ -688,7 +688,7 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\transport\transport_op_string.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\httpcli_security_connector.c">
<ClCompile Include="$(SolutionDir)\..\src\core\http\httpcli_security_connector.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\security\b64.c">
</ClCompile>

@ -103,14 +103,14 @@
<ClCompile Include="$(SolutionDir)\..\src\core\debug\trace.c">
<Filter>src\core\debug</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\format_request.c">
<Filter>src\core\httpcli</Filter>
<ClCompile Include="$(SolutionDir)\..\src\core\http\format_request.c">
<Filter>src\core\http</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\httpcli.c">
<Filter>src\core\httpcli</Filter>
<ClCompile Include="$(SolutionDir)\..\src\core\http\httpcli.c">
<Filter>src\core\http</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\parser.c">
<Filter>src\core\httpcli</Filter>
<ClCompile Include="$(SolutionDir)\..\src\core\http\parser.c">
<Filter>src\core\http</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\iomgr\closure.c">
<Filter>src\core\iomgr</Filter>
@ -397,8 +397,8 @@
<ClCompile Include="$(SolutionDir)\..\src\core\transport\transport_op_string.c">
<Filter>src\core\transport</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\httpcli_security_connector.c">
<Filter>src\core\httpcli</Filter>
<ClCompile Include="$(SolutionDir)\..\src\core\http\httpcli_security_connector.c">
<Filter>src\core\http</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\security\b64.c">
<Filter>src\core\security</Filter>
@ -629,14 +629,14 @@
<ClInclude Include="$(SolutionDir)\..\src\core\debug\trace.h">
<Filter>src\core\debug</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\httpcli\format_request.h">
<Filter>src\core\httpcli</Filter>
<ClInclude Include="$(SolutionDir)\..\src\core\http\format_request.h">
<Filter>src\core\http</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\httpcli\httpcli.h">
<Filter>src\core\httpcli</Filter>
<ClInclude Include="$(SolutionDir)\..\src\core\http\httpcli.h">
<Filter>src\core\http</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\httpcli\parser.h">
<Filter>src\core\httpcli</Filter>
<ClInclude Include="$(SolutionDir)\..\src\core\http\parser.h">
<Filter>src\core\http</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\closure.h">
<Filter>src\core\iomgr</Filter>
@ -992,8 +992,8 @@
<Filter Include="src\core\debug">
<UniqueIdentifier>{1da7ef8a-a06d-5499-b3de-19fee4a4214d}</UniqueIdentifier>
</Filter>
<Filter Include="src\core\httpcli">
<UniqueIdentifier>{a9bc00ad-835f-c625-c6d9-6a1324f98b9f}</UniqueIdentifier>
<Filter Include="src\core\http">
<UniqueIdentifier>{404fdb9e-a69c-81d4-035b-465c826115a9}</UniqueIdentifier>
</Filter>
<Filter Include="src\core\iomgr">
<UniqueIdentifier>{1baf3894-af37-e647-bdbc-95dc17ed0073}</UniqueIdentifier>

@ -305,9 +305,9 @@
<ClInclude Include="$(SolutionDir)\..\src\core\compression\algorithm_metadata.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\compression\message_compress.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\debug\trace.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\httpcli\format_request.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\httpcli\httpcli.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\httpcli\parser.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\http\format_request.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\http\httpcli.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\http\parser.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\closure.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\endpoint.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\endpoint_pair.h" />
@ -470,11 +470,11 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\debug\trace.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\format_request.c">
<ClCompile Include="$(SolutionDir)\..\src\core\http\format_request.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\httpcli.c">
<ClCompile Include="$(SolutionDir)\..\src\core\http\httpcli.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\parser.c">
<ClCompile Include="$(SolutionDir)\..\src\core\http\parser.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\iomgr\closure.c">
</ClCompile>

@ -106,14 +106,14 @@
<ClCompile Include="$(SolutionDir)\..\src\core\debug\trace.c">
<Filter>src\core\debug</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\format_request.c">
<Filter>src\core\httpcli</Filter>
<ClCompile Include="$(SolutionDir)\..\src\core\http\format_request.c">
<Filter>src\core\http</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\httpcli.c">
<Filter>src\core\httpcli</Filter>
<ClCompile Include="$(SolutionDir)\..\src\core\http\httpcli.c">
<Filter>src\core\http</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\parser.c">
<Filter>src\core\httpcli</Filter>
<ClCompile Include="$(SolutionDir)\..\src\core\http\parser.c">
<Filter>src\core\http</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\iomgr\closure.c">
<Filter>src\core\iomgr</Filter>
@ -566,14 +566,14 @@
<ClInclude Include="$(SolutionDir)\..\src\core\debug\trace.h">
<Filter>src\core\debug</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\httpcli\format_request.h">
<Filter>src\core\httpcli</Filter>
<ClInclude Include="$(SolutionDir)\..\src\core\http\format_request.h">
<Filter>src\core\http</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\httpcli\httpcli.h">
<Filter>src\core\httpcli</Filter>
<ClInclude Include="$(SolutionDir)\..\src\core\http\httpcli.h">
<Filter>src\core\http</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\httpcli\parser.h">
<Filter>src\core\httpcli</Filter>
<ClInclude Include="$(SolutionDir)\..\src\core\http\parser.h">
<Filter>src\core\http</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\closure.h">
<Filter>src\core\iomgr</Filter>
@ -887,8 +887,8 @@
<Filter Include="src\core\debug">
<UniqueIdentifier>{6d8d5774-7291-554d-fafa-583463cd3fd9}</UniqueIdentifier>
</Filter>
<Filter Include="src\core\httpcli">
<UniqueIdentifier>{1ba3a245-47e7-89b5-b0c9-aca758bd0277}</UniqueIdentifier>
<Filter Include="src\core\http">
<UniqueIdentifier>{46faed8e-5cd4-98b0-05ed-ff2ac7bc2d46}</UniqueIdentifier>
</Filter>
<Filter Include="src\core\iomgr">
<UniqueIdentifier>{a9df8b24-ecea-ff6d-8999-d8fa54cd70bf}</UniqueIdentifier>

@ -20,7 +20,7 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B6F60D1C-D4F3-0F1A-4A2F-9134629B7848}</ProjectGuid>
<ProjectGuid>{49D7E690-BDA1-5236-1ABF-3D81C1559DF7}</ProjectGuid>
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected>
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir>
</PropertyGroup>
@ -60,14 +60,14 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<TargetName>httpcli_parser_test</TargetName>
<TargetName>http_parser_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<TargetName>httpcli_parser_test</TargetName>
<TargetName>http_parser_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib>
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
@ -158,7 +158,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="$(SolutionDir)\..\test\core\httpcli\parser_test.c">
<ClCompile Include="$(SolutionDir)\..\test\core\http\parser_test.c">
</ClCompile>
</ItemGroup>
<ItemGroup>

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="$(SolutionDir)\..\test\core\httpcli\parser_test.c">
<Filter>test\core\httpcli</Filter>
<ClCompile Include="$(SolutionDir)\..\test\core\http\parser_test.c">
<Filter>test\core\http</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="test">
<UniqueIdentifier>{f3562e8b-3020-c79a-4e3b-c895f9e49f44}</UniqueIdentifier>
<UniqueIdentifier>{1d07f09d-a0ec-d684-3589-bff02afbe830}</UniqueIdentifier>
</Filter>
<Filter Include="test\core">
<UniqueIdentifier>{db527686-b5c7-68df-a106-bd919f60742a}</UniqueIdentifier>
<UniqueIdentifier>{eedab59d-9f19-9172-cf0e-83a839217afc}</UniqueIdentifier>
</Filter>
<Filter Include="test\core\httpcli">
<UniqueIdentifier>{8e60d460-93de-c6e1-b67b-bfae71bd9bca}</UniqueIdentifier>
<Filter Include="test\core\http">
<UniqueIdentifier>{1fcac48f-3718-00ea-6c0c-aafa1a4de528}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

@ -158,7 +158,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="$(SolutionDir)\..\test\core\httpcli\format_request_test.c">
<ClCompile Include="$(SolutionDir)\..\test\core\http\format_request_test.c">
</ClCompile>
</ItemGroup>
<ItemGroup>

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="$(SolutionDir)\..\test\core\httpcli\format_request_test.c">
<Filter>test\core\httpcli</Filter>
<ClCompile Include="$(SolutionDir)\..\test\core\http\format_request_test.c">
<Filter>test\core\http</Filter>
</ClCompile>
</ItemGroup>
@ -13,8 +13,8 @@
<Filter Include="test\core">
<UniqueIdentifier>{f033cf49-b830-5698-3989-6ec75817333b}</UniqueIdentifier>
</Filter>
<Filter Include="test\core\httpcli">
<UniqueIdentifier>{75330e6a-521e-5f90-defd-652a4591dbe9}</UniqueIdentifier>
<Filter Include="test\core\http">
<UniqueIdentifier>{51615bc9-b61d-8d7d-9abb-5409276c04ec}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

Loading…
Cancel
Save