uri.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. /**
  2. * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3. * SPDX-License-Identifier: Apache-2.0.
  4. */
  5. #include <aws/common/uri.h>
  6. #include <aws/common/common.h>
  7. #include <ctype.h>
  8. #include <inttypes.h>
  9. #include <stdio.h>
  10. #include <string.h>
  11. #ifdef _MSC_VER
  12. # pragma warning(disable : 4221) /* aggregate initializer using local variable addresses */
  13. # pragma warning(disable : 4204) /* non-constant aggregate initializer */
  14. #endif
  15. enum parser_state {
  16. ON_SCHEME,
  17. ON_AUTHORITY,
  18. ON_PATH,
  19. ON_QUERY_STRING,
  20. FINISHED,
  21. ERROR,
  22. };
  23. struct uri_parser {
  24. struct aws_uri *uri;
  25. enum parser_state state;
  26. };
  27. typedef void(parse_fn)(struct uri_parser *parser, struct aws_byte_cursor *str);
  28. static void s_parse_scheme(struct uri_parser *parser, struct aws_byte_cursor *str);
  29. static void s_parse_authority(struct uri_parser *parser, struct aws_byte_cursor *str);
  30. static void s_parse_path(struct uri_parser *parser, struct aws_byte_cursor *str);
  31. static void s_parse_query_string(struct uri_parser *parser, struct aws_byte_cursor *str);
  32. static parse_fn *s_states[] = {
  33. [ON_SCHEME] = s_parse_scheme,
  34. [ON_AUTHORITY] = s_parse_authority,
  35. [ON_PATH] = s_parse_path,
  36. [ON_QUERY_STRING] = s_parse_query_string,
  37. };
  38. static int s_init_from_uri_str(struct aws_uri *uri) {
  39. struct uri_parser parser = {
  40. .state = ON_SCHEME,
  41. .uri = uri,
  42. };
  43. struct aws_byte_cursor uri_cur = aws_byte_cursor_from_buf(&uri->uri_str);
  44. while (parser.state < FINISHED) {
  45. s_states[parser.state](&parser, &uri_cur);
  46. }
  47. /* Each state function sets the next state, if something goes wrong it sets it to ERROR which is > FINISHED */
  48. if (parser.state == FINISHED) {
  49. return AWS_OP_SUCCESS;
  50. }
  51. aws_byte_buf_clean_up(&uri->uri_str);
  52. AWS_ZERO_STRUCT(*uri);
  53. return AWS_OP_ERR;
  54. }
  55. int aws_uri_init_parse(struct aws_uri *uri, struct aws_allocator *allocator, const struct aws_byte_cursor *uri_str) {
  56. AWS_ZERO_STRUCT(*uri);
  57. uri->self_size = sizeof(struct aws_uri);
  58. uri->allocator = allocator;
  59. if (aws_byte_buf_init_copy_from_cursor(&uri->uri_str, allocator, *uri_str)) {
  60. return AWS_OP_ERR;
  61. }
  62. return s_init_from_uri_str(uri);
  63. }
  64. int aws_uri_init_from_builder_options(
  65. struct aws_uri *uri,
  66. struct aws_allocator *allocator,
  67. struct aws_uri_builder_options *options) {
  68. AWS_ZERO_STRUCT(*uri);
  69. if (options->query_string.len && options->query_params) {
  70. return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
  71. }
  72. uri->self_size = sizeof(struct aws_uri);
  73. uri->allocator = allocator;
  74. size_t buffer_size = 0;
  75. if (options->scheme.len) {
  76. /* 3 for :// */
  77. buffer_size += options->scheme.len + 3;
  78. }
  79. buffer_size += options->host_name.len;
  80. if (options->port) {
  81. /* max strlen of a 16 bit integer is 5 */
  82. buffer_size += 6;
  83. }
  84. buffer_size += options->path.len;
  85. if (options->query_params) {
  86. size_t query_len = aws_array_list_length(options->query_params);
  87. if (query_len) {
  88. /* for the '?' */
  89. buffer_size += 1;
  90. for (size_t i = 0; i < query_len; ++i) {
  91. struct aws_uri_param *uri_param_ptr = NULL;
  92. int result = aws_array_list_get_at_ptr(options->query_params, (void **)&uri_param_ptr, i);
  93. AWS_FATAL_ASSERT(result == AWS_OP_SUCCESS);
  94. /* 2 == 1 for '&' and 1 for '='. who cares if we over-allocate a little? */
  95. buffer_size += uri_param_ptr->key.len + uri_param_ptr->value.len + 2;
  96. }
  97. }
  98. } else if (options->query_string.len) {
  99. /* for the '?' */
  100. buffer_size += 1;
  101. buffer_size += options->query_string.len;
  102. }
  103. if (aws_byte_buf_init(&uri->uri_str, allocator, buffer_size)) {
  104. return AWS_OP_ERR;
  105. }
  106. uri->uri_str.len = 0;
  107. if (options->scheme.len) {
  108. aws_byte_buf_append(&uri->uri_str, &options->scheme);
  109. struct aws_byte_cursor scheme_app = aws_byte_cursor_from_c_str("://");
  110. aws_byte_buf_append(&uri->uri_str, &scheme_app);
  111. }
  112. aws_byte_buf_append(&uri->uri_str, &options->host_name);
  113. struct aws_byte_cursor port_app = aws_byte_cursor_from_c_str(":");
  114. if (options->port) {
  115. aws_byte_buf_append(&uri->uri_str, &port_app);
  116. char port_arr[6] = {0};
  117. snprintf(port_arr, sizeof(port_arr), "%" PRIu16, options->port);
  118. struct aws_byte_cursor port_csr = aws_byte_cursor_from_c_str(port_arr);
  119. aws_byte_buf_append(&uri->uri_str, &port_csr);
  120. }
  121. aws_byte_buf_append(&uri->uri_str, &options->path);
  122. struct aws_byte_cursor query_app = aws_byte_cursor_from_c_str("?");
  123. if (options->query_params) {
  124. struct aws_byte_cursor query_param_app = aws_byte_cursor_from_c_str("&");
  125. struct aws_byte_cursor key_value_delim = aws_byte_cursor_from_c_str("=");
  126. aws_byte_buf_append(&uri->uri_str, &query_app);
  127. size_t query_len = aws_array_list_length(options->query_params);
  128. for (size_t i = 0; i < query_len; ++i) {
  129. struct aws_uri_param *uri_param_ptr = NULL;
  130. aws_array_list_get_at_ptr(options->query_params, (void **)&uri_param_ptr, i);
  131. aws_byte_buf_append(&uri->uri_str, &uri_param_ptr->key);
  132. aws_byte_buf_append(&uri->uri_str, &key_value_delim);
  133. aws_byte_buf_append(&uri->uri_str, &uri_param_ptr->value);
  134. if (i < query_len - 1) {
  135. aws_byte_buf_append(&uri->uri_str, &query_param_app);
  136. }
  137. }
  138. } else if (options->query_string.len) {
  139. aws_byte_buf_append(&uri->uri_str, &query_app);
  140. aws_byte_buf_append(&uri->uri_str, &options->query_string);
  141. }
  142. return s_init_from_uri_str(uri);
  143. }
  144. void aws_uri_clean_up(struct aws_uri *uri) {
  145. if (uri->uri_str.allocator) {
  146. aws_byte_buf_clean_up(&uri->uri_str);
  147. }
  148. AWS_ZERO_STRUCT(*uri);
  149. }
  150. const struct aws_byte_cursor *aws_uri_scheme(const struct aws_uri *uri) {
  151. return &uri->scheme;
  152. }
  153. const struct aws_byte_cursor *aws_uri_authority(const struct aws_uri *uri) {
  154. return &uri->authority;
  155. }
  156. const struct aws_byte_cursor *aws_uri_path(const struct aws_uri *uri) {
  157. return &uri->path;
  158. }
  159. const struct aws_byte_cursor *aws_uri_query_string(const struct aws_uri *uri) {
  160. return &uri->query_string;
  161. }
  162. const struct aws_byte_cursor *aws_uri_path_and_query(const struct aws_uri *uri) {
  163. return &uri->path_and_query;
  164. }
  165. const struct aws_byte_cursor *aws_uri_host_name(const struct aws_uri *uri) {
  166. return &uri->host_name;
  167. }
  168. uint16_t aws_uri_port(const struct aws_uri *uri) {
  169. return uri->port;
  170. }
  171. bool aws_uri_query_string_next_param(const struct aws_uri *uri, struct aws_uri_param *param) {
  172. /* If param is zeroed, then this is the first run. */
  173. bool first_run = param->value.ptr == NULL;
  174. /* aws_byte_cursor_next_split() is used to iterate over params in the query string.
  175. * It takes an in/out substring arg similar to how this function works */
  176. struct aws_byte_cursor substr;
  177. if (first_run) {
  178. /* substring must be zeroed to start */
  179. AWS_ZERO_STRUCT(substr);
  180. } else {
  181. /* re-assemble substring which contained key and value */
  182. substr.ptr = param->key.ptr;
  183. substr.len = (param->value.ptr - param->key.ptr) + param->value.len;
  184. }
  185. /* The do-while is to skip over any empty substrings */
  186. do {
  187. if (!aws_byte_cursor_next_split(&uri->query_string, '&', &substr)) {
  188. /* no more splits, done iterating */
  189. return false;
  190. }
  191. } while (substr.len == 0);
  192. uint8_t *delim = memchr(substr.ptr, '=', substr.len);
  193. if (delim) {
  194. param->key.ptr = substr.ptr;
  195. param->key.len = delim - substr.ptr;
  196. param->value.ptr = delim + 1;
  197. param->value.len = substr.len - param->key.len - 1;
  198. } else {
  199. /* no '=', key gets substring, value is blank */
  200. param->key = substr;
  201. param->value.ptr = substr.ptr + substr.len;
  202. param->value.len = 0;
  203. }
  204. return true;
  205. }
  206. int aws_uri_query_string_params(const struct aws_uri *uri, struct aws_array_list *out_params) {
  207. struct aws_uri_param param;
  208. AWS_ZERO_STRUCT(param);
  209. while (aws_uri_query_string_next_param(uri, &param)) {
  210. if (aws_array_list_push_back(out_params, &param)) {
  211. return AWS_OP_ERR;
  212. }
  213. }
  214. return AWS_OP_SUCCESS;
  215. }
  216. static void s_parse_scheme(struct uri_parser *parser, struct aws_byte_cursor *str) {
  217. const uint8_t *location_of_colon = memchr(str->ptr, ':', str->len);
  218. if (!location_of_colon) {
  219. parser->state = ON_AUTHORITY;
  220. return;
  221. }
  222. /* make sure we didn't just pick up the port by mistake */
  223. if ((size_t)(location_of_colon - str->ptr) < str->len && *(location_of_colon + 1) != '/') {
  224. parser->state = ON_AUTHORITY;
  225. return;
  226. }
  227. const size_t scheme_len = location_of_colon - str->ptr;
  228. parser->uri->scheme = aws_byte_cursor_advance(str, scheme_len);
  229. if (str->len < 3 || str->ptr[0] != ':' || str->ptr[1] != '/' || str->ptr[2] != '/') {
  230. aws_raise_error(AWS_ERROR_MALFORMED_INPUT_STRING);
  231. parser->state = ERROR;
  232. return;
  233. }
  234. /* advance past the "://" */
  235. aws_byte_cursor_advance(str, 3);
  236. parser->state = ON_AUTHORITY;
  237. }
  238. static void s_parse_authority(struct uri_parser *parser, struct aws_byte_cursor *str) {
  239. const uint8_t *location_of_slash = memchr(str->ptr, '/', str->len);
  240. const uint8_t *location_of_qmark = memchr(str->ptr, '?', str->len);
  241. if (!location_of_slash && !location_of_qmark && str->len) {
  242. parser->uri->authority.ptr = str->ptr;
  243. parser->uri->authority.len = str->len;
  244. parser->uri->path.ptr = NULL;
  245. parser->uri->path.len = 0;
  246. parser->uri->path_and_query = parser->uri->path;
  247. parser->state = FINISHED;
  248. aws_byte_cursor_advance(str, parser->uri->authority.len);
  249. } else if (!str->len) {
  250. parser->state = ERROR;
  251. aws_raise_error(AWS_ERROR_MALFORMED_INPUT_STRING);
  252. return;
  253. } else {
  254. const uint8_t *end = str->ptr + str->len;
  255. if (location_of_slash) {
  256. parser->state = ON_PATH;
  257. end = location_of_slash;
  258. } else if (location_of_qmark) {
  259. parser->state = ON_QUERY_STRING;
  260. end = location_of_qmark;
  261. }
  262. parser->uri->authority = aws_byte_cursor_advance(str, end - str->ptr);
  263. }
  264. struct aws_byte_cursor authority_parse_csr = parser->uri->authority;
  265. if (authority_parse_csr.len) {
  266. /* RFC-3986 section 3.2: authority = [ userinfo "@" ] host [ ":" port ] */
  267. const uint8_t *userinfo_delim = memchr(authority_parse_csr.ptr, '@', authority_parse_csr.len);
  268. if (userinfo_delim) {
  269. parser->uri->userinfo =
  270. aws_byte_cursor_advance(&authority_parse_csr, userinfo_delim - authority_parse_csr.ptr);
  271. /* For the "@" mark */
  272. aws_byte_cursor_advance(&authority_parse_csr, 1);
  273. struct aws_byte_cursor userinfo_parse_csr = parser->uri->userinfo;
  274. uint8_t *info_delim = memchr(userinfo_parse_csr.ptr, ':', userinfo_parse_csr.len);
  275. /* RFC-3986 section 3.2.1: Use of the format "user:password" in the userinfo field is deprecated. But we
  276. * treat the userinfo as URL here, also, if the format is not following URL pattern, you have the whole
  277. * userinfo */
  278. /* RFC-1738 section 3.1: <user>:<password> */
  279. if (info_delim) {
  280. parser->uri->user.ptr = userinfo_parse_csr.ptr;
  281. parser->uri->user.len = info_delim - userinfo_parse_csr.ptr;
  282. parser->uri->password.ptr = info_delim + 1;
  283. parser->uri->password.len = parser->uri->userinfo.len - parser->uri->user.len - 1;
  284. } else {
  285. parser->uri->user = userinfo_parse_csr;
  286. }
  287. }
  288. /* RFC-3986 section 3.2: host identified by IPv6 literal address is
  289. * enclosed within square brackets. We must ignore any colons within
  290. * IPv6 literals and only search for port delimiter after closing bracket.*/
  291. const uint8_t *port_search_start = authority_parse_csr.ptr;
  292. size_t port_search_len = authority_parse_csr.len;
  293. if (authority_parse_csr.len > 0 && authority_parse_csr.ptr[0] == '[') {
  294. port_search_start = memchr(authority_parse_csr.ptr, ']', authority_parse_csr.len);
  295. if (!port_search_start) {
  296. parser->state = ERROR;
  297. aws_raise_error(AWS_ERROR_MALFORMED_INPUT_STRING);
  298. return;
  299. }
  300. port_search_len = authority_parse_csr.len - (port_search_start - authority_parse_csr.ptr);
  301. }
  302. const uint8_t *port_delim = memchr(port_search_start, ':', port_search_len);
  303. if (!port_delim) {
  304. parser->uri->port = 0;
  305. parser->uri->host_name = authority_parse_csr;
  306. return;
  307. }
  308. parser->uri->host_name.ptr = authority_parse_csr.ptr;
  309. parser->uri->host_name.len = port_delim - authority_parse_csr.ptr;
  310. size_t port_len = authority_parse_csr.len - parser->uri->host_name.len - 1;
  311. port_delim += 1;
  312. for (size_t i = 0; i < port_len; ++i) {
  313. if (!aws_isdigit(port_delim[i])) {
  314. parser->state = ERROR;
  315. aws_raise_error(AWS_ERROR_MALFORMED_INPUT_STRING);
  316. return;
  317. }
  318. }
  319. if (port_len > 5) {
  320. parser->state = ERROR;
  321. aws_raise_error(AWS_ERROR_MALFORMED_INPUT_STRING);
  322. return;
  323. }
  324. /* why 6? because the port is a 16-bit unsigned integer*/
  325. char atoi_buf[6] = {0};
  326. memcpy(atoi_buf, port_delim, port_len);
  327. int port_int = atoi(atoi_buf);
  328. if (port_int > UINT16_MAX) {
  329. parser->state = ERROR;
  330. aws_raise_error(AWS_ERROR_MALFORMED_INPUT_STRING);
  331. return;
  332. }
  333. parser->uri->port = (uint16_t)port_int;
  334. }
  335. }
  336. static void s_parse_path(struct uri_parser *parser, struct aws_byte_cursor *str) {
  337. parser->uri->path_and_query = *str;
  338. const uint8_t *location_of_q_mark = memchr(str->ptr, '?', str->len);
  339. if (!location_of_q_mark) {
  340. parser->uri->path.ptr = str->ptr;
  341. parser->uri->path.len = str->len;
  342. parser->state = FINISHED;
  343. aws_byte_cursor_advance(str, parser->uri->path.len);
  344. return;
  345. }
  346. if (!str->len) {
  347. parser->state = ERROR;
  348. aws_raise_error(AWS_ERROR_MALFORMED_INPUT_STRING);
  349. return;
  350. }
  351. parser->uri->path.ptr = str->ptr;
  352. parser->uri->path.len = location_of_q_mark - str->ptr;
  353. aws_byte_cursor_advance(str, parser->uri->path.len);
  354. parser->state = ON_QUERY_STRING;
  355. }
  356. static void s_parse_query_string(struct uri_parser *parser, struct aws_byte_cursor *str) {
  357. if (!parser->uri->path_and_query.ptr) {
  358. parser->uri->path_and_query = *str;
  359. }
  360. /* we don't want the '?' character. */
  361. if (str->len) {
  362. parser->uri->query_string.ptr = str->ptr + 1;
  363. parser->uri->query_string.len = str->len - 1;
  364. }
  365. aws_byte_cursor_advance(str, parser->uri->query_string.len + 1);
  366. parser->state = FINISHED;
  367. }
  368. static uint8_t s_to_uppercase_hex(uint8_t value) {
  369. AWS_ASSERT(value < 16);
  370. if (value < 10) {
  371. return (uint8_t)('0' + value);
  372. }
  373. return (uint8_t)('A' + value - 10);
  374. }
  375. typedef void(unchecked_append_canonicalized_character_fn)(struct aws_byte_buf *buffer, uint8_t value);
  376. /*
  377. * Appends a character or its hex encoding to the buffer. We reserve enough space up front so that
  378. * we can do this with raw pointers rather than multiple function calls/cursors/etc...
  379. *
  380. * This function is for the uri path
  381. */
  382. static void s_unchecked_append_canonicalized_path_character(struct aws_byte_buf *buffer, uint8_t value) {
  383. AWS_ASSERT(buffer->len + 3 <= buffer->capacity);
  384. uint8_t *dest_ptr = buffer->buffer + buffer->len;
  385. if (aws_isalnum(value)) {
  386. ++buffer->len;
  387. *dest_ptr = value;
  388. return;
  389. }
  390. switch (value) {
  391. /* non-alpha-numeric unreserved, don't % encode them */
  392. case '-':
  393. case '_':
  394. case '.':
  395. case '~':
  396. /* reserved characters that we should not % encode in the path component */
  397. case '/':
  398. ++buffer->len;
  399. *dest_ptr = value;
  400. return;
  401. /*
  402. * everything else we should % encode, including from the reserved list
  403. */
  404. default:
  405. buffer->len += 3;
  406. *dest_ptr++ = '%';
  407. *dest_ptr++ = s_to_uppercase_hex(value >> 4);
  408. *dest_ptr = s_to_uppercase_hex(value & 0x0F);
  409. return;
  410. }
  411. }
  412. /*
  413. * Appends a character or its hex encoding to the buffer. We reserve enough space up front so that
  414. * we can do this with raw pointers rather than multiple function calls/cursors/etc...
  415. *
  416. * This function is for query params
  417. */
  418. static void s_raw_append_canonicalized_param_character(struct aws_byte_buf *buffer, uint8_t value) {
  419. AWS_ASSERT(buffer->len + 3 <= buffer->capacity);
  420. uint8_t *dest_ptr = buffer->buffer + buffer->len;
  421. if (aws_isalnum(value)) {
  422. ++buffer->len;
  423. *dest_ptr = value;
  424. return;
  425. }
  426. switch (value) {
  427. case '-':
  428. case '_':
  429. case '.':
  430. case '~': {
  431. ++buffer->len;
  432. *dest_ptr = value;
  433. return;
  434. }
  435. default:
  436. buffer->len += 3;
  437. *dest_ptr++ = '%';
  438. *dest_ptr++ = s_to_uppercase_hex(value >> 4);
  439. *dest_ptr = s_to_uppercase_hex(value & 0x0F);
  440. return;
  441. }
  442. }
  443. /*
  444. * Writes a cursor to a buffer using the supplied encoding function.
  445. */
  446. static int s_encode_cursor_to_buffer(
  447. struct aws_byte_buf *buffer,
  448. const struct aws_byte_cursor *cursor,
  449. unchecked_append_canonicalized_character_fn *append_canonicalized_character) {
  450. const uint8_t *current_ptr = cursor->ptr;
  451. const uint8_t *end_ptr = cursor->ptr + cursor->len;
  452. /*
  453. * reserve room up front for the worst possible case: everything gets % encoded
  454. */
  455. size_t capacity_needed = 0;
  456. if (AWS_UNLIKELY(aws_mul_size_checked(3, cursor->len, &capacity_needed))) {
  457. return AWS_OP_ERR;
  458. }
  459. if (aws_byte_buf_reserve_relative(buffer, capacity_needed)) {
  460. return AWS_OP_ERR;
  461. }
  462. while (current_ptr < end_ptr) {
  463. append_canonicalized_character(buffer, *current_ptr);
  464. ++current_ptr;
  465. }
  466. return AWS_OP_SUCCESS;
  467. }
  468. int aws_byte_buf_append_encoding_uri_path(struct aws_byte_buf *buffer, const struct aws_byte_cursor *cursor) {
  469. return s_encode_cursor_to_buffer(buffer, cursor, s_unchecked_append_canonicalized_path_character);
  470. }
  471. int aws_byte_buf_append_encoding_uri_param(struct aws_byte_buf *buffer, const struct aws_byte_cursor *cursor) {
  472. return s_encode_cursor_to_buffer(buffer, cursor, s_raw_append_canonicalized_param_character);
  473. }
  474. int aws_byte_buf_append_decoding_uri(struct aws_byte_buf *buffer, const struct aws_byte_cursor *cursor) {
  475. /* reserve room up front for worst possible case: no % and everything copies over 1:1 */
  476. if (aws_byte_buf_reserve_relative(buffer, cursor->len)) {
  477. return AWS_OP_ERR;
  478. }
  479. /* advance over cursor */
  480. struct aws_byte_cursor advancing = *cursor;
  481. uint8_t c;
  482. while (aws_byte_cursor_read_u8(&advancing, &c)) {
  483. if (c == '%') {
  484. /* two hex characters following '%' are the byte's value */
  485. if (AWS_UNLIKELY(aws_byte_cursor_read_hex_u8(&advancing, &c) == false)) {
  486. return aws_raise_error(AWS_ERROR_MALFORMED_INPUT_STRING);
  487. }
  488. }
  489. buffer->buffer[buffer->len++] = c;
  490. }
  491. return AWS_OP_SUCCESS;
  492. }