Example #1
0
static void *comic_thread(void *arg)
{
	struct connection *conn = arg;
	int http_status_code;

	start_one_comic(conn);

again:
	curl_easy_perform(conn->curl);

	curl_easy_getinfo(conn->curl, CURLINFO_RESPONSE_CODE, &http_status_code);

	if (http_status_code == 200) {
		if (conn->regexp && !conn->matched) {
			if (process_html(conn))
				fail_connection(conn);
			else
				goto again;
		} else
			close_connection(conn);
	} else {
	}

	return NULL;
}
Example #2
0
static void msg_done(CURL *curl)
{
	struct connection *conn;
	int http_status_code;

	curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_status_code);
	curl_easy_getinfo(curl, CURLINFO_PRIVATE, &conn);

	if (http_status_code == 200) {
		if (conn->regexp && !conn->matched) {
			if (process_html(conn))
				fail_connection(conn);
		} else
			close_connection(conn);
	} else {
		fprintf(stderr, "GET %s returned %d\n", conn->url, http_status_code);
		fail_connection(conn);
	}
}
Example #3
0
static int do_process_html(struct connection *conn)
{
	/* for reused sockets we must close any gzip connection */
	gzip_free(conn);
	return process_html(conn);
}