• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/curl-7.21.7/tests/server/

Lines Matching refs:req

123 static int ProcessRequest(struct httprequest *req);
314 static int ProcessRequest(struct httprequest *req)
316 char *line=&req->reqbuf[req->checkindex];
328 req->testno, line);
332 if((req->testno == DOCNUMBER_NOTHING) &&
343 req->protocol = RPROT_HTTP;
346 req->protocol = RPROT_RTSP;
349 req->protocol = RPROT_NONE;
354 req->prot_version = prot_major*10 + prot_minor;
374 req->testno = DOCNUMBER_WERULEZ;
380 req->testno = DOCNUMBER_QUIT;
390 req->testno = strtol(ptr, &ptr, 10);
392 if(req->testno > 10000) {
393 req->partno = req->testno % 10000;
394 req->testno /= 10000;
397 req->partno = 0;
400 req->testno, req->partno);
403 filename = test2file(req->testno);
410 logmsg("Couldn't open test file %ld", req->testno);
411 req->open = FALSE; /* closes connection */
430 req->open = FALSE; /* closes connection */
440 req->auth_req = TRUE;
444 req->rcmd = RCMD_IDLE;
445 req->open = TRUE;
449 req->rcmd = RCMD_STREAM;
456 req->pipe = num-1; /* decrease by one since we don't count the
461 req->skip = num;
466 if(rtp_partno == req->partno) {
488 if(req->rtp_buffer == NULL) {
489 req->rtp_buffer = rtp_scratch;
490 req->rtp_buffersize = rtp_size + 4;
492 req->rtp_buffer = realloc(req->rtp_buffer, req->rtp_buffersize + rtp_size + 4);
493 memcpy(req->rtp_buffer + req->rtp_buffersize, rtp_scratch, rtp_size + 4);
494 req->rtp_buffersize += rtp_size + 4;
497 logmsg("rtp_buffersize is %zu, rtp_size is %d.", req->rtp_buffersize, rtp_size);
518 if(sscanf(req->reqbuf, "CONNECT %" MAXDOCNAMELEN_TXT "s HTTP/%d.%d",
524 if(req->prot_version == 10)
525 req->open = FALSE; /* HTTP 1.0 closes connection by default */
529 req->testno = DOCNUMBER_BADCONNECT;
535 req->testno = strtol(portp+1, NULL, 10);
537 req->testno = DOCNUMBER_CONNECT;
540 req->testno = DOCNUMBER_CONNECT;
544 req->testno = DOCNUMBER_404;
556 if(req->pipe)
559 req->checkindex += (end - line) + strlen(END_OF_HEADERS);
576 if((req->cl==0) && curlx_strnequal("Content-Length:", line, 15)) {
592 req->open = FALSE; /* closes connection */
595 req->cl = clen - req->skip;
598 if(req->skip)
599 logmsg("... but will abort after %zu bytes", req->cl);
609 if(strstr(req->reqbuf, "\r\n0\r\n\r\n"))
622 if(!req->auth && strstr(req->reqbuf, "Authorization:")) {
623 req->auth = TRUE; /* Authorization: header present! */
624 if(req->auth_req)
628 if(!req->digest && strstr(req->reqbuf, "Authorization: Digest")) {
632 req->partno += 1000;
633 req->digest = TRUE; /* header found */
634 logmsg("Received Digest request, sending back data %ld", req->partno);
636 else if(!req->ntlm &&
637 strstr(req->reqbuf, "Authorization: NTLM TlRMTVNTUAAD")) {
639 req->partno += 1002;
640 req->ntlm = TRUE; /* NTLM found */
641 logmsg("Received NTLM type-3, sending back data %ld", req->partno);
642 if(req->cl) {
643 logmsg(" Expecting %zu POSTed bytes", req->cl);
646 else if(!req->ntlm &&
647 strstr(req->reqbuf, "Authorization: NTLM TlRMTVNTUAAB")) {
649 req->partno += 1001;
650 req->ntlm = TRUE; /* NTLM found */
651 logmsg("Received NTLM type-1, sending back data %ld", req->partno);
653 else if((req->partno >= 1000) && strstr(req->reqbuf, "Authorization: Basic")) {
657 req->partno += 1;
658 logmsg("Received Basic request, sending back data %ld", req->partno);
660 if(strstr(req->reqbuf, "Connection: close"))
661 req->open = FALSE; /* close connection after this request */
663 if(!req->pipe &&
664 req->open &&
665 req->prot_version >= 11 &&
667 req->reqbuf + req->offset > end + strlen(END_OF_HEADERS) &&
668 (!strncmp(req->reqbuf, "GET", strlen("GET")) ||
669 !strncmp(req->reqbuf, "HEAD", strlen("HEAD")))) {
672 req->checkindex = (end - req->reqbuf) + strlen(END_OF_HEADERS);
673 req->pipelining = TRUE;
676 while(req->pipe) {
680 line = &req->reqbuf[req->checkindex];
684 req->checkindex += (end - line) + strlen(END_OF_HEADERS);
685 req->pipe--;
692 if(req->auth_req && !req->auth)
695 if(req->cl > 0) {
696 if(req->cl <= req->offset - (end - req->reqbuf) - strlen(END_OF_HEADERS))
759 static int get_request(curl_socket_t sock, struct httprequest *req)
764 char *reqbuf = req->reqbuf;
770 if(req->pipelining) {
771 pipereq = reqbuf + req->checkindex;
772 pipereq_length = req->offset - req->checkindex;
777 req->checkindex = 0;
778 req->offset = 0;
779 req->testno = DOCNUMBER_NOTHING;
780 req->partno = 0;
781 req->open = TRUE;
782 req->auth_req = FALSE;
783 req->auth = FALSE;
784 req->cl = 0;
785 req->digest = FALSE;
786 req->ntlm = FALSE;
787 req->pipe = 0;
788 req->skip = 0;
789 req->rcmd = RCMD_NORMALREQ;
790 req->protocol = RPROT_NONE;
791 req->prot_version = 0;
792 req->pipelining = FALSE;
793 req->rtp_buffer = NULL;
794 req->rtp_buffersize = 0;
798 while(!done_processing && (req->offset < REQBUFSIZ-1)) {
805 if(req->skip)
809 got = sread(sock, reqbuf + req->offset, req->cl);
811 got = sread(sock, reqbuf + req->offset, REQBUFSIZ-1 - req->offset);
826 reqbuf[req->offset] = '\0';
827 storerequest(reqbuf, req->offset);
833 req->offset += (size_t)got;
834 reqbuf[req->offset] = '\0';
836 done_processing = ProcessRequest(req);
839 if(done_processing && req->pipe) {
842 req->pipe--;
846 if((req->offset == REQBUFSIZ-1) && (got > 0)) {
852 else if(req->offset > REQBUFSIZ-1) {
859 reqbuf[req->offset] = '\0';
862 storerequest(reqbuf, req->pipelining ? req->checkindex : req->offset);
870 static int send_doc(curl_socket_t sock, struct httprequest *req)
890 logmsg("Send response number %ld part %ld", req->testno, req->partno);
892 switch(req->rcmd) {
914 req->open = FALSE;
916 if(req->testno < 0) {
920 switch(req->testno) {
948 if(req->protocol == RPROT_HTTP) {
959 char *filename = test2file(req->testno);
961 if(0 != req->partno)
962 sprintf(partbuf, "data%ld", req->partno);
1073 if(req->rtp_buffer) {
1074 logmsg("About to write %zu RTP bytes", req->rtp_buffersize);
1075 count = req->rtp_buffersize;
1080 written = swrite(sock, req->rtp_buffer + (req->rtp_buffersize - count), num);
1088 free(req->rtp_buffer);
1089 req->rtp_buffersize = 0;
1162 req->open = persistant;
1164 prevtestno = req->testno;
1165 prevpartno = req->partno;
1180 struct httprequest req;
1376 req.pipelining = FALSE;
1382 if(get_request(msgsock, &req))
1388 if((req.testno == prevtestno) &&
1389 (req.partno == prevpartno)) {
1390 req.partno++;
1391 logmsg("BOUNCE part number to %ld", req.partno);
1400 send_doc(msgsock, &req);
1404 if((req.testno < 0) && (req.testno != DOCNUMBER_CONNECT)) {
1408 if(!req.open) {
1413 if(req.open)
1416 } while(req.open || (req.testno == DOCNUMBER_CONNECT));
1430 if (req.testno == DOCNUMBER_QUIT)