-
Notifications
You must be signed in to change notification settings - Fork 20
fixed httpserver.r2py to work properly for Repy v2 and new unit test for it #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
us341
wants to merge
23
commits into
SeattleTestbed:master
Choose a base branch
from
us341:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
dfa8dc0
updated http_Server
3c41e49
Update httpserver.r2py
us341 6152933
Update httpserver.r2py
us341 021b28f
Create test_httpserver.r2py
us341 0e3ef07
Update test_httpserver.r2py
us341 aa01390
Delete test_httpserver.r2py
us341 2b0b6d2
Create ut_seattlelib_httpserver.r2py
us341 31dc69e
Update ut_seattlelib_httpserver.r2py
us341 b7418fe
Update ut_seattlelib_httpserver.r2py
us341 7322817
Update ut_seattlelib_httpserver.r2py
us341 3b8e34b
Update ut_seattlelib_httpserver.r2py
us341 71aa32d
Update ut_seattlelib_httpserver.r2py
us341 b21fca2
removing #pragma out from file
us341 6a09196
Updated doc string
us341 2b2a18e
Modified doc String to include purpose of updation
us341 ca848b7
added exitall() to unit test
us341 8e040c2
Changed dy_import_module_symbols to dy_link_module
us341 4078ce0
added client for unit test, changed pragma to restrictions.threeports
us341 bb617cf
renamed _httpserver_sendAll method to _httpserver_send_all
us341 d9d3140
changed waitforconn docstring for callback function
us341 f326ef7
test case to check if httpserver raises error for wrong type of statu…
us341 fe2e494
test for wrong value of status code
us341 546b911
checks httpserver response for empty dictionary
us341 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #pragma repy restrictions.threeports dylink.r2py | ||
|
|
||
| dy_import_module_symbols("httpserver.r2py") | ||
|
|
||
| # this method will work as callback function for httpserver_registercallback in httpserver.r2py | ||
| def test_normal_server(httprequest_dictionary): | ||
| # normal server just sends a message | ||
| # store the http dictionary to check the content | ||
| mycontext['httprequest_dictionary'] = httprequest_dictionary | ||
| dict_toreturn = { | ||
| 'version': '1.1', | ||
| 'statuscode': 101, | ||
| 'statusmsg': "valid", | ||
| 'headers': { 'X-Header-Foo': 'Bar' }, | ||
| 'message': "this is original message" | ||
| } | ||
| return dict_toreturn | ||
|
|
||
|
|
||
|
|
||
| def client(): | ||
| sockobj = openconnection(getmyip(), 12345,getmyip(),12346,25) | ||
| assert sockobj.send('') == len('') | ||
|
|
||
| if callfunc == 'initialize': | ||
| # used to store the httprequest_dictionary from server | ||
| mycontext['httprequest_dictionary'] = {} | ||
|
|
||
| # register the callback server | ||
| try: | ||
| handle = httpserver_registercallback((getmyip(),12345), test_normal_server) | ||
| except Exception, e: | ||
| raise Exception('failed test: server raised an exception: ' + str(e)) | ||
|
|
||
| #client call | ||
| client() | ||
|
|
||
| sleep(0.1) | ||
|
|
||
| exitall() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be try-catch block is required here or in httpserver_sendfile_chunked to handle the "filelikeobj.read" exceptions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filelikeobj is object of _httpserver_StringIO class and read() is calling this class's read method. It is handling the ValueError if the class object is closed.