MCPcopy Create free account
hub / github.com/apache/httpd / ajp_msg_append_string_ex

Function ajp_msg_append_string_ex

modules/proxy/ajp_msg.c:331–359  ·  view source on GitHub ↗

* Add a String in AJP message, and transform the String in ASCII * if convert is set and we're on an EBCDIC machine * * @param msg AJP Message to get value from * @param value Pointer to String * @param convert When set told to convert String to ASCII * @return APR_SUCCESS or error */

Source from the content-addressed store, hash-verified

329 * @return APR_SUCCESS or error
330 */
331apr_status_t ajp_msg_append_string_ex(ajp_msg_t *msg, const char *value,
332 int convert)
333{
334 apr_size_t len;
335
336 if (value == NULL) {
337 return(ajp_msg_append_uint16(msg, 0xFFFF));
338 }
339
340 len = strlen(value);
341 if ((msg->len + len + 3) > msg->max_size) {
342 return ajp_log_overflow(msg, "ajp_msg_append_cvt_string");
343 }
344
345 /* ignore error - we checked once */
346 ajp_msg_append_uint16(msg, (apr_uint16_t)len);
347
348 /* We checked for space !! */
349 memcpy(msg->buf + msg->len, value, len + 1); /* including \0 */
350
351 if (convert) {
352 /* convert from EBCDIC if needed */
353 ap_xlate_proto_to_ascii((char *)msg->buf + msg->len, len + 1);
354 }
355
356 msg->len += len + 1;
357
358 return APR_SUCCESS;
359}
360
361/**
362 * Add a Byte array to AJP Message

Callers

nothing calls this directly

Calls 3

ajp_msg_append_uint16Function · 0.85
ajp_log_overflowFunction · 0.85
ap_xlate_proto_to_asciiFunction · 0.85

Tested by

no test coverage detected