Jump to content




HTTP Enhancements


31 replies to this topic

#21 dimitriye98

  • Members
  • 77 posts

Posted 03 June 2015 - 06:59 AM

View Postardera, on 20 April 2015 - 07:41 PM, said:

What about adding a xhttp API which allows you to do everything that is possible in the web, and modify the http API so it's just a simple wrapper around the xhttp API?

PLEASE PLEASE OH GOD PLEASE!!!

That is all I have to say.

#22 dimitriye98

  • Members
  • 77 posts

Posted 04 June 2015 - 08:08 PM

Apparently that isn't all I have to say. Personally, I think the best choice would be to deprecate the current http api (but not remove it, to leave compatibility).

A new xhttp api would be rolled out based around a core function (which would accept any value for request_type, even illegal ones):

xhttp.request(request_type, url, [headers], [data]) -- Since headers needs to be a table and data a string, it should
                                                    -- be simple to figure out which one is omitted when one is

Now, unlike with the current http api, only outright failures (e.g. time out / cannot resolve) to respond would trigger a "xhttp_failure" event. Any actual response, even a error response such as a 404 would trigger a "xhttp_response" event. (an appropriate "http_failure" or "http_success" event would still be sent for compatibility) The handle from the event would be the same as that from an "http_success" event, except it would have an additional "handle.getHeaders()" method.

Edited by dimitriye98, 04 June 2015 - 08:11 PM.


#23 ElvishJerricco

  • Members
  • 803 posts

Posted 04 June 2015 - 09:15 PM

View Postdimitriye98, on 04 June 2015 - 08:08 PM, said:

Apparently that isn't all I have to say. Personally, I think the best choice would be to deprecate the current http api (but not remove it, to leave compatibility).

A new xhttp api would be rolled out based around a core function (which would accept any value for request_type, even illegal ones):

xhttp.request(request_type, url, [headers], [data]) -- Since headers needs to be a table and data a string, it should
													-- be simple to figure out which one is omitted when one is

Now, unlike with the current http api, only outright failures (e.g. time out / cannot resolve) to respond would trigger a "xhttp_failure" event. Any actual response, even a error response such as a 404 would trigger a "xhttp_response" event. (an appropriate "http_failure" or "http_success" event would still be sent for compatibility) The handle from the event would be the same as that from an "http_success" event, except it would have an additional "handle.getHeaders()" method.

Should also be able to ask for a binary mode handle, so that binary data can be properly downloaded.

#24 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 04 June 2015 - 10:06 PM

View PostElvishJerricco, on 04 June 2015 - 09:15 PM, said:

Should also be able to ask for a binary mode handle, so that binary data can be properly downloaded.

Indeed. If there's a single change this needs to be it.

#25 dimitriye98

  • Members
  • 77 posts

Posted 01 October 2015 - 02:39 AM

I'll LOUDLY bump this, since it never got a response, and the request is valid as ever.

#26 cyanisaac

  • Members
  • 369 posts
  • LocationSan Diego, CA

Posted 02 October 2015 - 04:16 PM

These features would be a gamechanger if implemented. Full http support would be absolutely insane.

#27 COOLGAMETUBE

  • Members
  • 49 posts
  • LocationGermany

Posted 17 October 2015 - 05:16 PM

View PostSeaLife, on 16 April 2015 - 06:53 PM, said:

This would be very helpful to play with the GitLab Api :)

Cause it returns 401 http-codes with text which i need to use... (Like: {"message": "No Permitted"})

http.get( url ), http.post( url ) and http.return( ) should always return an Object

* Header (With the Code and so on...)
* Content (Even 404-Messages)


Or an mode?

http.enhanced( true ) - And now it should work? :D (Just a little idea to keep the old "api" for all old programs)



+1

You already can read the HTTP-State:
conn = http.get("http://example.com")
resultcode = conn.getResponseCode()

Source: http://www.computerc.../wiki/HTTP_(API)

#28 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 17 October 2015 - 05:19 PM

View PostCOOLGAMETUBE, on 17 October 2015 - 05:16 PM, said:

You already can read the HTTP-State:
conn = http.get("http://example.com")
resultcode = conn.getResponseCode()

Source: http://www.computerc.../wiki/HTTP_(API)

Not if an error occurs (such as a 404 or 500). This makes it near-impossible to debug HTTP applications (particularly APIs such as GitHub's/GitLab's/Dropbox's).

Hmmmm, shouldn't be too hard to add to CCTweaks though :).

Edited by SquidDev, 18 October 2015 - 12:26 PM.


#29 Konlab

  • Members
  • 595 posts
  • LocationKerbin

Posted 18 October 2015 - 02:53 PM

View PostSquidDev, on 17 October 2015 - 05:19 PM, said:

View PostCOOLGAMETUBE, on 17 October 2015 - 05:16 PM, said:

You already can read the HTTP-State:
conn = http.get("http://example.com")
resultcode = conn.getResponseCode()

Source: http://www.computerc.../wiki/HTTP_(API)

Not if an error occurs (such as a 404 or 500). This makes it near-impossible to debug HTTP applications (particularly APIs such as GitHub's/GitLab's/Dropbox's).

Hmmmm, shouldn't be too hard to add to CCTweaks though :)/>.
Internet antenna peripheral

#30 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 18 October 2015 - 08:07 PM

View PostKonlab, on 18 October 2015 - 02:53 PM, said:

View PostSquidDev, on 17 October 2015 - 05:19 PM, said:

Hmmmm, shouldn't be too hard to add to CCTweaks though :)/>.
Internet antenna peripheral

Nah, I just patched the HTTP API.

#31 Konlab

  • Members
  • 595 posts
  • LocationKerbin

Posted 19 October 2015 - 02:29 PM

View PostSquidDev, on 18 October 2015 - 08:07 PM, said:

View PostKonlab, on 18 October 2015 - 02:53 PM, said:

View PostSquidDev, on 17 October 2015 - 05:19 PM, said:

Hmmmm, shouldn't be too hard to add to CCTweaks though :)/>/>.
Internet antenna peripheral

Nah, I just patched the HTTP API.
That looks like an IPeripheral implementation for a peripheral block

#32 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 19 October 2015 - 03:17 PM

View PostKonlab, on 19 October 2015 - 02:29 PM, said:

That looks like an IPeripheral implementation for a peripheral block

The implementation for a Lua API or a Peripheral is pretty similar.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users