[Prev][Next][Index][Thread]
What am I doing wrong here?
-
To: www-lib@w3.org
-
Subject: What am I doing wrong here?
-
From: Matthew Freedman <mattf@cac.washington.edu>
-
Date: Fri, 2 Jun 1995 11:08:29 -0700 (PDT)
-
Message-Id: <Pine.ULT.3.92.950602105626.10693d-100000@elvis.cac.washington.edu>
Following is a tiny wrapper program that I wrote to use libwww to simply
retrieve files, and send them out stdout. I find that it works with the
first http URL I put in, but if I put in a second one, it core dumps. Here
is the program...
#include "WWWLib.h"
#include "stubs.h" /* Just a bunch of HText_* function stubs */
#define MAX_URL_LEN 1024
main(int argc, char *argv[])
{
char url[MAX_URL_LEN];
HTRequest *request;
/* Initialize the library */
HTLibInit();
WWW_TraceFlag = TRUE;
/* Set up the static part of our request structure */
request = HTRequest_new();
request->output_format = WWW_SOURCE;
request->output_stream = HTFWriter_new(stdout, TRUE);
/* Loop until close of stdin, reading in URLs */
while (gets(url))
HTLoadAbsolute(url, request);
HTLibTerminate();
}
Is there anything obviously wrong with it?
Here is the output, after I put in the second URL...
http://www.cen.com/mw3/
Composing Authorization for www.cen.com:80/mw3/
HTAASetup_lookup: No template matched `mw3/' (so probably not protected)
HTMIME: MIME content type is text/html, converting to */*
StreamStack. Constructing stream stack for text/html to */*
pid 13154 (get_http) was killed on an unaligned access, at pc 0x429efc
Bus error (core dumped)
And here is the dbx stack trace (as I mentioned before, for some reason
CodeCenter chokes when trying to link in libwww, anybody know why?)...
> 0 HTMIME_write(me = 0x10016200, b = 0x1001f000 = "<HTML>\n<TITLE>MW3:
Motif o
n the World Wide Web</TITLE>\n<BODY>\n\n<PRE><A HREF="/"><IMG ALT="Century
Compu
ting Home" SRC="/ui/home.gif"\...", l = 512)
["../../Library/Implementation/HTMI
ME.c":336, 0x429ef8]
1 HTTPStatus_put_block(me = 0x10016100, b = 0x1001f000 = "<HTML>\n<TITLE>MW3:
Motif on the World Wide Web</TITLE>\n<BODY>\n\n<PRE><A HREF="/"><IMG ALT="Centu
ry Computing Home" SRC="/ui/home.gif"\...", l = 512)
["../../Library/Implementat
ion/HTTP.c":571, 0x41d27c]
2 .block72 ["../../Library/Implementation/HTFormat.c":1189, 0x40d9bc]
3 HTInputSocket_read(isoc = 0x1001f000, target = 0x10016100)
["../../Library/
Implementation/HTFormat.c":1189, 0x40d9bc]
4 HTLoadHTTP(request = 0x10016000)
["../../Library/Implementation/HTTP.c":723
, 0x41d8e4]
5 .block23 ["../../Library/Implementation/HTAccess.c":697, 0x403430]
6 HTLoad(request = 0x10016000, keep_error_stack = '\000')
["../../Library/Implementation/HTAccess.c":697, 0x403430]
7 .block27 ["../../Library/Implementation/HTAccess.c":858, 0x403aec]
8 .block26 ["../../Library/Implementation/HTAccess.c":858, 0x403aec]
9 .block25 ["../../Library/Implementation/HTAccess.c":858, 0x403aec]
10 HTLoadDocument(request = 0x10016000, keep_error_stack = '\000')
["../../Library/Implementation/HTAccess.c":858, 0x403aec]
11 HTLoadAbsolute(addr = 0x7fffb628 = "http://www.cen.com/mw3/", request = 0x1
0016000) ["../../Library/Implementation/HTAccess.c":885, 0x403bbc]
12 main(argc = 1, argv = 0x7fffba44) ["get_http.c":75, 0x400484]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
= Matthew M. Freedman =
= U. of Washington Information Systems mattf@cac.washington.edu =
= 4545 15th Ave. NE; 3rd Floor (206) 543-5593 =
= Seattle, WA 98105 =
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-