martin 98/02/22 13:35:33
Modified: src/modules/proxy mod_proxy.h proxy_connect.c proxy_ftp.c proxy_http.c Log: [Port]: minor changes to ease EBCDIC port Revision Changes Path 1.27 +6 -0 apache-1.3/src/modules/proxy/mod_proxy.h Index: mod_proxy.h =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/proxy/mod_proxy.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -u -r1.26 -r1.27 --- mod_proxy.h 1998/01/07 16:46:35 1.26 +++ mod_proxy.h 1998/02/22 21:35:30 1.27 @@ -121,6 +121,12 @@ /* maximum 'CacheDirLevels*CacheDirLength' value */ #define CACHEFILE_LEN 20 /* must be less than HASH_LEN/2 */ +#ifdef CHARSET_EBCDIC +#define CRLF "\r\n" +#else /*CHARSET_EBCDIC*/ +#define CRLF "\015\012" +#endif /*CHARSET_EBCDIC*/ + #define SEC_ONE_DAY 86400 /* one day, in seconds */ #define SEC_ONE_HR 3600 /* one hour, in seconds */ 1.21 +4 -4 apache-1.3/src/modules/proxy/proxy_connect.c Index: proxy_connect.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_connect.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -u -r1.20 -r1.21 --- proxy_connect.c 1998/01/07 16:46:36 1.20 +++ proxy_connect.c 1998/02/22 21:35:30 1.21 @@ -184,17 +184,17 @@ * a HTTP/1.0 request to keep things simple. */ Explain0("Sending the CONNECT request to the remote proxy"); - ap_snprintf(buffer, sizeof(buffer), "CONNECT %s HTTP/1.0\015\012", + ap_snprintf(buffer, sizeof(buffer), "CONNECT %s HTTP/1.0" CRLF, r->uri); write(sock, buffer, strlen(buffer)); ap_snprintf(buffer, sizeof(buffer), - "Proxy-agent: %s\015\012\015\012", SERVER_VERSION); + "Proxy-agent: %s" CRLF CRLF, SERVER_VERSION); write(sock, buffer, strlen(buffer)); } else { Explain0("Returning 200 OK Status"); - rvputs(r, "HTTP/1.0 200 Connection established\015\012", NULL); - rvputs(r, "Proxy-agent: ", SERVER_VERSION, "\015\012\015\012", NULL); + rvputs(r, "HTTP/1.0 200 Connection established" CRLF, NULL); + rvputs(r, "Proxy-agent: ", SERVER_VERSION, CRLF CRLF, NULL); bflush(r->connection->client); } 1.49 +26 -18 apache-1.3/src/modules/proxy/proxy_ftp.c Index: proxy_ftp.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_ftp.c,v retrieving revision 1.48 retrieving revision 1.49 diff -u -u -r1.48 -r1.49 --- proxy_ftp.c 1998/01/30 09:26:44 1.48 +++ proxy_ftp.c 1998/02/22 21:35:31 1.49 @@ -566,6 +566,10 @@ bpushfd(f, sock, sock); /* shouldn't we implement telnet control options here? */ +#ifdef CHARSET_EBCDIC + bsetflag(f, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 1); +#endif /*CHARSET_EBCDIC*/ + /* possible results: 120, 220, 421 */ hard_timeout("proxy ftp", r); i = ftp_getrc(f); @@ -583,7 +587,7 @@ bputs("USER ", f); bwrite(f, user, userlen); - bputs("\015\012", f); + bputs(CRLF, f); bflush(f); /* capture any errors */ Explain1("FTP: USER %s", user); @@ -609,7 +613,7 @@ return FORBIDDEN; bputs("PASS ", f); bwrite(f, password, passlen); - bputs("\015\012", f); + bputs(CRLF, f); bflush(f); Explain1("FTP: PASS %s", password); /* possible results 202, 230, 332, 421, 500, 501, 503, 530 */ @@ -646,7 +650,7 @@ len = decodeenc(path); bputs("CWD ", f); bwrite(f, path, len); - bputs("\015\012", f); + bputs(CRLF, f); bflush(f); Explain1("FTP: CWD %s", path); /* responses: 250, 421, 500, 501, 502, 530, 550 */ @@ -684,7 +688,7 @@ /* set type to image */ /* TM - Added \015\012 to the end of TYPE I, otherwise it hangs the connection */ - bputs("TYPE I\015\012", f); + bputs("TYPE I" CRLF, f); bflush(f); Explain0("FTP: TYPE I"); /* responses: 200, 421, 500, 501, 504, 530 */ @@ -721,7 +725,7 @@ } } - bputs("PASV\015\012", f); + bputs("PASV" CRLF, f); bflush(f); Explain0("FTP: PASV command issued"); /* possible results: 227, 421, 500, 501, 502, 530 */ @@ -827,7 +831,7 @@ else { bputs("SIZE ", f); bwrite(f, path, len); - bputs("\015\012", f); + bputs(CRLF, f); bflush(f); Explain1("FTP: SIZE %s", path); i = ftp_getrc(f); @@ -838,7 +842,7 @@ parms = "d"; bputs("CWD ", f); bwrite(f, path, len); - bputs("\015\012", f); + bputs(CRLF, f); bflush(f); Explain1("FTP: CWD %s", path); i = ftp_getrc(f); @@ -873,7 +877,7 @@ Explain1("FTP: RETR %s", path); } bwrite(f, path, len); - bputs("\015\012", f); + bputs(CRLF, f); bflush(f); /* RETR: 110, 125, 150, 226, 250, 421, 425, 426, 450, 451, 500, 501, 530, 550 NLST: 125, 150, 226, 250, 421, 425, 426, 450, 451, 500, 501, 502, 530 */ @@ -888,7 +892,7 @@ parms = "d"; bputs("CWD ", f); bwrite(f, path, len); - bputs("\015\012", f); + bputs(CRLF, f); bflush(f); Explain1("FTP: CWD %s", path); rc = ftp_getrc(f); @@ -906,7 +910,7 @@ return BAD_GATEWAY; } - bputs("LIST -lag\015\012", f); + bputs("LIST -lag" CRLF, f); bflush(f); Explain0("FTP: LIST -lag"); rc = ftp_getrc(f); @@ -977,13 +981,17 @@ bpushfd(data, dsock, dsock); } +#ifdef CHARSET_EBCDIC +/* bsetflag(data, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 0);*/ +#endif /*CHARSET_EBCDIC*/ + hard_timeout("proxy receive", r); /* send response */ /* write status line */ if (!r->assbackwards) - rvputs(r, "HTTP/1.0 ", r->status_line, "\015\012", NULL); + rvputs(r, "HTTP/1.0 ", r->status_line, CRLF, NULL); if (cache != NULL) - if (bvputs(cache, "HTTP/1.0 ", r->status_line, "\015\012", + if (bvputs(cache, "HTTP/1.0 ", r->status_line, CRLF, NULL) == -1) cache = proxy_cache_error(c); @@ -995,17 +1003,17 @@ hdr[i].value[0] == '\0') continue; if (!r->assbackwards) - rvputs(r, hdr[i].field, ": ", hdr[i].value, "\015\012", NULL); + rvputs(r, hdr[i].field, ": ", hdr[i].value, CRLF, NULL); if (cache != NULL) - if (bvputs(cache, hdr[i].field, ": ", hdr[i].value, "\015\012", + if (bvputs(cache, hdr[i].field, ": ", hdr[i].value, CRLF, NULL) == -1) cache = proxy_cache_error(c); } if (!r->assbackwards) - rputs("\015\012", r); + rputs(CRLF, r); if (cache != NULL) - if (bputs("\015\012", cache) == -1) + if (bputs(CRLF, cache) == -1) cache = proxy_cache_error(c); bsetopt(r->connection->client, BO_BYTECT, &zero); @@ -1024,7 +1032,7 @@ } else { /* abort the transfer */ - bputs("ABOR\015\012", f); + bputs("ABOR" CRLF, f); bflush(f); if (!pasvmode) bclose(data); @@ -1038,7 +1046,7 @@ proxy_cache_tidy(c); /* finish */ - bputs("QUIT\015\012", f); + bputs("QUIT" CRLF, f); bflush(f); Explain0("FTP: QUIT"); /* responses: 221, 500 */ 1.38 +11 -11 apache-1.3/src/modules/proxy/proxy_http.c Index: proxy_http.c =================================================================== RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_http.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -u -r1.37 -r1.38 --- proxy_http.c 1998/02/02 22:33:38 1.37 +++ proxy_http.c 1998/02/22 21:35:31 1.38 @@ -277,13 +277,13 @@ bpushfd(f, sock, sock); hard_timeout("proxy send", r); - bvputs(f, r->method, " ", proxyhost ? url : urlptr, " HTTP/1.0\015\012", + bvputs(f, r->method, " ", proxyhost ? url : urlptr, " HTTP/1.0" CRLF, NULL); bvputs(f, "Host: ", desthost, NULL); if (destportstr != NULL && destport != DEFAULT_HTTP_PORT) - bvputs(f, ":", destportstr, "\015\012", NULL); + bvputs(f, ":", destportstr, CRLF, NULL); else - bputs("\015\012", f); + bputs(CRLF, f); reqhdrs_arr = table_elts(r->headers_in); reqhdrs = (table_entry *) reqhdrs_arr->elts; @@ -293,10 +293,10 @@ || !strcasecmp(reqhdrs[i].key, "Host") /* Already sent */ ||!strcasecmp(reqhdrs[i].key, "Proxy-Authorization")) continue; - bvputs(f, reqhdrs[i].key, ": ", reqhdrs[i].val, "\015\012", NULL); + bvputs(f, reqhdrs[i].key, ": ", reqhdrs[i].val, CRLF, NULL); } - bputs("\015\012", f); + bputs(CRLF, f); /* send the request data, if any. N.B. should we trap SIGPIPE ? */ if (should_client_block(r)) { @@ -386,9 +386,9 @@ /* write status line */ if (!r->assbackwards) - rvputs(r, "HTTP/1.0 ", r->status_line, "\015\012", NULL); + rvputs(r, "HTTP/1.0 ", r->status_line, CRLF, NULL); if (cache != NULL) - if (bvputs(cache, "HTTP/1.0 ", r->status_line, "\015\012", NULL) == -1) + if (bvputs(cache, "HTTP/1.0 ", r->status_line, CRLF, NULL) == -1) cache = proxy_cache_error(c); /* send headers */ @@ -397,19 +397,19 @@ hdr[i].value[0] == '\0') continue; if (!r->assbackwards) { - rvputs(r, hdr[i].field, ": ", hdr[i].value, "\015\012", NULL); + rvputs(r, hdr[i].field, ": ", hdr[i].value, CRLF, NULL); table_set(r->headers_out, hdr[i].field, hdr[i].value); } if (cache != NULL) - if (bvputs(cache, hdr[i].field, ": ", hdr[i].value, "\015\012", + if (bvputs(cache, hdr[i].field, ": ", hdr[i].value, CRLF, NULL) == -1) cache = proxy_cache_error(c); } if (!r->assbackwards) - rputs("\015\012", r); + rputs(CRLF, r); if (cache != NULL) - if (bputs("\015\012", cache) == -1) + if (bputs(CRLF, cache) == -1) cache = proxy_cache_error(c); bsetopt(r->connection->client, BO_BYTECT, &zero);