Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8772197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:58:53+00:00 2026-06-13T17:58:53+00:00

I need a library that can only format a correct HTTP response (without creating

  • 0

I need a library that can only format a correct HTTP response (without creating a web server because I already have this one).

I have to pass a body of an http response and a content type to this library.

The following function does not work properly if I try to send AJAX – jQuery does not find any response. However if I type a corresponding URL in the URL string of browser then a page is displayed.

def response( data ):   
    return "HTTP/1.0 200 OK\r\nContent-Type:application/json\r\nConnection:close\r\n\r\n{0}\r\n".format( data ) 

Details. The data variable is string of json. I also use the SocketServer class, call self.request.sendall( result_response ) in child’s handle() function.

# the 'request handler' class
class StateRequestHandler( SocketServer.BaseRequestHandler ):

    def handle( self ):
    ...
        self.request.sendall( response( some_json ) )

# the configured server class
class StateServer( SocketServer.ThreadingMixIn, SocketServer.TCPServer ):
pass

Solved. The reason was in cross-domain requests.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:58:54+00:00Added an answer on June 13, 2026 at 5:58 pm

    Try the following:

    1. Although the HTTP 1.0 and 1.1 spec say that a white space is optional between the header name and header value, the specs do say “a single SP[ace] is preferred”.

    2. Ensure that you do not have any Cross Domain issues so ensure your HTML page is served from exactly the domain,scheme and port as your JSON response (Unless you’ve correctly configured CORS.

    3. Use Chrome Dev Tools / Firebug / Fiddler to see what request they’re making and check the Javascript console.

    4. Use Wireshark to see exactly what’s on the wire.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to find/create a library that can load hdr images in many formats
I need a recommendation for a pythonic library that can marshall python objects to
I need to process audio that comes from the iPod library. The only way
I developed a library and I need that the users of that library can
I'm developing a Java library that can be used within Android, Web and Desktop
I need a Python library that supports PEM files and both RSA signing and
I need some help on compiler flags in c++. I'm using a library that
I need to call a library function that sometimes won't terminate within a given
I need a cross-platform library/algorithm that will convert between 32-bit and 16-bit floating point
I need to debug a class library project that is provided to the main

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.