Changeset 3095 for pjproject/trunk
- Timestamp:
- Feb 10, 2010 10:45:07 AM (15 years ago)
- Location:
- pjproject/trunk/pjlib-util/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/src/pjlib-util-test/http_client.c
r3089 r3095 68 68 69 69 while (!thread_quit) { 70 char *pkt = pj_pool_alloc(pool, srv->buf_size);70 char *pkt = (char*)pj_pool_alloc(pool, srv->buf_size); 71 71 pj_ssize_t pkt_len; 72 72 int rc; … … 155 155 send_size += sendsz; 156 156 157 sdata = pj_pool_alloc(pool, sendsz);157 sdata = (char*)pj_pool_alloc(pool, sendsz); 158 158 pj_create_random_string(sdata, sendsz); 159 159 pj_ansi_sprintf(sdata, "\nSegment #%d\n", ++counter); … … 419 419 #endif 420 420 421 pj_http_headers_add_elmt2(¶m.headers, "Accept", 422 "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"); 423 pj_http_headers_add_elmt2(¶m.headers, "Accept-Language", "en-sg"); 424 pj_http_headers_add_elmt2(¶m.headers, "User-Agent", 425 "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506)"); 421 pj_http_headers_add_elmt2(¶m.headers, (char*)"Accept", 422 (char*)"image/gif, image/x-xbitmap, image/jpeg, " 423 "image/pjpeg, application/x-ms-application," 424 " application/vnd.ms-xpsdocument, " 425 "application/xaml+xml, " 426 "application/x-ms-xbap, " 427 "application/x-shockwave-flash, " 428 "application/vnd.ms-excel, " 429 "application/vnd.ms-powerpoint, " 430 "application/msword, */*"); 431 pj_http_headers_add_elmt2(¶m.headers, (char*)"Accept-Language", 432 (char*)"en-sg"); 433 pj_http_headers_add_elmt2(¶m.headers, (char*)"User-Agent", 434 (char*)"Mozilla/4.0 (compatible; MSIE 7.0; " 435 "Windows NT 6.0; SLCC1; " 436 ".NET CLR 2.0.50727; " 437 ".NET CLR 3.0.04506)"); 426 438 if (pj_http_req_create(pool, &url, timer_heap, ioqueue, 427 439 ¶m, &hcb, &http_req)) … … 523 535 524 536 pj_http_req_param_default(¶m); 525 pj_strset2(¶m.method, "PUT");526 data = pj_pool_alloc(pool, length);537 pj_strset2(¶m.method, (char*)"PUT"); 538 data = (char*)pj_pool_alloc(pool, length); 527 539 pj_create_random_string(data, length); 528 540 pj_ansi_sprintf(data, "PUT test\n"); … … 613 625 614 626 pj_http_req_param_default(¶m); 615 pj_strset2(¶m.method, "PUT");627 pj_strset2(¶m.method, (char*)"PUT"); 616 628 total_size = 15383; 617 629 send_size = 0; … … 694 706 695 707 pj_http_req_param_default(¶m); 696 pj_strset2(¶m.method, "DELETE");708 pj_strset2(¶m.method, (char*)"DELETE"); 697 709 if (pj_http_req_create(pool, &url, timer_heap, ioqueue, 698 710 ¶m, &hcb, &http_req)) -
pjproject/trunk/pjlib-util/src/pjlib-util/http_client.c
r3092 r3095 57 57 }; 58 58 59 static c har *http_protocol_names[NUM_PROTOCOL] =59 static const char *http_protocol_names[NUM_PROTOCOL] = 60 60 { 61 61 "HTTP", … … 76 76 }; 77 77 78 static c har *http_method_names[3] =78 static const char *http_method_names[3] = 79 79 { 80 80 "GET", … … 156 156 } 157 157 158 static c har * get_protocol(const pj_str_t *protocol)158 static const char * get_protocol(const pj_str_t *protocol) 159 159 { 160 160 int i; … … 470 470 pj_size_t i; 471 471 char *cptr; 472 void*newdata;472 char *newdata; 473 473 pj_scanner scanner; 474 474 pj_str_t s; … … 502 502 response->content_length = -1; 503 503 504 newdata = pj_pool_alloc(pool, i);504 newdata = (char*) pj_pool_alloc(pool, i); 505 505 pj_memcpy(newdata, data, i); 506 506 … … 524 524 525 525 /* Parse the response headers. */ 526 size = i - 2 - (scanner.curptr - (char *)newdata);526 size = i - 2 - (scanner.curptr - newdata); 527 527 if (size > 0) { 528 528 status = http_headers_parse(scanner.curptr + 1, size, … … 605 605 pj_bzero(param, sizeof(*param)); 606 606 param->addr_family = pj_AF_INET(); 607 pj_strset2(¶m->method, http_method_names[HTTP_GET]);608 pj_strset2(¶m->version, HTTP_1_0);607 pj_strset2(¶m->method, (char*)http_method_names[HTTP_GET]); 608 pj_strset2(¶m->version, (char*)HTTP_1_0); 609 609 param->timeout.msec = PJ_HTTP_DEFAULT_TIMEOUT; 610 610 pj_time_val_normalize(¶m->timeout); … … 631 631 pj_scan_get_until_ch(&scanner, ':', &s); 632 632 if (!pj_stricmp2(&s, http_protocol_names[PROTOCOL_HTTP])) { 633 pj_strset2(&hurl->protocol, http_protocol_names[PROTOCOL_HTTP]); 633 pj_strset2(&hurl->protocol, 634 (char*)http_protocol_names[PROTOCOL_HTTP]); 634 635 } else if (!pj_stricmp2(&s, http_protocol_names[PROTOCOL_HTTPS])) { 635 pj_strset2(&hurl->protocol, http_protocol_names[PROTOCOL_HTTPS]); 636 pj_strset2(&hurl->protocol, 637 (char*)http_protocol_names[PROTOCOL_HTTPS]); 636 638 } else { 637 639 PJ_THROW(PJ_ENOTSUP); // unsupported protocol … … 913 915 TRACE_((THIS_FILE, "%s", pkt.ptr)); 914 916 } else { 915 pkt.ptr = hreq->param.reqdata.data;917 pkt.ptr = (char*)hreq->param.reqdata.data; 916 918 pkt.slen = hreq->param.reqdata.size; 917 919 }
Note: See TracChangeset
for help on using the changeset viewer.