View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001433 | libmicrohttpd | external API | public | 2008-11-01 13:05 | 2008-11-16 17:00 |
| Reporter | Matthew Moore | Assigned To | Christian Grothoff | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 0.2.0 | ||||
| Summary | 0001433: Original request URL with query parameters not available in API | ||||
| Description | Thank you for libmicrohttpd, it fits our needs very well. For logging purposes we want the full request URL as it appeared in the initial line of the HTTP request, including any query parameters. However it appears that libmicro performs a destructive parse on this string, inserting NULLs so query params can later be iterated over via the MHD_get_connection_values call. At the moment we are synthesizing the original request URL by iterating over the query params, re-URL encoding them, etc., but it seems to me a (small) oversight that the full URL as it was presented to the server is not available via the API. | ||||
| Tags | No tags attached. | ||||
|
|
The problem with giving the user both representations is that we would have to make a copy of the data -- which would increase (double) memory requirements, and of course add the overhead of making a copy in the first place. So I wouldn't call this an oversight, it was a largely deliberate design decision (to do the destructive update). Now, what I could see doing is adding an option to give MHD a callback function that should be called on the raw URL. This would have to happen before the headers are parsed, which means there is some issue with invalid requests (we'd call the raw URL callback and then never get the full request). Would this *sufficiently* address your problem? |
|
|
What seems like an oversight in a 64-bit, 32GB server world may be a design decision in embedded systems-land. So please ignore my implication. :-) I believe what you propose could work. The wrinkle it seems would be the thread-per-connection regime, which would make it difficult to correlate URLs delivered via the URL callback and calls to AccessHandlerCallback. You'd have to pass the MHD_Connection* to the URL delivery callback, to give AccessHandlerCallback something to use to correlate the two. Another (lighter-weight?) possibility which would work fine for us would be simply adding an option (MHD_OPTION_QUERY_PARAM_NOPARSE?) which when specified would disable libmicro's param parsing altogether, such that the unmodified URL is delivered to the access handler callback. We already have our own param-parsing code for other reasons. |
|
|
No problem with the implication -- it was made in a reasonably polite manner, and I can understand the sentiment. And of course, if we can make it work for both embedded systems and z/OS, then we shall. As for correlation, we have the "void**" that the user can do with whatever he pleases (per connection). That's already what is used to track state between the multiple calls done for streamed uploads, so this should be trivial. Disabling all parsing with an option -- I don't like that design too much; some clients may want both without having to replicate the parsing code. Also, some options (if we go beyond the URL to general headers) must be parsed by MHD -- which means that we really can not just disable parsing of this stuff. Besides, if we don't parse the request for you, how much does MHD give you other than some trivial TCP socket code? :-). I'll see about adding an extra option for a callback with the full URI once I have a free moment (may take a few weeks). If you have time and are able to provide a patch, things may happen faster ;-). |
|
|
Ah yes, I forgot about con_cls. That will work nicely. If I find time I will work on a patch. |
|
|
Fixed in SVN 7921. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2008-11-01 13:05 | Matthew Moore | New Issue | |
| 2008-11-02 01:52 | Christian Grothoff | Note Added: 0003717 | |
| 2008-11-03 10:55 | Matthew Moore | Note Added: 0003723 | |
| 2008-11-03 12:19 | Matthew Moore | Note Edited: 0003723 | |
| 2008-11-04 00:16 | Christian Grothoff | Note Added: 0003727 | |
| 2008-11-04 12:49 | Matthew Moore | Note Added: 0003728 | |
| 2008-11-08 02:26 | Christian Grothoff | Status | new => confirmed |
| 2008-11-16 16:25 | Christian Grothoff | Status | confirmed => resolved |
| 2008-11-16 16:25 | Christian Grothoff | Resolution | open => fixed |
| 2008-11-16 16:25 | Christian Grothoff | Assigned To | => Christian Grothoff |
| 2008-11-16 16:25 | Christian Grothoff | Note Added: 0003742 | |
| 2008-11-16 17:00 | Christian Grothoff | Status | resolved => closed |
| 2013-05-06 12:52 | Christian Grothoff | Category | API => libmicrohttpd API |
| 2024-01-21 13:24 | Christian Grothoff | Category | libmicrohttpd API => external API |