Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (762)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (846)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [SOLVED] Proper HTTP response for PNG  (Read 393 times)
0 Members and 1 Guest are viewing this topic.
Online kingroka123
« Posted 2018-06-25 21:05:54 »

howdy,

I've been doing some work with backend java server programming (and progressive apps) and I have gotten to the point where I am deploying to Heroku. The problem is none of my icons are loading despite them loading in a local testing environment. Heroku is throwing an error code of H17 which I looked up and says that it has to do with the formatting of my HTTP response. The thing is my entire page loads perfectly except for the icons. I was wondering if anybody else has had an issue similar to this.

Http response format:
1  
2  
3  
4  
5  
HTTP/1.1 200 OK
Content-Type: image/png
Connection: close

*raw image data*


this response works in a local environment (chrome: desktop and mobile)

full error
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
http_error="Invalid HTTP status line" 
at=error code=H17
desc="Poorly formatted HTTP response"
method=GET
path="/img/icons/android-icon-36x36.png"
host=*website*
request_id=*id*
fwd="*some ipv4 adress*"
dyno=web.1
connect=0ms service=2ms status=503 bytes=2482 protocol=https
Offline CommanderKeith
« Reply #1 - Posted 2018-06-26 01:18:56 »

I haven't had your specific problem, but when I put my jsp web application on a server, missing mime types on the server caused errors that didn't appear in my local machine.
How are you hosting the web app? In a tomcat server instance?

Online kingroka123
« Reply #2 - Posted 2018-06-26 03:41:03 »

I'm not using any libraries or anything. Just using the java.net package with FreeMarker as a template engine.

In terms of mime types, my server can output text/* and the image/* types. and can handle get, post, put, and delete requests. I assumed this would at least be enough for testing and that I could add additional features as I need them.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CommanderKeith
« Reply #3 - Posted 2018-06-26 04:37:05 »

Ok, well that sounds fine. Given that you problem only happens with PNG images, sounds like something's wrong with your raw image data or the way it's sent. I'd investigate the way Heroku send the raw image data and copy the way they do it.

It may be that Heroku has some annoying arbitrary restriction, so maybe try another host to see if the same error comes up.

Could also be worth trying other image formats such as JPEGs and see if that works.

Online kingroka123
« Reply #4 - Posted 2018-06-26 18:58:21 »

Ok, so I fixed it. It seems you were half correct. While my header was valid and the way I was loading and sending image data was correct, I was sending the header as plain text and the image data as raw bytes. So Heroku didn't know what to do and just stopped the connection altogether. Thanks!
Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (361 views)
2018-06-10 19:43:48

EgonOlsen (363 views)
2018-06-10 19:43:44

EgonOlsen (300 views)
2018-06-10 19:43:20

DesertCoockie (535 views)
2018-05-13 18:23:11

nelsongames (866 views)
2018-04-24 18:15:36

nelsongames (847 views)
2018-04-24 18:14:32

ivj94 (1295 views)
2018-03-24 14:47:39

ivj94 (418 views)
2018-03-24 14:46:31

ivj94 (1080 views)
2018-03-24 14:43:53

Solater (430 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!