nxt_php_sapi.c (688:87c5df028b0a) nxt_php_sapi.c (703:2d536dde84d2)
1
2/*
3 * Copyright (C) Max Romanov
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include "php.h"

--- 621 unchanged lines hidden (view full) ---

630 do { \
631 rc = (S); \
632 if (nxt_slow_path(rc != NXT_OK)) { \
633 goto fail; \
634 } \
635 } while(0)
636
637 if (SG(request_info).no_headers == 1) {
1
2/*
3 * Copyright (C) Max Romanov
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include "php.h"

--- 621 unchanged lines hidden (view full) ---

630 do { \
631 rc = (S); \
632 if (nxt_slow_path(rc != NXT_OK)) { \
633 goto fail; \
634 } \
635 } while(0)
636
637 if (SG(request_info).no_headers == 1) {
638 RC(nxt_php_write(ctx, default_repsonse, sizeof(default_repsonse) - 1,
639 1, 0));
638 RC(nxt_php_write(ctx, default_repsonse, nxt_length(default_repsonse),
639 1, 0));
640 return SAPI_HEADER_SENT_SUCCESSFULLY;
641 }
642
643 if (SG(sapi_headers).http_status_line) {
644 status = (u_char *) SG(sapi_headers).http_status_line;
645 len = nxt_strlen(status);
646
647 if (len < 12) {

--- 7 unchanged lines hidden (view full) ---

655 status = nxt_sprintf(buf, buf + sizeof(buf), "%03d",
656 SG(sapi_headers).http_response_code);
657 len = status - buf;
658
659 RC(nxt_php_write(ctx, status_200, sizeof(status_200) - 4, 0, 0));
660 RC(nxt_php_write(ctx, buf, len, 0, 0));
661
662 } else {
640 return SAPI_HEADER_SENT_SUCCESSFULLY;
641 }
642
643 if (SG(sapi_headers).http_status_line) {
644 status = (u_char *) SG(sapi_headers).http_status_line;
645 len = nxt_strlen(status);
646
647 if (len < 12) {

--- 7 unchanged lines hidden (view full) ---

655 status = nxt_sprintf(buf, buf + sizeof(buf), "%03d",
656 SG(sapi_headers).http_response_code);
657 len = status - buf;
658
659 RC(nxt_php_write(ctx, status_200, sizeof(status_200) - 4, 0, 0));
660 RC(nxt_php_write(ctx, buf, len, 0, 0));
661
662 } else {
663 RC(nxt_php_write(ctx, status_200, sizeof(status_200) - 1, 0, 0));
663 RC(nxt_php_write(ctx, status_200, nxt_length(status_200), 0, 0));
664 }
665
664 }
665
666 RC(nxt_php_write(ctx, cr_lf, sizeof(cr_lf) - 1, 0, 0));
666 RC(nxt_php_write(ctx, cr_lf, nxt_length(cr_lf), 0, 0));
667
668 h = zend_llist_get_first_ex(&sapi_headers->headers, &zpos);
669
670 while (h) {
671 RC(nxt_php_write(ctx, (u_char *) h->header, h->header_len, 0, 0));
667
668 h = zend_llist_get_first_ex(&sapi_headers->headers, &zpos);
669
670 while (h) {
671 RC(nxt_php_write(ctx, (u_char *) h->header, h->header_len, 0, 0));
672 RC(nxt_php_write(ctx, cr_lf, sizeof(cr_lf) - 1, 0, 0));
672 RC(nxt_php_write(ctx, cr_lf, nxt_length(cr_lf), 0, 0));
673
674 h = zend_llist_get_next_ex(&sapi_headers->headers, &zpos);
675 }
676
673
674 h = zend_llist_get_next_ex(&sapi_headers->headers, &zpos);
675 }
676
677 RC(nxt_php_write(ctx, cr_lf, sizeof(cr_lf) - 1, 1, 0));
677 RC(nxt_php_write(ctx, cr_lf, nxt_length(cr_lf), 1, 0));
678
679#undef RC
680
681 return SAPI_HEADER_SENT_SUCCESSFULLY;
682
683fail:
684
685 // TODO handle NXT_AGAIN

--- 185 unchanged lines hidden ---
678
679#undef RC
680
681 return SAPI_HEADER_SENT_SUCCESSFULLY;
682
683fail:
684
685 // TODO handle NXT_AGAIN

--- 185 unchanged lines hidden ---