Browse code

TM callbacks, acc, flags

Jiri Kuthan authored on 13/05/2002 01:15:40
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,675 +0,0 @@
1
-
2
-
3
-#include <stdlib.h>
4
-#include <string.h>
5
-#include "dprint.h"
6
-#include "msg_parser.h"
7
-#include "ut.h"
8
-#include "mem/mem.h"
9
-
10
-
11
-enum{ START_TO, DISPLAY_QUOTED, E_DISPLAY_QUOTED, DISPLAY_TOKEN
12
-	, S_URI_ENCLOSED, URI_ENCLOSED, E_URI_ENCLOSED
13
-	, URI_OR_TOKEN, MAYBE_URI_END
14
-	, END, F_CR, F_LF, F_CRLF
15
-	};
16
-
17
-enum{ S_PARA_NAME=20, PARA_NAME, S_EQUAL, S_PARA_VALUE, TAG1, TAG2, TAG3
18
-	, PARA_VALUE_TOKEN , PARA_VALUE_QUOTED, E_PARA_VALUE, PARA_START
19
-	};
20
-
21
-
22
-
23
-#define add_param( _param , _body ) \
24
-	do{\
25
-		DBG("DEBUG: add_param: %.*s=%.*s\n",param->name.len,param->name.s,\
26
-			param->value.len,param->value.s);\
27
-		if (!(_body)->param_lst)  (_body)->param_lst=(_param);\
28
-		else (_body)->last_param->next=(_param);\
29
-		(_body)->last_param =(_param);\
30
-		if ((_param)->type==TAG_PARAM)\
31
-			memcpy(&((_body)->tag_value),&((_param)->value),sizeof(str));\
32
-	}while(0);
33
-
34
-
35
-
36
-
37
-
38
-char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
39
-								int *returned_status)
40
-{
41
-	struct to_param *param;
42
-	int status;
43
-	int saved_status;
44
-	char  *tmp;
45
-
46
-	param=0;
47
-	status=PARA_START;
48
-	saved_status=PARA_START;
49
-
50
-	for( tmp=buffer; tmp<end; tmp++)
51
-	{
52
-		switch(*tmp)
53
-		{
54
-			case ' ':
55
-			case '\t':
56
-				switch (status)
57
-				{
58
-					case TAG3:
59
-						param->type=TAG_PARAM;
60
-					case PARA_NAME:
61
-					case TAG1:
62
-					case TAG2:
63
-						param->name.len = tmp-param->name.s;
64
-						*tmp=0;
65
-						status = S_EQUAL;
66
-						break;
67
-					case PARA_VALUE_TOKEN:
68
-						param->value.len = tmp-param->value.s;
69
-						*tmp=0;
70
-						status = E_PARA_VALUE;
71
-						add_param( param , to_b );
72
-						break;
73
-					case F_CRLF:
74
-					case F_LF:
75
-					case F_CR:
76
-						/*previous=crlf and now =' '*/
77
-						status=saved_status;
78
-						break;
79
-				}
80
-				break;
81
-			case '\n':
82
-				switch (status)
83
-				{
84
-					case S_PARA_NAME:
85
-					case S_EQUAL:
86
-					case S_PARA_VALUE:
87
-					case E_PARA_VALUE:
88
-						saved_status=status;
89
-						status=F_LF;
90
-						break;
91
-					case TAG3:
92
-						param->type=TAG_PARAM;
93
-					case PARA_NAME:
94
-					case TAG1:
95
-					case TAG2:
96
-						param->name.len = tmp-param->name.s;
97
-						*tmp=0;
98
-						saved_status = S_EQUAL;
99
-						status = F_LF;
100
-						break;
101
-					case PARA_VALUE_TOKEN:
102
-						param->value.len = tmp-param->value.s;
103
-						*tmp=0;
104
-						saved_status = E_PARA_VALUE;
105
-						status = F_LF;
106
-						add_param( param , to_b );
107
-						break;
108
-					case F_CR:
109
-						status=F_CRLF;
110
-						break;
111
-					case F_CRLF:
112
-					case F_LF:
113
-						status=saved_status;
114
-						goto endofheader;
115
-					default:
116
-						LOG( L_ERR , "ERROR: parse_to_param : "
117
-							"unexpected char [%c] in status %d: <<%.*s>> .\n",
118
-							*tmp,status, tmp-buffer, buffer);
119
-				}
120
-				break;
121
-			case '\r':
122
-				switch (status)
123
-				{
124
-					case S_PARA_NAME:
125
-					case S_EQUAL:
126
-					case S_PARA_VALUE:
127
-					case E_PARA_VALUE:
128
-						saved_status=status;
129
-						status=F_CR;
130
-						break;
131
-					case TAG3:
132
-						param->type=TAG_PARAM;
133
-					case PARA_NAME:
134
-					case TAG1:
135
-					case TAG2:
136
-						param->name.len = tmp-param->name.s;
137
-						*tmp=0;
138
-						saved_status = S_EQUAL;
139
-						status = F_CR;
140
-						break;
141
-					case PARA_VALUE_TOKEN:
142
-						param->value.len = tmp-param->value.s;
143
-						*tmp=0;
144
-						saved_status = E_PARA_VALUE;
145
-						status = F_CR;
146
-						add_param( param , to_b );
147
-						break;
148
-					case F_CRLF:
149
-					case F_CR:
150
-					case F_LF:
151
-						status=saved_status;
152
-						goto endofheader;
153
-					default:
154
-						LOG( L_ERR , "ERROR: parse_to_param : "
155
-							"unexpected char [%c] in status %d: <<%.*s>> .\n",
156
-							*tmp,status, tmp-buffer, buffer);
157
-						goto error;
158
-				}
159
-				break;
160
-			case '\\':
161
-				switch (status)
162
-				{
163
-					case PARA_VALUE_QUOTED:
164
-						switch (*(tmp+1))
165
-						{
166
-							case '\r':
167
-							case '\n':
168
-								break;
169
-							default:
170
-								tmp++;
171
-						}
172
-					default:
173
-						LOG( L_ERR , "ERROR: parse_to_param : "
174
-							"unexpected char [%c] in status %d: <<%.*s>> .\n",
175
-							*tmp,status, tmp-buffer, buffer);
176
-						goto error;
177
-				}
178
-				break;
179
-			case '"':
180
-				switch (status)
181
-				{
182
-					case S_PARA_VALUE:
183
-						param->value.s = tmp+1;
184
-						status = PARA_VALUE_QUOTED;
185
-						break;
186
-					case PARA_VALUE_QUOTED:
187
-						param->value.len=tmp-param->value.s-1 ;
188
-						*tmp = 0;
189
-						add_param( param , to_b );
190
-						status = E_PARA_VALUE;
191
-						break;
192
-					case F_CRLF:
193
-					case F_LF:
194
-					case F_CR:
195
-						/*previous=crlf and now !=' '*/
196
-						goto endofheader;
197
-					default:
198
-						LOG( L_ERR , "ERROR: parse_to_param :"
199
-							"unexpected char [%c] in status %d: <<%.*s>> .\n",
200
-							*tmp,status, tmp-buffer, buffer);
201
-						goto error;
202
-				}
203
-				break;
204
-			case ';' :
205
-				switch (status)
206
-				{
207
-					case PARA_VALUE_QUOTED:
208
-						break;
209
-					case PARA_VALUE_TOKEN:
210
-						param->value.len=tmp-param->value.s-1;
211
-						add_param(param,to_b);
212
-					case PARA_START:
213
-						*tmp=0;
214
-					case E_PARA_VALUE:
215
-						param = (struct to_param*)
216
-							pkg_malloc(sizeof(struct to_param));
217
-						if (!param){
218
-							LOG( L_ERR , "ERROR: parse_to_param"
219
-							" - out of memory\n" );
220
-							goto error;
221
-						}
222
-						memset(param,0,sizeof(struct to_param));
223
-						param->type=GENERAL_PARAM;
224
-						status = S_PARA_NAME;
225
-						break;
226
-					case F_CRLF:
227
-					case F_LF:
228
-					case F_CR:
229
-						/*previous=crlf and now !=' '*/
230
-						goto endofheader;
231
-					default:
232
-						LOG( L_ERR , "ERROR: parse_to_param :"
233
-							"unexpected char [%c] in status %d: <<%.*s>> .\n",
234
-							*tmp,status, tmp-buffer, buffer);
235
-						goto error;
236
-				}
237
-				break;
238
-			case 'T':
239
-			case 't' :
240
-				switch (status)
241
-				{
242
-					case PARA_VALUE_QUOTED:
243
-					case PARA_VALUE_TOKEN:
244
-					case PARA_NAME:
245
-						break;
246
-					case S_PARA_NAME:
247
-						param->name.s = tmp;
248
-						status = TAG1;
249
-						break;
250
-					case S_PARA_VALUE:
251
-						param->value.s = tmp;
252
-						status = PARA_VALUE_TOKEN;
253
-						break;
254
-					case TAG1:
255
-					case TAG2:
256
-					case TAG3:
257
-						status = PARA_NAME;
258
-						break;
259
-					case F_CRLF:
260
-					case F_LF:
261
-					case F_CR:
262
-						/*previous=crlf and now !=' '*/
263
-						goto endofheader;
264
-					default:
265
-						LOG( L_ERR , "ERROR: parse_to_param :"
266
-							"unexpected char [%c] in status %d: <<%.*s>> .\n",
267
-							*tmp,status, tmp-buffer, buffer);
268
-						goto error;
269
-				}
270
-				break;
271
-			case 'A':
272
-			case 'a' :
273
-				switch (status)
274
-				{
275
-					case PARA_VALUE_QUOTED:
276
-					case PARA_VALUE_TOKEN:
277
-					case PARA_NAME:
278
-						break;
279
-					case S_PARA_NAME:
280
-						param->name.s = tmp;
281
-						status = PARA_NAME;
282
-						break;
283
-					case S_PARA_VALUE:
284
-						param->value.s = tmp;
285
-						status = PARA_VALUE_TOKEN;
286
-						break;
287
-					case TAG1:
288
-						status = TAG2;
289
-						break;
290
-					case TAG2:
291
-					case TAG3:
292
-						status = PARA_NAME;
293
-						break;
294
-					case F_CRLF:
295
-					case F_LF:
296
-					case F_CR:
297
-						/*previous=crlf and now !=' '*/
298
-						goto endofheader;
299
-					default:
300
-						LOG( L_ERR , "ERROR: parse_to_param : "
301
-							"unexpected char [%c] in status %d: <<%.*s>> .\n",
302
-							*tmp,status, tmp-buffer, buffer);
303
-						goto error;
304
-				}
305
-				break;
306
-			case 'G':
307
-			case 'g' :
308
-				switch (status)
309
-				{
310
-					case PARA_VALUE_QUOTED:
311
-					case PARA_VALUE_TOKEN:
312
-					case PARA_NAME:
313
-						break;
314
-					case S_PARA_NAME:
315
-						param->name.s = tmp;
316
-						status = PARA_NAME;
317
-						break;
318
-					case S_PARA_VALUE:
319
-						param->value.s = tmp;
320
-						status = PARA_VALUE_TOKEN;
321
-						break;
322
-					case TAG1:
323
-					case TAG3:
324
-						status = PARA_NAME;
325
-						break;
326
-					case TAG2:
327
-						status = TAG3;
328
-						break;
329
-					case F_CRLF:
330
-					case F_LF:
331
-					case F_CR:
332
-						/*previous=crlf and now !=' '*/
333
-						goto endofheader;
334
-					default:
335
-						LOG( L_ERR , "ERROR: parse_to_param : "
336
-							"unexpected char [%c] in status %d: <<%.*s>> .\n",
337
-							*tmp,status, tmp-buffer, buffer);
338
-						goto error;
339
-				}
340
-				break;
341
-			case '=':
342
-				switch (status)
343
-				{
344
-					case PARA_VALUE_QUOTED:
345
-						break;
346
-					case TAG3:
347
-						param->type=TAG_PARAM;
348
-					case PARA_NAME:
349
-					case TAG1:
350
-					case TAG2:
351
-						param->name.len = tmp-param->name.s;
352
-						*tmp=0;
353
-						status = S_PARA_VALUE;
354
-						break;
355
-					case S_EQUAL:
356
-						status = S_PARA_VALUE;
357
-						break;
358
-					case F_CRLF:
359
-					case F_LF:
360
-					case F_CR:
361
-						/*previous=crlf and now !=' '*/
362
-						goto endofheader;
363
-					default:
364
-						LOG( L_ERR , "ERROR: parse_to_param : "
365
-							"unexpected char [%c] in status %d: <<%.*s>> .\n",
366
-							*tmp,status, tmp-buffer, buffer);
367
-						goto error;
368
-				}
369
-				break;
370
-			default:
371
-				switch (status)
372
-				{
373
-					case PARA_VALUE_TOKEN:
374
-					case PARA_NAME:
375
-					case PARA_VALUE_QUOTED:
376
-						break;
377
-					case S_PARA_NAME:
378
-						param->name.s = tmp;
379
-						status = PARA_NAME;
380
-						break;
381
-					case S_PARA_VALUE:
382
-						param->value.s = tmp;
383
-						status = PARA_VALUE_TOKEN;
384
-						break;
385
-					case F_CRLF:
386
-					case F_LF:
387
-					case F_CR:
388
-						/*previous=crlf and now !=' '*/
389
-						goto endofheader;
390
-					default:
391
-						DBG("DEBUG: parse_to_param: "
392
-						"spitting out [%c] in status %d\n",*tmp,status );
393
-						goto error;
394
-				}
395
-		}/*switch*/
396
-	}/*for*/
397
-
398
-
399
-endofheader:
400
-	*returned_status=saved_status;
401
-	return tmp;
402
-
403
-error:
404
-	LOG(L_ERR, "to_param parse error\n");
405
-	if (param) pkg_free(param);
406
-	to_b->error=PARSE_ERROR;
407
-	return tmp;
408
-}
409
-
410
-
411
-
412
-
413
-char* parse_to(char* buffer, char *end, struct to_body *to_b)
414
-{
415
-	int status;
416
-	int saved_status;
417
-	char  *tmp,*foo;
418
-
419
-	status=START_TO;
420
-	foo=0;
421
-
422
-	for( tmp=buffer; tmp<end; tmp++)
423
-	{
424
-		switch(*tmp)
425
-		{
426
-			case ' ':
427
-			case '\t':
428
-				switch (status)
429
-				{
430
-					case F_CRLF:
431
-					case F_LF:
432
-					case F_CR:
433
-						/*previous=crlf and now =' '*/
434
-						status=saved_status;
435
-						break;
436
-					case URI_ENCLOSED:
437
-						to_b->uri.len = tmp - to_b->uri.s;
438
-						//*tmp = 0;
439
-						status = E_URI_ENCLOSED;
440
-						break;
441
-					case URI_OR_TOKEN:
442
-						foo = tmp;
443
-						status = MAYBE_URI_END;
444
-						break;
445
-				}
446
-				break;
447
-			case '\n':
448
-				switch (status)
449
-				{
450
-					case URI_OR_TOKEN:
451
-						foo = tmp;
452
-						status = MAYBE_URI_END;
453
-					case MAYBE_URI_END:
454
-					case DISPLAY_TOKEN:
455
-					case E_DISPLAY_QUOTED:
456
-					case END:
457
-						saved_status=status;
458
-						status=F_LF;
459
-						break;
460
-					case F_CR:
461
-						status=F_CRLF;
462
-						break;
463
-					case F_CRLF:
464
-					case F_LF:
465
-						status=saved_status;
466
-						goto endofheader;
467
-					default:
468
-						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
469
-							"in status %d: <<%.*s>> .\n",
470
-							*tmp,status, tmp-buffer, buffer);
471
-				}
472
-				break;
473
-			case '\r':
474
-				switch (status)
475
-				{
476
-					case URI_OR_TOKEN:
477
-						foo = tmp;
478
-						status = MAYBE_URI_END;
479
-					case MAYBE_URI_END:
480
-					case DISPLAY_TOKEN:
481
-					case E_DISPLAY_QUOTED:
482
-					case END:
483
-						saved_status=status;
484
-						status=F_CR;
485
-						break;
486
-					case F_CRLF:
487
-					case F_CR:
488
-					case F_LF:
489
-						status=saved_status;
490
-						goto endofheader;
491
-					default:
492
-						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
493
-							"in status %d: <<%.*s>> .\n",
494
-							*tmp,status, tmp-buffer, buffer);
495
-						goto error;
496
-				}
497
-				break;
498
-			case '\\':
499
-				switch (status)
500
-				{
501
-					case DISPLAY_QUOTED:
502
-						switch (*(tmp+1))
503
-						{
504
-							case '\n':
505
-							case '\r':
506
-								break;
507
-							default:
508
-								tmp++;
509
-						}
510
-					default:
511
-						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
512
-							"in status %d: <<%.*s>> .\n",
513
-							*tmp,status, tmp-buffer, buffer);
514
-						goto error;
515
-				}
516
-				break;
517
-			case '<':
518
-				switch (status)
519
-				{
520
-					case START_TO:
521
-						to_b->body.s=tmp;
522
-						status = S_URI_ENCLOSED;
523
-						break;
524
-					case DISPLAY_QUOTED:
525
-						break;
526
-					case E_DISPLAY_QUOTED:
527
-					case URI_OR_TOKEN:
528
-					case DISPLAY_TOKEN: 
529
-					case MAYBE_URI_END:
530
-						status = S_URI_ENCLOSED;
531
-						break;
532
-					case F_CRLF:
533
-					case F_LF:
534
-					case F_CR:
535
-						/*previous=crlf and now !=' '*/
536
-						goto endofheader;
537
-					default:
538
-						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
539
-							"in status %d: <<%.*s>> .\n",
540
-							*tmp,status, tmp-buffer, buffer);
541
-						goto error;
542
-				}
543
-				break;
544
-			case '>':
545
-				switch (status)
546
-				{
547
-					case DISPLAY_QUOTED:
548
-						break;
549
-					case URI_ENCLOSED:
550
-						//*tmp = 0;
551
-					case E_URI_ENCLOSED:
552
-						to_b->uri.len = tmp - to_b->uri.s;
553
-						status = END;
554
-						foo = 0;
555
-						break;
556
-					case F_CRLF:
557
-					case F_LF:
558
-					case F_CR:
559
-						/*previous=crlf and now !=' '*/
560
-						goto endofheader;
561
-					default:
562
-						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
563
-							"in status %d: <<%.*s>> .\n",
564
-							*tmp,status, tmp-buffer, buffer);
565
-						goto error;
566
-				}
567
-				break;
568
-			case '"':
569
-				switch (status)
570
-				{
571
-					case START_TO:
572
-						to_b->body.s = tmp;
573
-						status = DISPLAY_QUOTED;
574
-						break;
575
-					case DISPLAY_QUOTED:
576
-						status = E_DISPLAY_QUOTED;
577
-						break;
578
-					case F_CRLF:
579
-					case F_LF:
580
-					case F_CR:
581
-						/*previous=crlf and now !=' '*/
582
-						goto endofheader;
583
-					default:
584
-						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
585
-							"in status %d: <<%.*s>> .\n",
586
-							*tmp,status, tmp-buffer, buffer);
587
-						goto error;
588
-				}
589
-				break;
590
-			case ';' :
591
-				switch (status)
592
-				{
593
-					case DISPLAY_QUOTED:
594
-					case URI_ENCLOSED:
595
-						break;
596
-					case URI_OR_TOKEN:
597
-						foo = tmp;
598
-					case MAYBE_URI_END:
599
-						to_b->uri.len = foo - to_b->uri.s;
600
-					case END:
601
-						to_b->body.len = tmp-to_b->body.s;
602
-						tmp = parse_to_param(tmp,end,to_b,&saved_status);
603
-						//if (foo) *foo=0;
604
-						goto endofheader;
605
-					case F_CRLF:
606
-					case F_LF:
607
-					case F_CR:
608
-						/*previous=crlf and now !=' '*/
609
-						goto endofheader;
610
-					default:
611
-						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
612
-							"in status %d: <<%.*s>> .\n",
613
-							*tmp,status, tmp-buffer, buffer);
614
-						goto error;
615
-				}
616
-				break;
617
-			default:
618
-				switch (status)
619
-				{
620
-					case START_TO:
621
-						to_b->uri.s = to_b->body.s = tmp;
622
-						status = URI_OR_TOKEN;;
623
-						break;
624
-					case S_URI_ENCLOSED:
625
-						to_b->uri.s=tmp;
626
-						status=URI_ENCLOSED;
627
-						break;
628
-					case MAYBE_URI_END:
629
-						status = DISPLAY_TOKEN;
630
-					case DISPLAY_QUOTED:
631
-					case DISPLAY_TOKEN:
632
-					case URI_ENCLOSED:
633
-					case URI_OR_TOKEN:
634
-						break;
635
-					case F_CRLF:
636
-					case F_LF:
637
-					case F_CR:
638
-						/*previous=crlf and now !=' '*/
639
-						goto endofheader;
640
-					default:
641
-						DBG("DEBUG:parse_to: spitting out [%c] in status %d\n",
642
-						*tmp,status );
643
-						goto error;
644
-				}
645
-		}/*char switch*/
646
-	}/*for*/
647
-
648
-endofheader:
649
-	DBG("DEBUG: status = %d \n",status);
650
-	status=saved_status;
651
-	DBG("end of header reached, state=%d\n", status);
652
-	/* check if error*/
653
-	switch(status){
654
-		case MAYBE_URI_END:
655
-			//*foo=0;
656
-			to_b->uri.len = foo - to_b->uri.s;
657
-		case END:
658
-			to_b->body.len = tmp - to_b->body.s;
659
-	case E_PARA_VALUE:
660
-			*(tmp-1)=0;
661
-			break;
662
-		default:
663
-			LOG(L_ERR, "ERROR: parse_to: invalid To -  unexpected "
664
-					"end of header in state %d\n", status);
665
-			goto error;
666
-	}
667
-	return tmp;
668
-
669
-error:
670
-	LOG(L_ERR, "to parse error\n");
671
-	to_b->error=PARSE_ERROR;
672
-	return tmp;
673
-
674
-}
675
-
Browse code

