diff options
author | tron <tron@pkgsrc.org> | 2002-10-12 15:32:15 +0000 |
---|---|---|
committer | tron <tron@pkgsrc.org> | 2002-10-12 15:32:15 +0000 |
commit | 2c1a79550d94976ae2ddc5c487d6236b1e17d806 (patch) | |
tree | 198927851233c0951afdce4aef941ee172673ee9 /misc | |
parent | 7aa45ae4453b492f867c91cc763b387688fd325d (diff) | |
download | pkgsrc-2c1a79550d94976ae2ddc5c487d6236b1e17d806.tar.gz |
Fix bugs in HTTP protocol handling:
1.) Send correct "Host:" entity-header if a proxy is used.
2.) Supply a more appropriate User Agent intetification.
3.) Use a "POST" for request for the actual bid like the eBay form would.
Bump package revision to 2.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/bidwatcher/Makefile | 4 | ||||
-rw-r--r-- | misc/bidwatcher/distinfo | 5 | ||||
-rw-r--r-- | misc/bidwatcher/patches/patch-ab | 22 | ||||
-rw-r--r-- | misc/bidwatcher/patches/patch-ac | 99 | ||||
-rw-r--r-- | misc/bidwatcher/patches/patch-ad | 76 |
5 files changed, 203 insertions, 3 deletions
diff --git a/misc/bidwatcher/Makefile b/misc/bidwatcher/Makefile index 3818cc0d2bb..4ad4a9123c0 100644 --- a/misc/bidwatcher/Makefile +++ b/misc/bidwatcher/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.14 2002/10/12 12:25:55 tron Exp $ +# $NetBSD: Makefile,v 1.15 2002/10/12 15:32:15 tron Exp $ DISTNAME= bidwatcher-1.3.5 CATEGORIES= misc -PKGREVISION= 1 +PKGREVISION= 2 MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=bidwatcher/} PATCHFILES= bidwatcher-1.3.5-p1.diff diff --git a/misc/bidwatcher/distinfo b/misc/bidwatcher/distinfo index f07659bc33d..3d67c355513 100644 --- a/misc/bidwatcher/distinfo +++ b/misc/bidwatcher/distinfo @@ -1,7 +1,10 @@ -$NetBSD: distinfo,v 1.14 2002/10/12 12:25:55 tron Exp $ +$NetBSD: distinfo,v 1.15 2002/10/12 15:32:15 tron Exp $ SHA1 (bidwatcher-1.3.5.tar.gz) = ac214aec04bb5cd7a3ba44b7b260c8f4a6b20b4a Size (bidwatcher-1.3.5.tar.gz) = 146807 bytes SHA1 (bidwatcher-1.3.5-p1.diff) = f1173d61c6bd592b0db404a5e8ae05bd5e793423 Size (bidwatcher-1.3.5-p1.diff) = 2131 bytes SHA1 (patch-aa) = e0efcb1b5f5c07b01cb53ae2d76de25b70eab370 +SHA1 (patch-ab) = a42d928e6da968bb2abdc00683c598813c9fb9a9 +SHA1 (patch-ac) = 1c2def19e1ebba85dc5e314a332097cd1570facd +SHA1 (patch-ad) = 6001a5af42a27dbac556db52c7082c53a55af646 diff --git a/misc/bidwatcher/patches/patch-ab b/misc/bidwatcher/patches/patch-ab new file mode 100644 index 00000000000..04f343f0bc5 --- /dev/null +++ b/misc/bidwatcher/patches/patch-ab @@ -0,0 +1,22 @@ +$NetBSD: patch-ab,v 1.3 2002/10/12 15:32:15 tron Exp $ + +--- bidwatcher.h.orig Mon Sep 9 15:57:24 2002 ++++ bidwatcher.h Sat Oct 12 16:41:22 2002 +@@ -100,7 +100,7 @@ + struct URL { + struct hostent *hostinfo; + unsigned int port; +- char url[256]; ++ char url[256], hoststring[256]; + bool useproxy; + int numaliases; + int numaddrs; +@@ -331,7 +331,7 @@ + void translate_date(char *date); + bool GetAucInfo(char *Buff, struct auctioninfo *NewAuction); + int calcTimeDiff (char *buffer); +-int fetchURL(URL *url, char **Buff, double timeOut); ++int fetchURL(URL *url, int Post, char **Buff, double timeOut); + char *stristr(const char *haystack, const char *needle); + char translate_special(const char *input, int *len); + diff --git a/misc/bidwatcher/patches/patch-ac b/misc/bidwatcher/patches/patch-ac new file mode 100644 index 00000000000..4ba13261a0c --- /dev/null +++ b/misc/bidwatcher/patches/patch-ac @@ -0,0 +1,99 @@ +$NetBSD: patch-ac,v 1.4 2002/10/12 15:32:15 tron Exp $ + +--- netstuff.cpp.orig Sat Oct 12 16:16:49 2002 ++++ netstuff.cpp Sat Oct 12 16:49:10 2002 +@@ -34,6 +34,7 @@ + #include <time.h> + #include <netinet/in.h> + #include <sys/socket.h> ++#include <sys/utsname.h> + #include <netdb.h> + #include <gtk/gtk.h> + #include "bidwatcher.h" +@@ -51,7 +52,7 @@ + g_free(ustring); + + char *HtmlBuff; +- fetchURL(url,&HtmlBuff,TIMEOUT); ++ fetchURL(url,0,&HtmlBuff,TIMEOUT); + char *adultcookie=strstr(HtmlBuff,"Set-Cookie"); + if (adultcookie==NULL) { + printf("adult cookie not found\n"); +@@ -143,16 +144,16 @@ + } + + void URL::create(char *newurl,URL *proxy) { ++ char *hostoff = strstr(newurl, "://") + 3; ++ ++ sprintf(hoststring, "%.*s", strcspn(hostoff, "/"), hostoff); + if (proxy == NULL) { +- char *hostoff = strstr(newurl, "://") + 3; + char tmpstr[256]; + + useproxy = FALSE; + +- strncpy(tmpstr, hostoff, strcspn(hostoff, "/")); +- tmpstr[strcspn(hostoff, "/")] = '\0'; +- +- if (strlen(tmpstr) < strlen(newurl)) { ++ strcpy(tmpstr, hoststring); ++ if (strlen(tmpstr) < strlen(hostoff)) { + strcpy(url, hostoff + strlen(tmpstr)); + } else url[0] = '\0'; + +@@ -235,13 +236,17 @@ + else return FALSE; + } + +-int fetchURL(URL *url, char **Buff, double timeOut) ++int fetchURL(URL *url, int Post, char **Buff, double timeOut) + { + int buffLength,recerr; + int socketID; ++ char UserAgent[256]; ++ char *Host; + char lineBuff[1024]; + char htmlBuff[HUGEBUFF]; + ++ struct utsname utsbuf; ++ + struct sockaddr_in soc_in; + int err; + fd_set fds; +@@ -331,9 +336,26 @@ + return NET_NETERROR; + } + ++ if (uname(&utsbuf) < 0) ++ UserAgent[0] = '\0'; ++ else ++ sprintf(UserAgent, "User-Agent: Mozilla/5.0 (X11; U; %s %s; en-US; rv:1.1) Gecko/20020912\r\n", utsbuf.sysname, utsbuf.machine); ++ + // send our request for the web page. + // XXX: Took out the cookie for now cuz we're not yet using it. +- sprintf(lineBuff, "GET %s HTTP/1.1\r\nConnection: close\r\nHost: %s\r\nUser-Agent: bidwatcher\r\n\r\n", url->url, url->hostinfo->h_name); ++ if (Post) { ++ int URLLen; ++ char *Args; ++ ++ URLLen = strcspn(url->url, "?"); ++ Args = &url->url[URLLen]; ++ if (*Args != '\0') ++ Args++; ++ ++ sprintf(lineBuff, "POST %.*s HTTP/1.1\r\nConnection: close\r\nHost: %s\r\nContent-Length: %d\r\n%s\r\n%s", URLLen, url->url, url->hoststring, strlen(Args), UserAgent, Args); ++ } else { ++ sprintf(lineBuff, "GET %s HTTP/1.1\r\nConnection: close\r\nHost: %s\r\n%s\r\n", url->url, url->hoststring, UserAgent); ++ } + + if (send(socketID, lineBuff, strlen(lineBuff), 0) < 0) { + #ifdef DEBUG_NETWORK +@@ -406,7 +428,7 @@ + if (checkredir(url,htmlBuff)) { + g_free(time_since_pkt); + g_free(time_since_start); +- return fetchURL(url, Buff, timeOut); ++ return fetchURL(url, 0, Buff, timeOut); + } else { + if (!goodcall) { + g_free(time_since_pkt); diff --git a/misc/bidwatcher/patches/patch-ad b/misc/bidwatcher/patches/patch-ad new file mode 100644 index 00000000000..6ea5f66dd24 --- /dev/null +++ b/misc/bidwatcher/patches/patch-ad @@ -0,0 +1,76 @@ +$NetBSD: patch-ad,v 1.3 2002/10/12 15:32:16 tron Exp $ + +--- bidwatcher.cpp.orig Sat Oct 12 17:17:13 2002 ++++ bidwatcher.cpp Sat Oct 12 17:18:32 2002 +@@ -582,7 +582,7 @@ + bidurl = new URL(ustring, proxyurl); + g_free(ustring); + +- int returnVal = fetchURL(bidurl, &Buff, TIMEOUT); ++ int returnVal = fetchURL(bidurl, 1, &Buff, TIMEOUT); + if (returnVal != 1) { + if (returnVal == 2) + showError("Could not obtain bid key: a network error occurred."); +@@ -662,7 +662,7 @@ + + g_free(url); + +- retval = fetchURL(bidurl, &Buff, TIMEOUT); ++ retval = fetchURL(bidurl, 1, &Buff, TIMEOUT); + + if (retval != NET_SUCCESS) { + sprintf(lineBuff,"Bid on %lu FAILED: Error %d connecting to eBay", +@@ -869,7 +869,7 @@ + "ReturnUserEmail&requested=%s&userid=%s&pass=%s&iid=%s", + name,authID,authPASS,auctionid); + URL *emailurl=new URL(WebPage,proxyurl); +- int err = fetchURL(emailurl,&Buff,TIMEOUT); ++ int err = fetchURL(emailurl,0,&Buff,TIMEOUT); + delete(emailurl); + if ((err == 2) || (err == 4) || (strlen(Buff) < 1000)) { + showError("Could not get email address: Network error"); +@@ -3533,7 +3533,7 @@ + "MfcISAPICommand=ViewBidItems&userid=%s&completed=0&all=1&rows=200", + authID); + URL *bidsurl = new URL(WebPage, proxyurl); +- returnVal = fetchURL(bidsurl, &Buff, TIMEOUT); ++ returnVal = fetchURL(bidsurl, 0, &Buff, TIMEOUT); + delete(bidsurl); + blackLED(); + showStatus(""); +@@ -3613,7 +3613,7 @@ + sprintf(WebPage, "http://cgi6.ebay.com/aw-cgi/eBayISAPI.dll?" + "ViewListedItems&userid=%s&completed=0&sort=3&since=-1", authID); + URL *listingurl = new URL(WebPage, proxyurl); +- returnVal = fetchURL(listingurl, &Buff, TIMEOUT); ++ returnVal = fetchURL(listingurl, 0, &Buff, TIMEOUT); + delete listingurl; + blackLED(); + showStatus(""); +@@ -3828,7 +3828,7 @@ + infourl = new URL(urlstring, proxyurl); + + greenLED(); +- returnVal = fetchURL(infourl, &HtmlBuff, TIMEOUT); ++ returnVal = fetchURL(infourl, 0, &HtmlBuff, TIMEOUT); + + if (returnVal == NET_NETERROR || returnVal == NET_TIMEOUT) { + // maybe proxy settings changed +@@ -3836,7 +3836,7 @@ + delete(infourl); + infourl = new URL(urlstring, proxyurl); + +- returnVal = fetchURL(infourl, &HtmlBuff, TIMEOUT); ++ returnVal = fetchURL(infourl, 0, &HtmlBuff, TIMEOUT); + } + + g_free(urlstring); +@@ -3905,7 +3905,7 @@ + greenLED(); + gettimeofday(&tm_start, NULL); + +- returnVal = fetchURL(timesyncurl, &HtmlBuff, TIMEOUT); ++ returnVal = fetchURL(timesyncurl, 0, &HtmlBuff, TIMEOUT); + + gettimeofday(&tm_end, NULL); + t1 = (tm_end.tv_sec + 0.000001 * tm_end.tv_usec) |