MCPcopy Create free account
hub / github.com/acl-dev/acl / mime_state_head

Function mime_state_head

lib_acl_cpp/src/mime/internal/mime_state_parse.cpp:513–610  ·  view source on GitHub ↗

�����ʼ�ͷ�� multipart �����ֵ�ͷ

Source from the content-addressed store, hash-verified

511
512// �����ʼ�ͷ�� multipart �����ֵ�ͷ
513static int mime_state_head(MIME_STATE *state, const char *s, int n)
514{
515 MIME_NODE *node = state->curr_node;
516
517 if (n <= 0)
518 return n;
519
520 /* �����δ�ҵ����з�������� */
521
522 if (node->last_lf != '\n') {
523 while (n > 0) {
524 node->last_ch = *s;
525 ADDCH(node->buffer, node->last_ch);
526 n--;
527 state->curr_off++;
528
529 if (node->last_ch == '\n') {
530 node->last_lf = '\n';
531 break;
532 }
533 s++;
534 }
535
536 return n;
537 }
538
539 /* ��������Ի��п�ʼ�� ˵����ǰ���ʼ�ͷ���� */
540
541 if (*s == '\n') {
542 /* �ϴ�����Ϊ: \n\r �� \n */
543
544 state->curr_off++;
545 node->header_end = state->curr_off;
546
547 if (LEN(node->buffer) > 0) {
548 /* ����ͷ�������һ������ */
549 mime_header_line(node);
550 node->valid_line++;
551 }
552
553 /* �Թ���ͷ���õĿ��� */
554 if (node->valid_line == 0)
555 return 0;
556
557 /* �����ǰ���Ϊ multipart ��ʽ, ������ state->curr_bound */
558 if (node->boundary != NULL)
559 state->curr_bound = STR(node->boundary);
560 state->curr_status = MIME_S_BODY;
561 node->body_begin = state->curr_off;
562 return n - 1;
563 }
564 if (*s == '\r') {
565 state->curr_off++;
566 if (node->last_ch == '\r') {
567 /* XXX: ������ \n\r\r ���� */
568 node->last_ch = '\r';
569 node->last_lf = 0;
570 return n - 1;

Callers

nothing calls this directly

Calls 1

mime_header_lineFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…