Mercurial > hg > nginx
comparison src/core/ngx_conf_file.c @ 2216:d17c487ddb52
too long parameter error
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 26 Aug 2008 21:10:20 +0000 |
parents | 853fc7a46792 |
children | 31fda45f696f |
comparison
equal
deleted
inserted
replaced
2215:fabe9ecb099f | 2216:d17c487ddb52 |
---|---|
434 { | 434 { |
435 u_char *start, ch, *src, *dst; | 435 u_char *start, ch, *src, *dst; |
436 size_t len; | 436 size_t len; |
437 ssize_t n; | 437 ssize_t n; |
438 ngx_uint_t found, need_space, last_space, sharp_comment, variable; | 438 ngx_uint_t found, need_space, last_space, sharp_comment, variable; |
439 ngx_uint_t quoted, s_quoted, d_quoted; | 439 ngx_uint_t quoted, s_quoted, d_quoted, start_line; |
440 ngx_str_t *word; | 440 ngx_str_t *word; |
441 ngx_buf_t *b; | 441 ngx_buf_t *b; |
442 | 442 |
443 found = 0; | 443 found = 0; |
444 need_space = 0; | 444 need_space = 0; |
448 quoted = s_quoted = d_quoted = 0; | 448 quoted = s_quoted = d_quoted = 0; |
449 | 449 |
450 cf->args->nelts = 0; | 450 cf->args->nelts = 0; |
451 b = cf->conf_file->buffer; | 451 b = cf->conf_file->buffer; |
452 start = b->pos; | 452 start = b->pos; |
453 start_line = cf->conf_file->line; | |
453 | 454 |
454 for ( ;; ) { | 455 for ( ;; ) { |
455 | 456 |
456 if (b->pos >= b->last) { | 457 if (b->pos >= b->last) { |
457 | 458 |
474 } | 475 } |
475 | 476 |
476 return NGX_CONF_FILE_DONE; | 477 return NGX_CONF_FILE_DONE; |
477 } | 478 } |
478 | 479 |
479 if (b->pos - start) { | 480 len = b->pos - start; |
480 ngx_memcpy(b->start, start, b->pos - start); | 481 |
481 } | 482 if (len == ngx_pagesize) { |
482 | 483 cf->conf_file->line = start_line; |
483 n = ngx_read_file(&cf->conf_file->file, | 484 |
484 b->start + (b->pos - start), | 485 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
485 b->end - (b->start + (b->pos - start)), | 486 "too long parameter \"%*s...\" started", |
487 10, start); | |
488 return NGX_ERROR; | |
489 } | |
490 | |
491 if (len) { | |
492 ngx_memcpy(b->start, start, len); | |
493 } | |
494 | |
495 n = ngx_read_file(&cf->conf_file->file, b->start + len, | |
496 b->end - (b->start + len), | |
486 cf->conf_file->file.offset); | 497 cf->conf_file->file.offset); |
487 | 498 |
488 if (n == NGX_ERROR) { | 499 if (n == NGX_ERROR) { |
489 return NGX_ERROR; | 500 return NGX_ERROR; |
490 } | 501 } |
491 | 502 |
492 b->pos = b->start + (b->pos - start); | 503 b->pos = b->start + len; |
504 b->last = b->pos + n; | |
493 start = b->start; | 505 start = b->start; |
494 b->last = b->pos + n; | |
495 } | 506 } |
496 | 507 |
497 ch = *b->pos++; | 508 ch = *b->pos++; |
498 | 509 |
499 if (ch == LF) { | 510 if (ch == LF) { |
543 if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) { | 554 if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) { |
544 continue; | 555 continue; |
545 } | 556 } |
546 | 557 |
547 start = b->pos - 1; | 558 start = b->pos - 1; |
559 start_line = cf->conf_file->line; | |
548 | 560 |
549 switch (ch) { | 561 switch (ch) { |
550 | 562 |
551 case ';': | 563 case ';': |
552 case '{': | 564 case '{': |