/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996-1998,2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Protocol interpreter for the Hypertext Transfer Protocol (HTTP)
*
* Relevant standards:
* Berners-Lee, T., et al: Hypertext Transfer Protocol -- HTTP/1.0.
* RFC 1945, May 1996
* Fielding, R., et al: Hypertext Transfer Protocol -- HTTP/1.1.
* RFC 2068, June 1999
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "snoop.h"
/*
* Summary lines: packet contents starting with less than MINCHARS
* printable characters will not be printed. MAXCHARS is the maximum
* number of characters printed.
* Detail lines: NLINES is the maximum number of content lines to print
*/
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
int
{
char *p, *q, *endp;
int c;
int lineno;
if (c < MINCHARS) {
"HTTP (body)");
} else {
}
}
show_space();
lineno = 0;
/* stop if no printables, except if at line end */
break;
/*
* A line may be terminated either by an CR LF sequence
* (DOS, Mac), or by LF alone
*/
if (q != NULL) {
++q; /* ignore subsequent LF character */
} else {
if (q == NULL)
q = endp - 1;
}
/* truncate lines containing non-printable characters */
"%.*s", c, p);
++lineno;
}
if (p < endp) /* there was more data to be printed */
"[...]");
show_space();
}
return (fraglen);
}
/*
* Return the length of the initial string starting with "startp" and
* ending with "endp" (inclusively) consisting only of printable
* characters.
*/
static int
{
const char *p = startp;
p++;
return (p - startp);
}