ID:2686926
 
BYOND Version:513
Operating System:Windows 10 Pro 64-bit
Web Browser:Chrome 90.0.4430.212
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
world.Export() seems to be very picky with what it does and does not work in, with no real rhyme or reason between what works and does not work. This also breaks over multiple BYOND versions

Working examples include
- Loading a BYOND members profile (Code 200)
- Loading a JSON API (Code 200)
- Loading a normal HTTP website (Code 200)

Non-working examples include:
- Loading icanhazip.com (Code 200) [This may be due to a header with unicode in it]
- Loading a 400 bad request page
- Loading a 404 page
- Sometimes a code 200 page randomly gets its content truncated

Summarised: Seems to break with anything that isn't code 200

Numbered Steps to Reproduce Problem:

Code Snippet (if applicable) to Reproduce Problem:

Code that doesnt work
/world/New()
var/http[] = world.Export("http://icanhazip.com")
world.log << "Params: [list2params(http)]"
world.log << "Len: [length(http)]"


Code that does work
/world/New()
var/http[] = world.Export("http://byond.com/members/affectedarc07?format=text")
world.log << "Params: [list2params(http)]"
world.log << "Len: [length(http)]"


Expected Results:
world.Export() to have consistent results and work properly

Actual Results:
Spurious failures with no real rhyme or reason

Does the problem occur:
Every time? Or how often? Its spurious
In other games? Tested on a base codebase
In other user accounts? Yes
On other computers? Yes

When does the problem NOT occur?

See earlier examples of what does work

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Does not work in 1536 either

Workarounds:

Use an external HTTP client library with FFI
all of this is currently expected behavior.

no https support. Export crashes on an error response.

I've been pressuring lummy to implement curl for this very reason.
In response to Super Saiyan X
Super Saiyan X wrote:
all of this is currently expected behavior.

no https support. Export crashes on an error response.

I've been pressuring lummy to implement curl for this very reason.

Im not using HTTPS. None of these are using it.
You can wrap it inside of a
try/catch()
so that if it does crash you can handle it from there.
In this specific case, the server is returning a 403 response. I think the way BYOND handles this could stand to be changed because right now it's not returning a list with usable information to tell you about the status.
In response to Kozuma3
Kozuma3 wrote:
You can wrap it inside of a
try/catch()
so that if it does crash you can handle it from there.

It doesnt crash, it just returns an empty list