Small AcornHTTP modification wanted
Thomas Milius (7848) 116 posts |
HTTP is used meanwhile with a couple of methods which are not defined inside the classical RFC. AcornHTTP is only supporting the classical methods. However I am thinking that it can be used for the other methods too without any big changes. My intension is to modify the http_message_text function in the default section in such a way, that it is looking inside a file eg. Choices:WWW.AcornHTTP.UsrMthds for a user defined mapping. The fetcher specification says that methods in the range 128-254 are free to be used by the user. Of course I have to try whether this will work or whether other sections of AcornHTTP must be also changed. Any objections ot my idea? |
Dave Higton (1515) 3534 posts |
I’ve used AcornHTTP for a couple of very small projects. It doesn’t make me an expert – far from it – but it has made me realise that AcornHTTP is well out of date. For example, it only supports HTTP 1.0, while the rest of the world supports at least 1.1. So I think it would be useful to see if there is any commonality between what you want to achieve, and what the rest of our community might like to use. What methods are you proposing to add? |
Steffen Huber (91) 1953 posts |
While you’re at it, don’t forget to add support for HTTP/2, HTTP/3 and QUIC. |
Chris Hughes (2123) 336 posts |
Would any of this work need linking into the new TCP/IP stack work being done by ROD? Would it potentially duplicate any work already being done? |
Rick Murray (539) 13850 posts |
I don’t think for connect-fetch-disconnect, it makes that much difference. There would possibly need to be an API change in order to handle keep-alive. What I’d like to see, that shouldn’t be too hard to do, is for any non 200 OK status codes, to have the header and whatever the server returns presented as the payload. Why? Mostly because 301 and 302 redirections. The current method of handling those is a joke.
There shouldn’t be any compatibility issues as a buffer was provided, but no data was expected upon a non-200 return, so existing software ought to just ignore the new payload. Or, if there’s any doubt, use a flag. A flag that means “send me the headers and any data received upon an HTTP error condition”. There is an argument that the URL fetcher ought to handle this for itself, but we run into the problem of how to report back to the user that the URL has changed, and what to do with circular loops. Oh, and handling cookies on a per-site basis ought to be easier than “enumerate everything”. |
Thomas Milius (7848) 116 posts |
Regarding new TCP/IP Stack: I don’t have any information about it. In my opinion a stack has nothing to do with the applications based on it. HTTP/FTP etc. are parts of the application layer. Regarding out of date: Until now I was able to access any sources for MapView. I don’t now in detail whether there are important differences prohibiting access to sites. |
Steffen Huber (91) 1953 posts |
No. Different layers. HTTP is built on top of TCP, i.e. above the transport layer in the ISO layer model. QUIC is even based on UDP.
All the fetchers duplicate other work in certain areas. Everyone could just use libcurl. BASIC developers can’t unfortunately. |
Thomas Milius (7848) 116 posts |
I meenwhile modified AcornHTTP in the way described as follows AcornHTTP is designed very flexibel but it is limited to the classical During the time a couple of other HTTP methods have been defined for various It is a pitty that AcornHTTP can’t be used to handle them so I analyzed I expanded AcornHTTP as follows to cope with additional HTTP methods. Inside Choices:WWW.AcornHTTP a file called UsrMthds can be given which content if present will be loaded during the It consists of lines of the following format MethodNumber=[DecimalFlags,]Method Flags are defined as follows Bit MethodNumber is the number of the method passed to URL_GetURL. During start of an URL fetch. Acorn HTTP tries to look up the text used I am checking it with an application in the moment. |
Thomas Milius (7848) 116 posts |
Regarding response header. I must check how module behaves in detail. In genral there seems to be to possibility to get header and body. However after 2018 there seemed to be a change changing the behaviour in conjunction with headers which eg. caused HomeCntrl to stop working with newer version of HTTPServ. I cured this meanhwile by explicitely ORing &200 in methods in the fetcher program of HomeCntrl |
Rick Murray (539) 13850 posts |
Yes, it was not following the spec. Sadly, the spec is a little overly complicated in places. I used to fetch headers by ORing &200 with the HTTP GET request, which is like you mention. Well, when I copy-pasted that code into ESP32Cam, I removed the bits that set up custom headers because it’s a simple server so the complexity isn’t necessary. And the HTTP requests failed. Because when you don’t have custom headers, it wants the &200 value in… R5 or something. It will choke if it’s merged in with the HTTP GET. Consistency. :-/ |
Thomas Milius (7848) 116 posts |
Yes thats with the consistency. During my actual project I also got confused. When no Header is given the information must not be ORed with the method in R2 but must be put inside R5 but and much worse shifted by 8 Bit to the right. Confusing indeed :-( |
Chris Mahoney (1684) 2165 posts |
The original discussion is here. I’ve linked to the first post in the thread, but most of the relevant stuff is on page 2. |