parse param to fixed

Bogdan-Andrei Iancu authored on 27/03/2002 16:57:16
Showing 1 changed files
... ...
@@ -22,6 +22,8 @@ enum{ S_PARA_NAME=20, PARA_NAME, S_EQUAL, S_PARA_VALUE, TAG1, TAG2, TAG3
22 22
 
23 23
 #define add_param( _param , _body ) \
24 24
 	do{\
25
+		DBG("DEBUG: add_param: %.*s=%.*s\n",param->name.len,param->name.s,\
26
+			param->value.len,param->value.s);\
25 27
 		if (!(_body)->param_lst)  (_body)->param_lst=(_param);\
26 28
 		else (_body)->last_param->next=(_param);\
27 29
 		(_body)->last_param =(_param);\
... ...
@@ -112,7 +114,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
112 114
 						goto endofheader;
113 115
 					default:
114 116
 						LOG( L_ERR , "ERROR: parse_to_param : "
115
-						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
117
+							"unexpected char [%c] in status %d: <<%.*s>> .\n",
118
+							*tmp,status, tmp-buffer, buffer);
116 119
 				}
117 120
 				break;
118 121
 			case '\r':
... ...
@@ -149,8 +152,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
149 152
 						goto endofheader;
150 153
 					default:
151 154
 						LOG( L_ERR , "ERROR: parse_to_param : "
152
-						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
153
-						/* "unexpected char [%c] in status %d .\n",*tmp,status); */
155
+							"unexpected char [%c] in status %d: <<%.*s>> .\n",
156
+							*tmp,status, tmp-buffer, buffer);
154 157
 						goto error;
155 158
 				}
