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


Groups > comp.programming > #225

Re: [OT] a server http

From "io_x" <a@b.c.invalid>
Newsgroups comp.lang.c, comp.programming
References <4d7f9ac1$0$1353$4fafbaef@reader2.news.tin.it> <io40ik$nsi$1@reader1.panix.com>
Subject Re: [OT] a server http
Date 2011-04-13 16:06 +0200
Message-ID <4da5adc9$0$38644$4fafbaef@reader1.news.tin.it> (permalink)
Organization TIN.IT (http://www.tin.it)

Cross-posted to 2 groups.

Show all headers | View raw


"JohnF" <> ha scritto nel messaggio news:io40ik$nsi$1@reader1.panix.com...
> 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.

all ok, the problem was for the program that wrote .htm the page.

i consieder all file binary, i wrote all routines for input-output
from OS to all i can imagine...


Back to comp.programming | Previous | NextPrevious 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