Sergey Lyubka wrote:
> Hi Joel! Nice to hear that RTEMS is using SHTTPD.
>   
I have personally run it on i386 and PowerPC.  It compiles
on arm, bfin, m68k, coldfire, mips, sh, and sparc. I would
expect it to work on all those targets given a NIC.
> On 10/08/07, Joel Sherrill <[EMAIL PROTECTED]> wrote:
>   
>> Issue #1: In building for the avr and h8300, there
>> were errors.  When I investigated, I came across
>> this in shttpd:
>>
>> defs.h:#define  URI_MAX         32768           /* Maximum URI
>> size            */
>> log.c:  char    date[64], buf[URI_MAX];
>> log.c:  char    date[64], buf[URI_MAX], *q1 = "\"", *q2 = "\"";
>> shttpd.c:       char            path[URI_MAX], buf[1024];
>>
>> These put 32K on the stack.  This is extremely excessive
>> for most embedded applications (4-8K fixed stacks are
>> typical) and over the memory limits for stacks on the
>> CPUs that flagged this.  Is there anything
>> that can be done about these?
>>     
>
> The reason such big buffer is allocated is that the log message contains
> the URI, but I think it can be done the other way. We can fprintf() directly 
> to
> the file stream without using big intermediate buffer. Small intermediate 
> buffer
> might be used for printing date, etc.
>
>   
Those were the only places I saw the URI_MAX constant used
in buffer allocations so if it is just for logging, it would certainly
be nice to do it another way.

One of those lines also includes a 1K buffer which is also kind of
arbitrarily large.  I don't know what other large items are declared
as stack variables since I just tripped across those accidentally.
>> Issue #2: GCC dies with an internal compiler error
>> on the long snprintf() calls in log.c on the Coldfire.
>> Ralf discovered that splitting the snprintf call
>> into multiple ones works around the problem.  So this has
>> a workaround in our tree if you want it.
>>     
>
> Well. I was thinking even to come up with my own, stripped-down
> version on snprintf(). Having all the troubles snprintf() caused so far, it
> might be not that bad idea as it sounds.
>
>   
If it causes trouble for other reasons, it might not be a bad idea.
>> Issue #3: General cleanup.  Ralf has ifdef'ed out most if not
>> all of the use of my_XXX for rtems.  He also made all non-public
>> symbols start with _shttp_ to avoid conflicts in statically
>> linked embedded applications.  He added support for using
>> native MD5 routines since we already had these.  And there
>> was some C99 type cleanup.
>>     
>
> I beleive that SHTTPD uses static for all private symbols, so it should
> not interfere with the rest of the your code. You guys using gcc's linker,
> as far as I know, so it should work as is.
>
>   
I was just reading the ChangeLog.  It looks like the actual change
involves this trick to rename a bunch of symbols. 

libshttpd_a_CPPFLAGS += -Dcheck_authorization=_shttpd_check_authorization
libshttpd_a_CPPFLAGS += 
-Ddecode_url_encoded_string=_shttpd_decode_url_encoded_string
libshttpd_a_CPPFLAGS += -Dedit_passwords=_shttpd_edit_passwords
libshttpd_a_CPPFLAGS += -Delog=_shttpd_elog
libshttpd_a_CPPFLAGS += -Dget_dir=_shttpd_get_dir
libshttpd_a_CPPFLAGS += -Dget_file=_shttpd_get_file
libshttpd_a_CPPFLAGS += -Dget_headers_len=_shttpd_get_headers_len
libshttpd_a_CPPFLAGS += -Dget_mime_type=_shttpd_get_mime_type
libshttpd_a_CPPFLAGS += -Dinit_from_argc_argv=_shttpd_init_from_argc_argv
libshttpd_a_CPPFLAGS += 
-Dis_authorized_for_put=_shttpd_is_authorized_for_put
libshttpd_a_CPPFLAGS += -Dis_registered_uri=_shttpd_is_registered_uri
libshttpd_a_CPPFLAGS += -Dlog_access=_shttpd_log_access
libshttpd_a_CPPFLAGS += -Dparse_headers=_shttpd_parse_headers
libshttpd_a_CPPFLAGS += -Dput_dir=_shttpd_put_dir
libshttpd_a_CPPFLAGS += 
-Dsend_authorization_request=_shttpd_send_authorization_request
libshttpd_a_CPPFLAGS += -Dsend_server_error=_shttpd_send_server_error
libshttpd_a_CPPFLAGS += -Dset_close_on_exec=_shttpd_set_close_on_exec
libshttpd_a_CPPFLAGS += -Dset_mime_types=_shttpd_set_mime_types
libshttpd_a_CPPFLAGS += 
-Dset_non_blocking_mode=_shttpd_set_non_blocking_mode
libshttpd_a_CPPFLAGS += 
-Dsetup_embedded_stream=_shttpd_setup_embedded_stream
libshttpd_a_CPPFLAGS += -Dstop_stream=_shttpd_stop_stream
libshttpd_a_CPPFLAGS += -Dusage=_shttpd_usage

libshttpd_a_CPPFLAGS += -Dknown_http_methods=_shttpd_known_http_methods
libshttpd_a_CPPFLAGS += -Doptions=_shttpd_options
libshttpd_a_CPPFLAGS += -Dio_file=_shttpd_io_file
libshttpd_a_CPPFLAGS += -Dio_socket=_shttpd_io_socket
libshttpd_a_CPPFLAGS += -Dio_embedded=_shttpd_io_embedded
libshttpd_a_CPPFLAGS += -Dio_dir=_shttpd_io_dir
libshttpd_a_CPPFLAGS += -Dio_cgi=_shttpd_io_cgi

libshttpd_a_CPPFLAGS += -Dcurrent_time=_shttpd_current_time
libshttpd_a_CPPFLAGS += -Dtz_offset=_shttpd_tz_offset

Do you want me to send you the diff or do you just want to get it from
RTEMS CVS yourself?

--joel
> sergey
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
shttpd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shttpd-general

Reply via email to