| 1 |
|
| MODULE = Protocol::HTTP PACKAGE = Protocol::HTTP::Response
|
| 2 |
|
| PROTOTYPES: DISABLE
|
| 3 |
|
|
|
| 4 |
|
| BOOT {
|
| 5 |
0 |
▶ | Stash s(__PACKAGE__);
|
Branch: 1 branch
| Branch | True | False | Total |
| Stash s(__PACKAGE__);
|
0 |
0 |
0 |
|
| 6 |
0 |
▶ | s.inherit("Protocol::HTTP::Message");
|
Branch: 1 branch
| Branch | True | False | Total |
| s.inherit("Protocol::HTTP::Message");
|
0 |
0 |
0 |
|
| 7 |
0 |
▶ | xs::exp::create_constants(s, {
|
Branch: 4 branches
| Branch | True | False | Total |
| xs::exp::create_constants(s, {
|
0 |
0 |
0 |
| xs::exp::create_constants(s, {
|
0 |
0 |
0 |
| xs::exp::create_constants(s, {
|
0 |
0 |
0 |
| xs::exp::create_constants(s, {
|
0 |
0 |
0 |
|
| 8 |
|
| {"COOKIE_SAMESITE_DISABLED", int(Response::Cookie::SameSite::disabled)},
|
| 9 |
|
| {"COOKIE_SAMESITE_STRICT", int(Response::Cookie::SameSite::Strict)},
|
| 10 |
|
| {"COOKIE_SAMESITE_LAX", int(Response::Cookie::SameSite::Lax)},
|
| 11 |
|
| {"COOKIE_SAMESITE_NONE", int(Response::Cookie::SameSite::None)},
|
| 12 |
|
| });
|
| 13 |
0 |
▶ | xs::exp::autoexport(s);
|
Branch: 2 branches
| Branch | True | False | Total |
| xs::exp::autoexport(s);
|
0 |
0 |
0 |
| xs::exp::autoexport(s);
|
0 |
0 |
0 |
|
| 14 |
0 |
| }
|
| 15 |
|
|
|
| 16 |
|
| ResponseSP Response::new (Hash params = Hash()) {
|
| 17 |
0 |
| RETVAL = make_backref<Response>();
|
| 18 |
0 |
▶ | if (params) fill(RETVAL, params);
|
Branch: 1 branch
| Branch | True | False | Total |
| if (params) fill(RETVAL, params);
|
0 |
0 |
0 |
|
| 19 |
0 |
▶ | }
|
Branch: 1 branch
| Branch | True | False | Total |
| }
|
0 |
0 |
0 |
|
| 20 |
0 |
▶ |
|
Branch: 2 branches
| Branch | True | False | Total |
|
|
0 |
0 |
0 |
|
|
0 |
0 |
0 |
|
| 21 |
|
| int Response::code (SV* newval = NULL) {
|
| 22 |
0 |
▶ | if (newval) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (newval) {
|
0 |
0 |
0 |
|
| 23 |
0 |
| THIS->code = SvIV(newval);
|
| 24 |
0 |
| XSRETURN_UNDEF;
|
| 25 |
|
| }
|
| 26 |
0 |
▶ | RETVAL = THIS->code;
|
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = THIS->code;
|
0 |
0 |
0 |
|
| 27 |
|
| }
|
| 28 |
|
|
|
| 29 |
|
| string Response::message (SV* newval = NULL) {
|
| 30 |
0 |
▶ | if (newval) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (newval) {
|
0 |
0 |
0 |
|
| 31 |
0 |
▶ | THIS->message = xs::in<string>(newval);
|
Branch: 2 branches
| Branch | True | False | Total |
| THIS->message = xs::in<string>(newval);
|
0 |
0 |
0 |
| THIS->message = xs::in<string>(newval);
|
0 |
0 |
0 |
|
| 32 |
0 |
| XSRETURN_UNDEF;
|
| 33 |
|
| }
|
| 34 |
0 |
▶ | RETVAL = THIS->message;
|
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = THIS->message;
|
0 |
0 |
0 |
|
| 35 |
|
| }
|
| 36 |
|
|
|
| 37 |
0 |
▶ | string Response::to_string (Request* req = nullptr) |
Branch: 2 branches
| Branch | True | False | Total |
| string Response::to_string (Request* req = nullptr) |
0 |
0 |
0 |
| string Response::to_string (Request* req = nullptr) |
0 |
0 |
0 |
|
| 38 |
|
| |
| 39 |
|
| string Response::message_for_code (int code = 0) { |
| 40 |
0 |
▶ | RETVAL = THIS->message_for_code(code ? code : THIS->code); |
Branch: 3 branches
| Branch | True | False | Total |
| RETVAL = THIS->message_for_code(code ? code : THIS->code); |
0 |
0 |
0 |
| RETVAL = THIS->message_for_code(code ? code : THIS->code); |
0 |
0 |
0 |
| RETVAL = THIS->message_for_code(code ? code : THIS->code); |
0 |
0 |
0 |
|
| 41 |
|
| } |
| 42 |
|
| |
| 43 |
|
| Hash Response::cookies (Hash new_cookies = Hash()) {
|
| 44 |
0 |
▶ | if (new_cookies) {
|
Branch: 1 branch
| Branch | True | False | Total |
| if (new_cookies) {
|
0 |
0 |
0 |
|
| 45 |
0 |
▶ | set_response_cookies(THIS, new_cookies);
|
Branch: 1 branch
| Branch | True | False | Total |
| set_response_cookies(THIS, new_cookies);
|
0 |
0 |
0 |
|
| 46 |
0 |
| XSRETURN_UNDEF;
|
| 47 |
|
| }
|
| 48 |
|
|
|
| 49 |
0 |
▶ | RETVAL = Hash::create(THIS->cookies.size());
|
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = Hash::create(THIS->cookies.size());
|
0 |
0 |
0 |
|
| 50 |
0 |
▶ | for (const auto& elem : THIS->cookies.fields) RETVAL.store(elem.name, xs::out(elem.value));
|
Branch: 3 branches
| Branch | True | False | Total |
| for (const auto& elem : THIS->cookies.fields) RETVAL.store(elem.name, xs::out(elem.value));
|
0 |
0 |
0 |
| for (const auto& elem : THIS->cookies.fields) RETVAL.store(elem.name, xs::out(elem.value));
|
0 |
0 |
0 |
| for (const auto& elem : THIS->cookies.fields) RETVAL.store(elem.name, xs::out(elem.value));
|
0 |
0 |
0 |
|
| 51 |
|
| }
|
| 52 |
|
|
|
| 53 |
|
| Response::Cookie Response::cookie (string_view name, SV* val = nullptr) {
|
| 54 |
0 |
| if (val) {
|
| 55 |
0 |
▶ | if (!SvOK(val)) THIS->cookies.remove(name);
|
Branch: 1 branch
| Branch | True | False | Total |
| if (!SvOK(val)) THIS->cookies.remove(name);
|
0 |
0 |
0 |
|
| 56 |
0 |
▶ | else THIS->cookies.set(string(name), xs::in<Response::Cookie>(val));
|
Branch: 2 branches
| Branch | True | False | Total |
| else THIS->cookies.set(string(name), xs::in<Response::Cookie>(val));
|
0 |
0 |
0 |
| else THIS->cookies.set(string(name), xs::in<Response::Cookie>(val));
|
0 |
0 |
0 |
|
| 57 |
0 |
▶ | XSRETURN_UNDEF;
|
Branch: 3 branches
| Branch | True | False | Total |
| XSRETURN_UNDEF;
|
0 |
0 |
0 |
| XSRETURN_UNDEF;
|
0 |
0 |
0 |
| XSRETURN_UNDEF;
|
0 |
0 |
0 |
|
| 58 |
0 |
| }
|
| 59 |
|
|
|
| 60 |
|
| auto it = THIS->cookies.find(name);
|
| 61 |
0 |
▶ | if (it == THIS->cookies.end()) XSRETURN_UNDEF;
|
Branch: 1 branch
| Branch | True | False | Total |
| if (it == THIS->cookies.end()) XSRETURN_UNDEF;
|
0 |
0 |
0 |
|
| 62 |
0 |
▶ | RETVAL = it->value;
|
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = it->value;
|
0 |
0 |
0 |
|
| 63 |
0 |
▶ | }
|
Branch: 1 branch
| Branch | True | False | Total |
| }
|
0 |
0 |
0 |
|
| 64 |
|
|
|