HTTP-GHTTP

 view release on metacpan or  search on metacpan

GHTTP.xs  view on Meta::CPAN


#ifdef HAVE_GHTTP_GET_HEADER_NAMES

void
get_headers(self)
        ghttp_request *self
    PREINIT:
        char **hdrs;
        int num_hdrs;
        int i;
    PPCODE:
        if (ghttp_get_header_names(self, &hdrs, &num_hdrs) == -1) {
            XSRETURN_UNDEF;
        }
        
        EXTEND(SP, num_hdrs);
        
        for (i = 0; i < num_hdrs; i++) {
            PUSHs(sv_2mortal(newSVpv(hdrs[i], 0)));
            free(hdrs[i]);
        }

GHTTP.xs  view on Meta::CPAN

        RETVAL = ghttp_get_socket(self);
    OUTPUT:
        RETVAL

void
get_status(self)
        ghttp_request *self
    PREINIT:
        int code;
        const char *reason;
    PPCODE:
        code = ghttp_status_code(self);
        reason = ghttp_reason_phrase(self);
        EXTEND(SP, 2);
        PUSHs(sv_2mortal(newSViv(code)));
       if (reason == NULL)
               reason="NULL";
               PUSHs(sv_2mortal(newSVpv((char*)reason, 0)));

void
current_status(self)
        ghttp_request *self
    PREINIT:
        ghttp_current_status status;
    PPCODE:
        status = ghttp_get_status(self);
        EXTEND(SP, 3);
        PUSHs(sv_2mortal(newSViv(status.proc)));
        PUSHs(sv_2mortal(newSViv(status.bytes_read)));
        PUSHs(sv_2mortal(newSViv(status.bytes_total)));

int
set_async(self)
        ghttp_request *self
    CODE:



( run in 0.571 second using v1.01-cache-2.11-cpan-5511b514fd6 )