156 159
 				break;
... ...
@@ -168,8 +171,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
168 171
 						}
169 172
 					default:
170 173
 						LOG( L_ERR , "ERROR: parse_to_param : "
171
-						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
172
-						/* "unexpected char [%c] in status %d .\n",*tmp,status); */
174
+							"unexpected char [%c] in status %d: <<%.*s>> .\n",
175
+							*tmp,status, tmp-buffer, buffer);
173 176
 						goto error;
174 177
 				}
175 178
 				break;
... ...
@@ -193,8 +196,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
193 196
 						goto endofheader;
194 197
 					default:
195 198
 						LOG( L_ERR , "ERROR: parse_to_param :"
196
-						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
197
-						/* "unexpected char [%c] in status %d .\n",*tmp,status); */
199
+							"unexpected char [%c] in status %d: <<%.*s>> .\n",
200
+							*tmp,status, tmp-buffer, buffer);
198 201
 						goto error;
199 202
 				}
200 203
 				break;
... ...
@@ -203,6 +206,9 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
203 206
 				{
204 207
 					case PARA_VALUE_QUOTED:
205 208
 						break;
209
+					case PARA_VALUE_TOKEN:
210
+						param->value.len=tmp-param->value.s-1;
211
+						add_param(param,to_b);
206 212
 					case PARA_START:
207 213
 						*tmp=0;
208 214
 					case E_PARA_VALUE:
... ...
@@ -224,8 +230,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
224 230
 						goto endofheader;
225 231
 					default:
226 232
 						LOG( L_ERR , "ERROR: parse_to_param :"
227
-						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
228
-						/* "unexpected char [%c] in status %d .\n",*tmp,status); */
233
+							"unexpected char [%c] in status %d: <<%.*s>> .\n",
234
+							*tmp,status, tmp-buffer, buffer);
229 235
 						goto error;
230 236
 				}
