squid-
cache.org
Optimising Web Delivery
Docs
Download
Donate
Support
About
Contact
Shop
Blog
src
mime_header.cc
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3
*
4
* Squid software is distributed under GPLv2+ license and includes
5
* contributions from numerous individuals and organizations.
6
* Please see the COPYING and CONTRIBUTORS files for details.
7
*/
8
9
/* DEBUG: section 25 MiME Header Parsing */
10
11
#include "
squid.h
"
12
#include "
debug/Stream.h
"
13
#include "
mime_header.h
"
14
#include "
sbuf/SBuf.h
"
15
16
size_t
17
headersEnd
(
const
char
*mime,
size_t
l,
bool
&containsObsFold)
18
{
19
size_t
e = 0;
20
int
state = 1;
21
containsObsFold =
false
;
22
23
while
(e < l && state < 3) {
24
switch
(state) {
25
26
case
0:
27
28
if
(
'\n'
== mime[e])
29
state = 1;
30
31
break
;
32
33
case
1:
34
if
(
'\r'
== mime[e])
35
state = 2;
36
else
if
(
'\n'
== mime[e])
37
state = 3;
38
else
if
(
' '
== mime[e] ||
'\t'
== mime[e]) {
39
containsObsFold =
true
;
40
state = 0;
41
}
else
42
state = 0;
43
44
break
;
45
46
case
2:
47
if
(
'\n'
== mime[e])
48
state = 3;
49
else
50
state = 0;
51
52
break
;
53
54
default
:
55
break
;
56
}
57
58
++e;
59
}
60
61
if
(3 == state)
62
return
e;
63
64
return
0;
65
}
66
67
size_t
68
headersEnd
(
const
SBuf
&buf,
bool
&containsObsFold)
69
{
70
return
headersEnd
(buf.
rawContent
(), buf.
length
(), containsObsFold);
71
}
72
SBuf.h
SBuf
Definition:
SBuf.h:94
SBuf::rawContent
const char * rawContent() const
Definition:
SBuf.cc:509
SBuf::length
size_type length() const
Returns the number of bytes stored in SBuf.
Definition:
SBuf.h:415
Stream.h
headersEnd
size_t headersEnd(const char *mime, size_t l, bool &containsObsFold)
Definition:
mime_header.cc:17
mime_header.h
squid.h
Introduction
About Squid
Why Squid?
Squid Developers
How to Donate
How to Help Out
Getting Squid
Squid Source Packages
Squid Deployment Case-Studies
Squid Software Foundation
Documentation
Quick Setup
Configuration:
Reference
Examples
FAQ
and
Wiki
Guide Books:
Beginners
Definitive
Non-English
More...
Support
Security Advisories
Bugzilla Database
Mailing lists
Contacting us
Commercial services
Project Sponsors
Squid-based products
Miscellaneous
Developer Resources
Related Writings
Related Software:
Authenticators
Ecap
Icap
Ident
Log Analysis
Monitor
Proxies
Redirectors
General
Squid Artwork
Web Site Translations
Japanese
Mirrors
Website:
gr
il
pl
...
full list
FTP Package Archive