Browse code

*** empty log message ***

Jan Janak authored on 09/08/2002 11:23:36
Showing 3 changed files
... ...
@@ -9,6 +9,7 @@
9 9
 #include "../dprint.h"
10 10
 #include "../mem/mem.h"
11 11
 #include "parse_def.h"
12
+#include "digest/digest.h" /* free_credentials */
12 13
 
13 14
 
14 15
 /* 
... ...
@@ -31,6 +32,11 @@ void clean_hdr_field(struct hdr_field* hf)
31 32
 			free_cseq(hf->parsed);
32 33
 			break;
33 34
 
35
+                case HDR_AUTHORIZATION:
36
+		case HDR_PROXYAUTH:
37
+			free_credentials((auth_body_t**)(&(hf->parsed));
38
+			break;
39
+
34 40
 		case HDR_FROM:
35 41
 			free_to(hf->parsed);
36 42
 			break;
... ...
@@ -187,6 +187,11 @@ int parse_headers(struct sip_msg* msg, int flags, int next)
187 187
 
188 188
 	end=msg->buf+msg->len;
189 189
 	tmp=msg->unparsed;
190
+	
191
+	if (next) {
192
+		orig_flag = msg->parsed_flag;
193
+		msg->parsed_flag &= ~flags;
194
+	}
190 195
 
191 196
 	if (next) {
192 197
 		orig_flag = msg->parsed_flag;
193 198
new file mode 100644
... ...
@@ -0,0 +1,76 @@
1
+/* $Id$ */
2
+
3
+#ifndef TRIM_H
4
+#define TRIM_H
5
+
6
+#include "str.h"
7
+
8
+
9
+/*
10
+ * This switch-case statement is used in
11
+ * trim_leading and trim_trailing. You can
12
+ * define char that should be skipped here.
13
+ */
14
+#define TRIM_SWITCH(c) switch(c) {     \
15
+                       case ' ':       \
16
+                       case '\t':      \
17
+                       case '\r':      \
18
+                       case '\n':      \
19
+                               break;  \
20
+                                       \
21
+                       default:        \
22
+                               return; \
23
+                       }
24
+
25
+
26
+/*
27
+ * Remove any leading whitechars, like spaces,
28
+ * horizontal tabs, carriage returns and line
29
+ * feeds
30
+ *
31
+ * WARNING: String descriptor structure will be
32
+ *          modified ! Make a copy otherwise you
33
+ *          might be unable to free _s->s for
34
+ *          example !
35
+ *
36
+ */
37
+static inline void trim_leading(str* _s)
38
+{
39
+	for(; _s->len > 0; _s->len--, _s->s++) {
40
+		TRIM_SWITCH(*(_s->s));
41
+	}
42
+}
43
+
44
+
45
+/*
46
+ * Remove any trailing white char, like spaces,
47
+ * horizontal tabs, carriage returns and line feeds
48
+ *
49
+ * WARNING: String descriptor structure will be
50
+ *          modified ! Make a copy otherwise you
51
+ *          might be unable to free _s->s for
52
+ *          example !
53
+ */
54
+static inline void trim_trailing(str* _s)
55
+{
56
+	for(; _s->len > 0; _s->len--) {
57
+		TRIM_SWITCH(_s->s[_s->len - 1]);
58
+	}
59
+}
60
+
61
+
62
+/*
63
+ * Do trim_leading and trim_trailing
64
+ *
65
+ * WARNING: String structure will be modified !
66
+ *          Make a copy otherwise you might be
67
+ *          unable to free _s->s for example !
68
+ */
69
+static inline void trim(str* _s)
70
+{
71
+	trim_leading(_s);
72
+	trim_trailing(_s);
73
+}
74
+
75
+
76
+#endif