231 237
 				break;
... ...
@@ -257,8 +263,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
257 263
 						goto endofheader;
258 264
 					default:
259 265
 						LOG( L_ERR , "ERROR: parse_to_param :"
260
-						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
261
-						/* " unexpected char [%c] in status %d .\n",*tmp,status); */
266
+							"unexpected char [%c] in status %d: <<%.*s>> .\n",
267
+							*tmp,status, tmp-buffer, buffer);
262 268
 						goto error;
263 269
 				}
264 270
 				break;
... ...
@@ -292,8 +298,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
292 298
 						goto endofheader;
293 299
 					default:
294 300
 						LOG( L_ERR , "ERROR: parse_to_param : "
295
-						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
296
-						/* "unexpected char [%c] in status %d .\n",*tmp,status); */
301
+							"unexpected char [%c] in status %d: <<%.*s>> .\n",
302
+							*tmp,status, tmp-buffer, buffer);
297 303
 						goto error;
298 304
 				}
299 305
 				break;
... ...
@@ -327,8 +333,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
327 333
 						goto endofheader;
328 334
 					default:
329 335
 						LOG( L_ERR , "ERROR: parse_to_param : "
330
-						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
331
-						/* "unexpected char [%c] in status %d .\n",*tmp,status); */
336
+							"unexpected char [%c] in status %d: <<%.*s>> .\n",
337
+							*tmp,status, tmp-buffer, buffer);
332 338
 						goto error;
