Replacement for HTTPD

  • Thread starter Thread starter eric
  • Start date Start date
E

eric

I an effort to save memory on a device with very limited resources, we have
built our own web server and ditched the built in CE HTTPD server. It's
working well with the exception of allowing users to browse the device
through IE. They can browse folders and see files no problem but openning
things like text files is presenting a problem. When the file is opened and
returned through the httpresponse stream, all formatting is lost. I've
implemented a method that semi fixes the problem but was looking for
alternatives. Any suggestions, experience with this?

TIA
 
eric said:
I an effort to save memory on a device with very limited resources, we have
built our own web server and ditched the built in CE HTTPD server. It's
working well with the exception of allowing users to browse the device
through IE. They can browse folders and see files no problem but openning
things like text files is presenting a problem. When the file is opened and
returned through the httpresponse stream, all formatting is lost. I've
implemented a method that semi fixes the problem but was looking for
alternatives. Any suggestions, experience with this?

There's lots that could go wrong here, many errors implementing HTTP
properly could cause something like this. The most likely IMO is not
sending the correct Content-type header. If you put the same file on
a working Web server (like the CD HTTPD server) and do a manual GET
request (for example by telnetting to port 80) to both servers, you
can carefully compare the differences in responses to see what might
be going wrong.

Also, IIRC OpenNetCF has an HTTP server available from their Web site,
you might want to check it out and see if it's helpful.

----Scott.
 
Scott,
Thanks for the info, I will look into it.
Scott Gifford said:
There's lots that could go wrong here, many errors implementing HTTP
properly could cause something like this. The most likely IMO is not
sending the correct Content-type header. If you put the same file on
a working Web server (like the CD HTTPD server) and do a manual GET
request (for example by telnetting to port 80) to both servers, you
can carefully compare the differences in responses to see what might
be going wrong.

Also, IIRC OpenNetCF has an HTTP server available from their Web site,
you might want to check it out and see if it's helpful.

----Scott.
 
Implementing an HTTP server is not trivial - we've written one that provides
a subset of ASP.NET, providing for managed code-behind assemblies. There
are loads of things that can go wrong. I think what you're saying is that
you're trying to provide directoy browsing and file viewing? What type of
file? Text? HTML? You mention a text file, but then you say formatting is
lost, which confuses me, as text files typically have no formatting.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
What I meant by 'formatting' in the case of a .txt file was that all CRLFs
were removed.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:%[email protected]...
 
My guess would be that there aren't there in the actual file. This wouldn't
be too uncommon, depending on what you're editing it with. It's possible,
of course, that your server is stripping them, but I've tried this with our
server and it doesn't seem to be a problem with hard CRs in the file. Maybe
there's some whitespace stripping code that shouldn't run when you're
sending a file, but is fine when sending HTML itself, which doesn't care
much about whitespace?

Paul T.

eric said:
What I meant by 'formatting' in the case of a .txt file was that all CRLFs
were removed.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:%[email protected]...
If it's a text file (.TXT), why would there be formatting in it?

Paul T.
 
Or are you viewing it in a browser? A browser will ignore crlf's if it
thinks the content is html. Throw some <br>'s in there and see if the
line breaks return.

Brady Moritz

My guess would be that there aren't there in the actual file.  This wouldn't
be too uncommon, depending on what you're editing it with.  It's possible,
of course, that your server is stripping them, but I've tried this with our
server and it doesn't seem to be a problem with hard CRs in the file.  Maybe
there's some whitespace stripping code that shouldn't run when you're
sending a file, but is fine when sending HTML itself, which doesn't care
much about whitespace?

Paul T.




What I meant by 'formatting' in the case of a .txt file was that all CRLFs
were removed.
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in messagenews:%[email protected]...
If it's a text file (.TXT), why would there be formatting in it?
Paul T.
I an effort to save memory on a device with very limited resources, we
have built our own web server and ditched the built in CE HTTPD server..
It's working well with the exception of allowing users to browse the
device through IE.  They can browse folders and see files no problembut
openning things like text files is presenting a problem. When the fileis
opened and returned through the httpresponse stream, all formatting is
lost.  I've implemented a method that semi fixes the problem but was
looking for alternatives.  Any suggestions, experience with this?
TIA- Hide quoted text -

- Show quoted text -
 
I'm am viewing in a browser and putting in the <br>s is exactly what I did.
Thats what prompted me to post to the group to see if there
was a better way or if there was something I was missing. I would have
thought Speciffying "Content-Type = text/plain" in the header would make it
work but it doesn't seem to have.

Or are you viewing it in a browser? A browser will ignore crlf's if it
thinks the content is html. Throw some <br>'s in there and see if the
line breaks return.

Brady Moritz

My guess would be that there aren't there in the actual file. This
wouldn't
be too uncommon, depending on what you're editing it with. It's possible,
of course, that your server is stripping them, but I've tried this with
our
server and it doesn't seem to be a problem with hard CRs in the file.
Maybe
there's some whitespace stripping code that shouldn't run when you're
sending a file, but is fine when sending HTML itself, which doesn't care
much about whitespace?

Paul T.




What I meant by 'formatting' in the case of a .txt file was that all
CRLFs
were removed.
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT
com> wrote in messagenews:%[email protected]...
If it's a text file (.TXT), why would there be formatting in it?
Paul T.
I an effort to save memory on a device with very limited resources, we
have built our own web server and ditched the built in CE HTTPD server.
It's working well with the exception of allowing users to browse the
device through IE. They can browse folders and see files no problem but
openning things like text files is presenting a problem. When the file
is
opened and returned through the httpresponse stream, all formatting is
lost. I've implemented a method that semi fixes the problem but was
looking for alternatives. Any suggestions, experience with this?
TIA- Hide quoted text -

- Show quoted text -
 
Text/plain, generally, does work. I just built a text file including
various returns, tabs, etc. on my PC, which runs IIS, and got it via the
browser (actually verified both IE7 and FF3. Everything is dead perfect.
If that's not the case with your server on CE, I've got to say that I'm
pretty sure it's you, not the rest of the participants.

Paul T.

eric said:
I'm am viewing in a browser and putting in the <br>s is exactly what I
did. Thats what prompted me to post to the group to see if there
was a better way or if there was something I was missing. I would have
thought Speciffying "Content-Type = text/plain" in the header would make
it work but it doesn't seem to have.

Or are you viewing it in a browser? A browser will ignore crlf's if it
thinks the content is html. Throw some <br>'s in there and see if the
line breaks return.

Brady Moritz

My guess would be that there aren't there in the actual file. This
wouldn't
be too uncommon, depending on what you're editing it with. It's possible,
of course, that your server is stripping them, but I've tried this with
our
server and it doesn't seem to be a problem with hard CRs in the file.
Maybe
there's some whitespace stripping code that shouldn't run when you're
sending a file, but is fine when sending HTML itself, which doesn't care
much about whitespace?

Paul T.




What I meant by 'formatting' in the case of a .txt file was that all
CRLFs
were removed.
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT
com> wrote in messageIf it's a text file (.TXT), why would there be formatting in it?
I an effort to save memory on a device with very limited resources, we
have built our own web server and ditched the built in CE HTTPD
server.
It's working well with the exception of allowing users to browse the
device through IE. They can browse folders and see files no problem
but
openning things like text files is presenting a problem. When the file
is
opened and returned through the httpresponse stream, all formatting is
lost. I've implemented a method that semi fixes the problem but was
looking for alternatives. Any suggestions, experience with this?
TIA- Hide quoted text -

- Show quoted text -
 
Back
Top