View Issue Details

IDProjectCategoryView StatusLast Update
0001437libmicrohttpdportabilitypublic2008-11-21 23:33
Reporteracolomb Assigned ToChristian Grothoff  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionwon't fix 
Product Version0.4.0pre1 
Summary0001437: MHD_OPTION_SOCK_ADDR causes sockaddr portability problems
DescriptionSpecifying the interface address to bind to is a very useful feature. However, in order to use struct sockaddr, I need to include the appropriate system headers. This is a problem with portability since it puts the burden to find the correct headers on the MHD user.
Additional InformationIt would be more portable if there was an option to specify a host name which could be resolved by libmicrohttpd. I'm thinking of something along these lines:

MHD_start_daemon(...,
                 MHD_OPTION_BIND_INTERFACE, "localhost", // or IP "127.0.0.1"
                 MHD_OPTION_END);
I don't know the socket APIs very well (that's why I use MHD :-), but if it is possible to listen on several interfaces, maybe the option could be repeated to add more interfaces.

This would be a great feature and insure portability. Thanks for this great library by the way!
TagsNo tags attached.

Activities

Christian Grothoff

2008-11-21 22:59

manager   ~0003749

Resolving would seriously complicate MHD -- especially if we consider that pretty much none of the MHD code currently is blocking and so we would have to use a non-blocking resolver for which there is no portable API AFAIK.

Besides, for various reasons we already require you to manually include the right headers for the target platform before #include-ing "microhttpd.h". And the location of "struct sockaddr" is really not that complex for an autotools setup to determine.

So in conclusion, I really don't think that it would be wise to bloat MHD just to allow users to not bother with including some headers. Besides, 99.99% of all useful binds for the server socket are "localhost".

Issue History

Date Modified Username Field Change
2008-11-21 15:59 acolomb New Issue
2008-11-21 22:59 Christian Grothoff Note Added: 0003749
2008-11-21 23:33 Christian Grothoff Assigned To => Christian Grothoff
2008-11-21 23:33 Christian Grothoff Reproducibility always => N/A
2008-11-21 23:33 Christian Grothoff Status new => closed
2008-11-21 23:33 Christian Grothoff Resolution open => won't fix