333 339
 				}
334 340
 				break;
... ...
@@ -356,8 +362,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
356 362
 						goto endofheader;
357 363
 					default:
358 364
 						LOG( L_ERR , "ERROR: parse_to_param : "
359
-						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
360
-						/* "unexpected char [%c] in status %d .\n",*tmp,status); */
365
+							"unexpected char [%c] in status %d: <<%.*s>> .\n",
366
+							*tmp,status, tmp-buffer, buffer);
361 367
 						goto error;
362 368
 				}
363 369
 				break;
... ...
@@ -460,8 +466,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
460 466
 						goto endofheader;
461 467
 					default:
462 468
 						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
463
-						"in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
464
-						/* "in status %d .\n",*tmp,status); */
469
+							"in status %d: <<%.*s>> .\n",
470
+							*tmp,status, tmp-buffer, buffer);
465 471
 				}
466 472
 				break;
467 473
 			case '\r':
... ...
@@ -484,8 +490,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
484 490
 						goto endofheader;
485 491
 					default:
486 492
 						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
487
-						"in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
488
-						/* "in status %d .\n",*tmp,status); */
493
+							"in status %d: <<%.*s>> .\n",
494
+							*tmp,status, tmp-buffer, buffer);
489 495
 						goto error;
490 496
 				}
