diff options
author | npmccallum <npmccallum@c587cffe-e639-0410-9787-d7902ae8ed56> | 2008-06-05 20:56:04 +0000 |
---|---|---|
committer | npmccallum <npmccallum@c587cffe-e639-0410-9787-d7902ae8ed56> | 2008-06-05 20:56:04 +0000 |
commit | 9a401f3d7392134859a809905b11b7bcfaeea50b (patch) | |
tree | f34c169d4e4f43546bd4404af8c69be09e30ea55 /src/lib/pac.c | |
parent | 197ba7edc0ce6f6758b198821a9c6bf7c1fd1932 (diff) | |
download | libproxy-git-libproxy-0.2.3.tar.gz |
The real 0.2.3 releaselibproxy-0.2.3
Diffstat (limited to 'src/lib/pac.c')
-rw-r--r-- | src/lib/pac.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/lib/pac.c b/src/lib/pac.c index ca32ede..9403d39 100644 --- a/src/lib/pac.c +++ b/src/lib/pac.c @@ -70,13 +70,13 @@ px_pac_new(pxURL *url) { if (!url) return NULL; - /* Allocate the object */ + // Allocate the object pxPAC *self = px_malloc0(sizeof(pxPAC)); - /* Copy the given URL */ - self->url = px_url_new(px_url_to_string(url)); /* Always returns valid value */ + // Copy the given URL + self->url = px_url_new(px_url_to_string(url)); // Always returns valid value - /* Make sure we have a real pxPAC */ + // Make sure we have a real pxPAC if (!px_pac_reload(self)) { px_pac_free(self); return NULL; } return self; @@ -90,13 +90,13 @@ px_pac_new(pxURL *url) pxPAC * px_pac_new_from_string(char *url) { - /* Create temporary URL */ + // Create temporary URL pxURL *tmpurl = px_url_new(url); if (!tmpurl) return NULL; - /* Create pac */ + // Create pac pxPAC *self = px_pac_new(tmpurl); - px_url_free(tmpurl); /* Free no longer used URL */ + px_url_free(tmpurl); // Free no longer used URL if (!self) return NULL; return self; } @@ -124,33 +124,33 @@ px_pac_reload(pxPAC *self) bool correct_mime_type; unsigned long int content_length = 0; - /* Get the pxPAC */ + // Get the pxPAC sock = px_url_get(self->url, headers); if (sock < 0) return false; - /* Verify status line */ + // Verify status line line = px_readline(sock); if (!line) goto error; - if (strncmp(line, "HTTP", strlen("HTTP"))) goto error; /* Check valid HTTP response */ - if (!strchr(line, ' ') || atoi(strchr(line, ' ') + 1) != 200) goto error; /* Check status code */ + if (strncmp(line, "HTTP", strlen("HTTP"))) goto error; // Check valid HTTP response + if (!strchr(line, ' ') || atoi(strchr(line, ' ') + 1) != 200) goto error; // Check status code - /* Check for correct mime type and content length */ + // Check for correct mime type and content length while (strcmp(line, "\r")) { - /* Check for content type */ + // Check for content type if (strstr(line, "Content-Type: ") == line && strstr(line, PAC_MIME_TYPE)) correct_mime_type = true; - /* Check for content length */ + // Check for content length else if (strstr(line, "Content-Length: ") == line) content_length = atoi(line + strlen("Content-Length: ")); - /* Get new line */ + // Get new line px_free(line); line = px_readline(sock); if (!line) goto error; } - /* Get content */ + // Get content if (!content_length || !correct_mime_type) goto error; px_free(line); line = NULL; px_free(self->cache); @@ -158,7 +158,7 @@ px_pac_reload(pxPAC *self) for (int recvd=0 ; recvd != content_length ; ) recvd += recv(sock, self->cache + recvd, content_length - recvd, 0); - /* Clean up */ + // Clean up close(sock); return true; |