[ipxe-devel] HTTP POST with chain always GET's

Kristian Van Der Vliet kvandervliet at dyn.com
Thu Jun 5 15:52:36 UTC 2014


On Thu, Jun 5, 2014 at 3:42 PM, Michael Brown <mcb30 at ipxe.org> wrote:

> On 05/06/14 13:49, Kristian Van Der Vliet wrote:
>
>> I was hoping to use the HTTP POST & params support in the latest
>> versions of iPXE to perform a simple POST to a custom application, which
>> would allow me to capture various bits of information (like the MAC &
>> System Serial). However it seems that no matter what I do, the HTTP
>> request is always performed as a GET.
>>
>
> I am unable to reproduce this problem.  I see an HTTP POST show up in
> wireshark.
>
>
>  iPXE performs the HTTP request, and even seems to recognise that I've
>> got ##params at the end of the URL. The other end of the HTTP request is
>> a custom Sinatra application with:
>>
>> get "/ipxe/:uuid/discover" do
>>    puts "iPXE GET"
>>    halt(404)
>> end
>>
>> post "/ipxe/:uuid/discover" do
>>    puts "iPXE POST"
>>    halt(404)
>> end
>>
>> I've confirmed that only the GET handler is ever called.
>>
>
> Could you try using wireshark to observe what actually goes over the wire?
>  I suspect the problem may be on your server side.
>
>
Sure. Wireshark shows a GET:
https://www.cloudshark.org/captures/b1088305ff3f

I can also see that the server is working using Curl to issue a GET and
POST to the same endpoint, and Sinatra routes those correctly.

This is with a version of undionly.kpxe built from todays Git master.

 Also is there a cleaner method to perform a "pure" HTTP POST that isn't
>> in some way abusing the chain or img* commands?
>>
>
> No; you have to use the img* commands.  (Otherwise, where is the potential
> output from the POST supposed to go?)


Nowhere; which is what I want! I'd like to use iPXE to provide certain
information (E.g. UUID, Serials etc.) back to a central server so I can
track and later find them for system provisioning, so all I need to do is
POST the data that iPXE can tell me to a REST endpoint and then have iPXE
continue as though nothing at all has happened. I can work around it with

chain http://example.com...##params || goto next
:next
...

but that's still a hack and produces a spurious error (the nicest I can
manage is to return 401 from the REST endpoint, which is at least quick and
painless)

-- 

[image: Dyn logo, Dyn.com] <http://dyn.com/>
<http://twitter.com/dyn>    <http://twitter.com/dyninc>[image: Dyn facebook
account] <http://facebook.com/dyn>    <http://twitter.com/dyninc>[image:
Dyn LinkedIn account] <http://linkedin.com/company/dyn>

Kristian Van Der Vliet  / System Engineer, DevTools
 +44 7983 258 707
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20140605/cf53c3a1/attachment.htm>


More information about the ipxe-devel mailing list