491 497
 				break;
... ...
@@ -503,8 +509,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
503 509
 						}
504 510
 					default:
505 511
 						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
506
-						"in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
507
-						/* "in status %d .\n",*tmp,status); */
512
+							"in status %d: <<%.*s>> .\n",
513
+							*tmp,status, tmp-buffer, buffer);
508 514
 						goto error;
509 515
 				}
510 516
 				break;
... ...
@@ -530,8 +536,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
530 536
 						goto endofheader;
531 537
 					default:
532 538
 						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
533
-						"in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
534
-						/* "in status %d .\n",*tmp,status); */
539
+							"in status %d: <<%.*s>> .\n",
540
+							*tmp,status, tmp-buffer, buffer);
535 541
 						goto error;
536 542
 				}
537 543
 				break;
... ...
@@ -554,8 +560,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
554 560
 						goto endofheader;
555 561
 					default:
556 562
 						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
557
-						"in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
558
-						/* "in status %d .\n",*tmp,status); */
563
+							"in status %d: <<%.*s>> .\n",
564
+							*tmp,status, tmp-buffer, buffer);
559 565
 						goto error;
560 566
 				}
561 567
 				break;
... ...
@@ -576,8 +582,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
576 582
 						goto endofheader;
577 583
 					default:
578 584
 						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
