mime_header.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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.h"
13 #include "profiler/Profiler.h"
14 
15 size_t
16 headersEnd(const char *mime, size_t l, bool &containsObsFold)
17 {
18  size_t e = 0;
19  int state = 1;
20  containsObsFold = false;
21 
23 
24  while (e < l && state < 3) {
25  switch (state) {
26 
27  case 0:
28 
29  if ('\n' == mime[e])
30  state = 1;
31 
32  break;
33 
34  case 1:
35  if ('\r' == mime[e])
36  state = 2;
37  else if ('\n' == mime[e])
38  state = 3;
39  else if (' ' == mime[e] || '\t' == mime[e]) {
40  containsObsFold = true;
41  state = 0;
42  } else
43  state = 0;
44 
45  break;
46 
47  case 2:
48  if ('\n' == mime[e])
49  state = 3;
50  else
51  state = 0;
52 
53  break;
54 
55  default:
56  break;
57  }
58 
59  ++e;
60  }
62 
63  if (3 == state)
64  return e;
65 
66  return 0;
67 }
68 
#define PROF_start(probename)
Definition: Profiler.h:62
#define PROF_stop(probename)
Definition: Profiler.h:63
size_t headersEnd(const char *mime, size_t l, bool &containsObsFold)
Definition: mime_header.cc:16

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors