Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.programming > #223

Re: [OT] a server http

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!panix!panix.com!forkosh
From JohnF <john@please.see.sig.for.email.com>
Newsgroups comp.lang.c, comp.programming
Subject Re: [OT] a server http
Date Wed, 13 Apr 2011 11:14:28 +0000 (UTC)
Organization PANIX Public Access Internet and UNIX, NYC
Lines 24
Message-ID <io40ik$nsi$1@reader1.panix.com> (permalink)
References <4d7f9ac1$0$1353$4fafbaef@reader2.news.tin.it>
NNTP-Posting-Host panix3.panix.com
X-Trace reader1.panix.com 1302693268 24466 166.84.1.3 (13 Apr 2011 11:14:28 GMT)
X-Complaints-To abuse@panix.com
NNTP-Posting-Date Wed, 13 Apr 2011 11:14:28 +0000 (UTC)
User-Agent tin/1.8.3-20070201 ("Scotasay") (UNIX) (NetBSD/5.1 (i386))
Xref x330-a1.tempe.blueboxinc.net comp.lang.c:2374 comp.programming:223

Cross-posted to 2 groups.

Show key headers only | View raw


In comp.lang.c io_x <a@b.c.invalid> wrote:
> why my little http server
> is ok for send the right file eg.  file.htm
> but is not ok in send the file     image.gif
> 
> in other words, it can import the file
> and not import the gif image in that page.

Is it compiled for windows? And are you writing
file.htm and image.gif to stdout? I had the same problem
with my own little server <www.forkosh.com/mimetex.html>
getting it to run on windows (in addition to linux).
And you found the problem yourself mentioning \n in one
of your followup posts.

In windows, stdout is ascii, not binary. You have to
#include <fcntl.h> and #include <io.h>, and then
issue a _setmode(_fileno(stdout),O_BINARY) to make it binary
for windows. Otherwise windows gives you the "newline problem",
i.e., every time your gif image happens to contain a byte
that's a carriage return, windows will tack on an extra linefeed
for you. And that'll totally mess up your gif.
-- 
John Forkosh  ( mailto:  j@f.com  where j=john and f=forkosh )

Back to comp.programming | Previous | NextNext in thread | Find similar


Thread

Re: [OT] a server http JohnF <john@please.see.sig.for.email.com> - 2011-04-13 11:14 +0000
  Re: [OT] a server http "io_x" <a@b.c.invalid> - 2011-04-13 16:06 +0200

csiph-web