579
-						"in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
580
-						/* "in status %d .\n",*tmp,status); */
585
+							"in status %d: <<%.*s>> .\n",
586
+							*tmp,status, tmp-buffer, buffer);
581 587
 						goto error;
582 588
 				}
583 589
 				break;
... ...
@@ -603,8 +609,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
603 609
 						goto endofheader;
604 610
 					default:
605 611
 						LOG( L_ERR , "ERROR: parse_to : unexpected char [%c] "
606
-						"in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
607
-						/* "in status %d .\n",*tmp,status); */
612
+							"in status %d: <<%.*s>> .\n",
613
+							*tmp,status, tmp-buffer, buffer);
608 614
 						goto error;
609 615
 				}
610 616
 				break;
Browse code

more noisy parser error logging

Jiri Kuthan authored on 12/03/2002 23:58:26
Showing 1 changed files
... ...
@@ -112,7 +112,7 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
112 112
 						goto endofheader;
113 113
 					default:
114 114
 						LOG( L_ERR , "ERROR: parse_to_param : "
115
-						"unexpected char [%c] in status %d .\n",*tmp,status);
115
+						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
116 116
 				}
117 117
 				break;
118 118
 			case '\r':
... ...
@@ -149,7 +149,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
149 149
 						goto endofheader;
