* support code... */
#include "util_date.h" /* For parseHTTPdate and BAD_DATE */
#include "util_charset.h"
+#include "util_ebcdic.h"
#include "mpm_status.h"
#ifdef APR_HAVE_STDARG_H
#include <stdarg.h>
apr_status_t ap_http_filter(ap_filter_t *f, ap_bucket_brigade *b, ap_input_mode_t mode)
{
-#define ASCII_LF '\012'
+#define ASCII_BLANK '\040'
+#define ASCII_CR '\015'
+#define ASCII_LF '\012'
+#define ASCII_TAB '\011'
ap_bucket *e;
char *buff;
apr_ssize_t len;
* For now, we can't do a non-blocking read so we bypass this.
*
* Also, note that in the cases where another request can be read now
- * without blocking, it is likely already in our brigadet, so this hack
+ * without blocking, it is likely already in our brigade, so this hack
* isn't so bad after all.
*/
if (AP_BRIGADE_EMPTY(ctx->b)) {
break;
}
- if ((looking_ahead) && (*temp != ' ') && (*temp != '\t')) {
+ if ((looking_ahead) && (*temp != ASCII_BLANK) && (*temp != ASCII_TAB)) {
/* can't fold because next line isn't indented,
* so return what we have. lookahead brigade is
* stashed on req_cfg->bb
pos = last_char; /* Point at the last character */
- if (*pos == '\n') { /* Did we get a full line of input? */
+ if (*pos == ASCII_LF) { /* Did we get a full line of input? */
- if (pos > s && *(pos - 1) == '\r') {
+ if (pos > s && *(pos - 1) == ASCII_CR) {
--pos; /* zap optional CR before LF */
}
* it much easier to check field values for exact matches, and
* saves memory as well. Terminate string at end of line.
*/
- while (pos > (s + 1) && (*(pos - 1) == ' '
- || *(pos - 1) == '\t')) {
+ while (pos > (s + 1) &&
+ (*(pos - 1) == ASCII_BLANK || *(pos - 1) == ASCII_TAB)) {
--pos; /* trim extra trailing spaces or tabs */
}
*pos = '\0'; /* zap end of string */
looking_ahead = 0; /* only appropriate right after LF */
}
}
+ ap_xlate_proto_from_ascii(s, total);
return total;
}
ap_bucket_brigade *bb;
headfield = apr_pstrcat(r->pool, fieldname, ": ", fieldval, CRLF, NULL);
+ ap_xlate_proto_to_ascii(headfield, strlen(headfield));
headbuck = ap_bucket_create_pool(headfield, strlen(headfield), r->pool);
bb = ap_brigade_create(r->pool);
AP_BRIGADE_INSERT_HEAD(bb, headbuck);
ap_bucket *headbuck;
ap_bucket_brigade *bb;
- headfield = apr_pstrcat(r->pool, CRLF, NULL);
+ headfield = apr_palloc(r->pool, 3);
+ headfield[0] = ASCII_CR;
+ headfield[1] = ASCII_LF;
+ headfield[2] = '\0';
headbuck = ap_bucket_create_pool(headfield, strlen(headfield), r->pool);
bb = ap_brigade_create(r->pool);
AP_BRIGADE_INSERT_HEAD(bb, headbuck);