Lines Matching refs:Proxy
27 * @brief SPDY part of the proxy. libspdylay is used for the client side.
76 struct Proxy *proxy = (struct Proxy *)(source->ptr);
86 if(!proxy->received_body_size)//nothing to write now
88 if(proxy->receiving_done)
97 if(length >= proxy->received_body_size)
99 ret = proxy->received_body_size;
105 if(NULL == (newbody = malloc(proxy->received_body_size - length)))
110 memcpy(newbody, proxy->received_body + length, proxy->received_body_size - length);
112 memcpy(buf, proxy->received_body, ret);
113 free(proxy->received_body);
114 proxy->received_body = newbody;
115 proxy->received_body_size -= ret;
117 if(0 == proxy->received_body_size && proxy->receiving_done)
294 struct Proxy *proxy;
299 proxy = spdylay_session_get_stream_user_data(session, stream_id);
300 proxy->stream_id = stream_id;
302 ++proxy->spdy_connection->streams_opened;
303 PRINT_INFO2("opening stream: str open %i; %s", glob_opt.streams_opened, proxy->url);
330 struct Proxy * proxy;
349 proxy = spdylay_session_get_stream_user_data(session, stream_id);
350 if(NULL == proxy)
354 //DIE("no proxy obj");
359 PRINT_INFO2("received headers for %s", proxy->url);
360 http_create_response(proxy, nv);
363 PRINT_INFO2("received reset stream for %s", proxy->url);
364 proxy->spdy_error = true;
367 PRINT_INFO2("received headers for %s", proxy->url);
368 http_create_response(proxy, nv);
394 struct Proxy * proxy = spdylay_session_get_stream_user_data(session, stream_id);
396 assert(NULL != proxy);
399 --proxy->spdy_connection->streams_opened;
400 PRINT_INFO2("closing stream: str opened %i; remove proxy %i", glob_opt.streams_opened, proxy->id);
402 DLL_remove(proxy->spdy_connection->proxies_head, proxy->spdy_connection->proxies_tail, proxy);
403 if(proxy->http_active)
405 proxy->spdy_active = false;
409 free_proxy(proxy);
429 struct Proxy *proxy;
430 proxy = spdylay_session_get_stream_user_data(session, stream_id);
432 if(NULL == proxy)
434 PRINT_INFO("proxy in spdy_cb_on_data_chunk_recv is NULL)");
438 if(!copy_buffer(data, len, &proxy->http_body, &proxy->http_body_size))
445 if(NULL == proxy->http_body)
446 proxy->http_body = au_malloc(len);
448 proxy->http_body = realloc(proxy->http_body, proxy->http_body_size + len);
449 if(NULL == proxy->http_body)
455 memcpy(proxy->http_body + proxy->http_body_size, data, len);
456 proxy->http_body_size += len;
458 PRINT_INFO2("received data for %s; %zu bytes", proxy->url, len);
475 struct Proxy *proxy;
476 proxy = spdylay_session_get_stream_user_data(session, stream_id);
477 proxy->done = true;
478 PRINT_INFO2("last data frame received for %s", proxy->url);
815 struct Proxy *proxy;
816 struct Proxy *proxy_next;
820 for(proxy = connection->proxies_head; NULL != proxy; proxy=proxy_next)
822 proxy_next = proxy->next;
823 DLL_remove(connection->proxies_head, connection->proxies_tail, proxy);
824 proxy->spdy_active = false;
825 proxy->spdy_error = true;
826 PRINT_INFO2("spdy_free_connection for id %i", proxy->id);
827 if(!proxy->http_active)
829 free_proxy(proxy);
843 struct Proxy *proxy,
860 if(0 == strcasecmp(proxy->uri->host, connection->host))
868 port = proxy->uri->port;
870 connection = spdy_connect(proxy->uri, port, true);
883 PRINT_INFO("there is no proxy!");
887 proxy->spdy_connection = connection;
890 post_data.source.ptr = proxy;
892 ret = spdylay_submit_request(connection->session, 0, nv, &post_data, proxy);
895 ret = spdylay_submit_request(connection->session, 0, nv, NULL, proxy);
900 PRINT_INFO2("adding proxy %i", proxy->id);
902 PRINT_INFO2("before proxy %i", connection->proxies_head->id);
903 DLL_insert(connection->proxies_head, connection->proxies_tail, proxy);
916 struct Proxy *proxy;
930 for(proxy = glob_opt.spdy_connection->proxies_head; NULL != proxy; proxy=proxy->next)
933 DLL_remove(glob_opt.spdy_connection->proxies_head, glob_opt.spdy_connection->proxies_tail, proxy);
934 proxy->spdy_active = false;
960 for(proxy = connection->proxies_head; NULL != proxy; proxy=proxy->next)
963 DLL_remove(connection->proxies_head, connection->proxies_tail, proxy);
964 proxy->spdy_active = false;
1062 struct Proxy *proxy;
1089 for(proxy = connections[i]->proxies_head; NULL != proxy; proxy=proxy->next)
1092 DLL_remove(connections[i]->proxies_head, connections[i]->proxies_tail, proxy);
1093 proxy->spdy_active = false;
1094 proxy->spdy_error = true;
1095 PRINT_INFO2("spdy_free_connection for id %i", proxy->id);