150 150
 					default:
151 151
 						LOG( L_ERR , "ERROR: parse_to_param : "
152
-						"unexpected char [%c] in status %d .\n",*tmp,status);
152
+						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
153
+						/* "unexpected char [%c] in status %d .\n",*tmp,status); */
153 154
 						goto error;
154 155
 				}
155 156
 				break;
... ...
@@ -167,7 +168,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
167 168
 						}
168 169
 					default:
169 170
 						LOG( L_ERR , "ERROR: parse_to_param : "
170
-						"unexpected char [%c] in status %d .\n",*tmp,status);
171
+						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
172
+						/* "unexpected char [%c] in status %d .\n",*tmp,status); */
171 173
 						goto error;
172 174
 				}
173 175
 				break;
... ...
@@ -191,7 +193,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
191 193
 						goto endofheader;
192 194
 					default:
193 195
 						LOG( L_ERR , "ERROR: parse_to_param :"
194
-						"unexpected char [%c] in status %d .\n",*tmp,status);
196
+						"unexpected char [%c] in status %d: <<%.*s>> .\n",*tmp,status, tmp-buffer, buffer);
197
+						/* "unexpected char [%c] in status %d .\n",*tmp,status); */
195 198
 						goto error;
196 199
 				}
197 200
 				break;
... ...
@@ -221,7 +224,8 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
221 224
 						goto endofheader;
222 225
 					default: